Skip to content

impl(atlas): D1 hot-cache freshness evaluator — per-class watermark/TTL rules #13101

Open

Description

@dezren39

Implementation follow-on 2 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 (§1, §8 item 2 of the design): the freshness evaluator — per-class rules (A: content hash is the version; B: source-watermark equality or TTL_B 60 s, first failure wins; C: TTL_C 15 min + no later invalidation event), the tenant watermark read, and fail-safe degradation (watermark source unreachable: Class B TTL-only halved, Class C not served, Class A unaffected).

Oracle (named per testing doctrine): property tests over generated (watermark, age, class, event) sequences asserting the invariant that no serve happens outside the bound; the stale-serves counter's expected value is zero.

Activity

  1. developing-today commented on Nov 23, 2026

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

    @dezren39
    MemberAuthor

    xaltha lane picking this up: implementing the D1 hot-cache freshness evaluator (per-class watermark/TTL rules + fail-safe degradation) with the property-test oracle, based on main. Branch: xaltha/13101-atlas-freshness.

  3. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    xaltha lane: landed as PR #13133 — #13133

    What landed: pkgs/atlas-search/worker/src/freshness.ts (pure evaluator: Class A hash-is-version; Class B watermark-equality AND TTL_B 60 s, first failure wins; Class C TTL_C 15 min + no later invalidation event; fail-safe degradation — B TTL-only halved, C not served, A unaffected; watermark read seam mapping every source failure to unavailable) + test/freshness.test.ts + a README Shape bullet. Based on main; no dependence on follow-on 1 (#13100).

    Evidence: the named property oracle runs over generated (watermark, age, class, event) sequences (200 sequences, >1000 evaluations, 3 configs) asserting exact agreement with an independent transcription of the §1 table — stale-serves counter zero. Sandbox verification (worker's node_modules are not installed here): the committed vitest file run byte-for-byte under bun test with a vitest→bun:test shim — 23/23 pass, 1398 expect() calls; existing key/body/space suites 15/15 under the same shim; mcp/worker suites need the Cloudflare pool (untouched files); strict tsc passes on both new files. CI is the first run under vitest proper. PR body says Closes #13101 — the issue's scope (rules + watermark read + degradation + oracle) is fully covered.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions