GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — impl(atlas): D1 hot-cache freshness evaluator — per-class watermark/TTL rules (#13101) by dezren39 · Pull Request #13133 · developing-today/code

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •
edited by blacksmith-sh Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Follow-on 2 of 6 under #9134 (Atlas D1 tenant hot cache design, merged via PR #13098), implementing §1 + §8 item 2 in pkgs/atlas-search/worker. Based on main — no code dependence on follow-on 1 (#13100, the D1 store).

What landed

  • src/freshness.ts — the pure freshness evaluator. No I/O, no clock reads: the caller supplies now and the watermark read result.
    • Class A (content-addressed payloads): the hash is the version — fresh on hash match at any age, watermark state irrelevant; a hash mismatch (or an entry with no hash to prove identity) is never served.
    • Class B (query result sets): fresh iff the entry's source_watermark still equals the tenant's current watermark and age ≤ TTL_B (default 60 s) — whichever fails first, so a watermark advance is stale even inside the TTL.
    • Class C (tenant aggregates): fresh iff age ≤ TTL_C (default 15 min) and no invalidation event for the tenant post-dates the entry.
    • Fail-safe degradation (§1): watermark source unreachable → Class B degrades to TTL-only with TTL_B divided by the degraded divisor (default 2 → 30 s, floored, clamped ≥ 1 so it can never extend), Class C stops being served, Class A unaffected. A future filled_at (clock skew) is never fresh for the TTL classes.
    • The tenant watermark read: WatermarkSource seam + readTenantWatermark, mapping every source failure (throw, null) to unavailable — unknown can only narrow the bound, never widen it. evaluateWithWatermarkRead composes read + pure evaluation for the read path.
    • Bounds are named config (ttlBSeconds, ttlCSeconds, degradedDivisor) with the design's defaults; invalid overrides fall back to the defaults.
    • Verdicts carry a reason (the §2 skip-log surface), the age, the applied bound, and a degraded flag.
  • test/freshness.test.ts — 23 tests. The named oracle: property tests over generated (watermark, age, class, event) sequences (seeded, reproducible; 200 sequences × up to 12 events across 3 configs) asserting exact agreement with an independent transcription of the §1 table — the stale-serves counter is asserted zero, and so is the over-refusal counter. Plus unit tests for each named rule, config resolution, and the watermark read.
  • README.md — Shape section gains the module, noting it is not wired into a read path yet (store is impl(atlas): D1 hot-cache schema, binding, and store module for the atlas-search Worker #13100, integration is follow-on 4).

Test evidence

The worker package's node_modules are not installed in the sandbox (and installing was out of bounds for this lane), so the committed vitest file was run byte-for-byte under bun test with a vitest→bun:test shim, in a scratch dir outside the repo:

  • New suite: 23 pass / 0 fail, 1398 expect() calls (the property oracle alone makes >1000 evaluations).
  • Existing runtime-independent suites (key, body, space): 15 pass / 0 fail under the same shim.
  • mcp/worker suites import cloudflare:test and need the Cloudflare vitest pool — not runnable in the sandbox; their files are untouched (this PR only adds files plus one README bullet).
  • Strict typecheck (tsc 5.9.3, --strict --skipLibCheck, package-equivalent flags): both new files pass.
  • CI (atlas-search-worker-tests) runs the real vitest pool suite and is the first run of the new tests under vitest proper.

Closes #13101


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@dezren39
impl(atlas): D1 hot-cache freshness evaluator — per-class watermark/T…
52315ba
…TL rules (#13101)

Follow-on 2 of 6 under #9134 (design merged via PR #13098), §1 + §8
item 2: the pure freshness evaluator for the D1 tenant hot cache.

- Class A: the content hash is the version — fresh on hash match at
  any age, watermark state irrelevant; a mismatch is never served.
- Class B: fresh iff the entry's source_watermark still equals the
  tenant's current watermark AND age <= TTL_B (60 s) — whichever
  fails first; a watermark advance is stale even inside the TTL.
- Class C: fresh iff age <= TTL_C (15 min) AND no invalidation
  event for the tenant post-dates the entry.
- Fail-safe degradation: watermark source unreachable -> Class B
  TTL-only with TTL_B halved (divisor config, floored, clamped so
  it can never extend), Class C not served, Class A unaffected.
  Clock skew (future filled_at) is never fresh for the TTL classes.
- The tenant watermark read is a thin seam (WatermarkSource) that
  maps every source failure to 'unavailable'; the evaluator itself
  is pure — no I/O, no clock reads.
- Bounds are named config (TTL_B, TTL_C, degraded divisor) with the
  design's defaults; invalid overrides fall back to the defaults
  and can never widen a bound.

Oracle (per the issue): property tests over generated (watermark,
age, class, event) sequences assert exact agreement with an
independent transcription of the §1 table; the stale-serves
counter is asserted zero (200 sequences, >1000 evaluations, plus
22 unit tests for the named rules). README Shape gains the module.

Verification (sandbox): the worker package's node_modules are not
installed in the sandbox, so the committed vitest file was run
byte-for-byte under bun test with a vitest->bun:test shim: 23/23
pass, 1398 expect() calls; the package's runtime-independent
suites (key, body, space) also pass 15/15 under the same shim;
mcp/worker suites need the Cloudflare pool and are untouched.
Strict tsc (5.9.3, package-equivalent flags) passes on both new
files. CI runs the real vitest pool suite.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 42122f6a-b83b-486b-90c4-c527e1cf9d14
Commits

Reviewing files that changed from the base of the PR and between cc14b90 and 46ddbe5.

Files selected for processing: 3

  • pkgs/atlas-search/worker/README.md
  • pkgs/atlas-search/worker/src/freshness.ts
  • pkgs/atlas-search/worker/test/freshness.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dezren39 dezren39 mentioned this pull request Nov 23, 2026
impl(atlas): D1 hot-cache freshness evaluator — per-class watermark/TTL rules #13101
Closed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T08:56:51.005140Z 52315ba PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Nov 23, 2026
impl(atlas): D1 hot-cache invalidation — tenant events, Worker consumption, operator purge #13106
Closed
impl(atlas): D1 hot-cache read-path integration — Turso-hop skip with skip logging #13105
Open
AUDIT-7 Lane 1 follow-up: rebase-and-merge queue for 90 blocked PRs (batches A–H) #13903
Closed
@dezren39
merge origin/main into xaltha/13101-atlas-freshness (keep-both README…
46ddbe5
…: key/measurement + freshness)
@dezren39
dezren39 merged commit bff8a0e into main Nov 24, 2026
2 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 deleted the xaltha/13101-atlas-freshness branch November 24, 2026 05:08
@dezren39

dezren39 commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Merged via merge commit bff8a0e (Batch A of #13903, queue task 21622). Conflict: pkgs/atlas-search/worker/README.md (src/key.ts bullet and new measurement.ts bullet on main vs freshness.ts bullet on PR). Resolved keep-both: main's key/measurement bullets kept, freshness bullet appended. Tests: worker vitest run → 11 files, 112 tests passed; tsc --noEmit clean.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dezren39
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.