Skip to content

impl(atlas): D1 hot-cache schema, binding, and store module for the atlas-search Worker #13100

Closed

Description

@dezren39

Implementation follow-on 1 of 6 under #9134 (Atlas D1 tenant hot cache design, doc/2026-11-23T08-06-00Z_design_atlas_d1_tenant_hot_cache/2026-11-23T08-06-00Z_design_atlas_d1_tenant_hot_cache.md, merged via PR #13098).

Scope (§5, §8 item 1 of the design): the D1 schema from the design's storage section, the wrangler D1 binding for the atlas-search Worker (pkgs/atlas-search/worker — it has no D1 binding today), and a cache store module exposing get/put/evict primitives over the hot_cache table, behind a config flag, default off.

Acceptance: schema migration lands; store module round-trips entries for all three classes (A/B/C) in tests against a local D1 (miniflare or equivalent); flag off = zero behavior change on existing read paths.

Activity

  1. developing-today commented on Nov 23, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Claimed by Lane OL (sandbox fix lane) for implementation: D1 schema migration, wrangler D1 binding, and the hot-cache store module (get/put/evict over hot_cache, flag-gated, default off) per the #9134 design §5/§8 item 1. Working in a laptop worktree off current main.

  3. added a commit that references this issue on Nov 23, 2026
  4. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Done — Lane OL. Landed via PR #13141 (merged 9db2efc7ce0, head SHA-guarded at cfe0eabf758).

    • Schema: pkgs/atlas-search/worker/migrations/0001_hot_cache.sql — the design(atlas): D1 tenant hot cache — admission, invalidation, Turso-hop skip #9134 design §5 hot_cache table + eviction index, verbatim; migrations_dir wired in wrangler.toml.
    • Binding: HOT_CACHE D1 binding + HOT_CACHE_ENABLED flag (default "false") in both wrangler.toml and cloudflare.config.ts. The committed database_id is the repo's local-placeholder convention (mirrors pkgs/id/worker-poc/d1-journal-poc); the real atlas-hot-cache database is created at deploy time and its id replaces the placeholder in both files — recorded in the worker README.
    • Store module: src/hot_cache.ts — HotCacheStore with get/put/touch/evict over the shared table (tenant in the key), plus hotCacheEnabled/hotCacheStore gating: flag off or binding absent → no store, pre-cache path unchanged. Env gained only the optional fields; no read path touched.
    • Verification: test/hot_cache.test.ts applies the real migration file to a local miniflare D1 and round-trips entries for all three classes (A/B/C) byte-for-byte, plus tenant isolation, put-replace bookkeeping reset, touch hit-counting, evict semantics, and flag gating — 10/10. Full package suite 41/41 (31 pre-existing + 10 new); npm run typecheck clean.

    Next slices stand as filed: #13101 (freshness evaluator), #13103 (admission/eviction), #13105 (read-path integration), #13106 (invalidation), #13107 (measurement).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions