Skip to content

stats: the snapshot reads one snapshot and is exact as of its as_of - #638

Merged
jthingelstad merged 2 commits into
mainfrom
session/stats-snapshot
Oct 21, 2026
Merged

jthingelstad merged 2 commits into
mainfrom
session/stats-snapshot

Conversation

@jthingelstad

Copy link
Copy Markdown
Owner

Codex on #636: under read committed, a migration could commit between the stats refresh's ledger read and its recount. The payload then mixed two instants, under an as_of (the write time) later than both.

  • The refresh now runs every read in one repeatable read read only transaction (refreshInOneSnapshot), and that transaction's instant is the as_of.
  • The payload is the record exactly as it stood at as_of. A migration that lands during the refresh is invisible to it, ledger and deletion alike, and the next refresh counts in full.
  • The write comes after the read transaction and never replaces a newer stored snapshot with an older one.
  • Tests: a receipt-deleting migration commits from a second connection right after the ledger read. The payload must equal the record before it, as_of must come before the commit, and the next refresh must count in full. The test fails under read committed.
  • A second test pins that an older snapshot never replaces a newer one.

No migration, contract or JSON API change. No acceptance family: no tool reads the snapshot.

🤖 Generated with Claude Code

Otto Thing and others added 2 commits October 21, 2026 02:46
Under read committed a migration could commit between the refresh's
ledger read and its recount, so the payload mixed two instants under an
as_of later than both (Codex on #636). The refresh now reads in one
repeatable read, read only transaction whose instant is the as_of; a
migration during it is seen whole by the next refresh. The write never
replaces a newer snapshot with an older one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jthingelstad
jthingelstad marked this pull request as ready for review October 21, 2026 07:47
@jthingelstad
jthingelstad enabled auto-merge (rebase) October 21, 2026 07:47
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-21T07:47:16.988539Z 224b430 Draft marked ready
ℹ️ 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.

@jthingelstad
jthingelstad merged commit 4ac831a into main Oct 21, 2026
7 checks passed
@jthingelstad
jthingelstad deleted the session/stats-snapshot branch October 21, 2026 07:49
@jthingelstad

Copy link
Copy Markdown
Owner Author

Deployed to production 2026-10-21T07:52:47Z (2026-10-21 02:52:47 CDT).

  • Commit: 4ac831af (platform lane); this PR's: b6b4905f, 4ac831af
  • MCP contract: 11.13.3
  • JSON API: 3.2.1
  • Acceptance: not run
  • Timing: started 2026-10-21T07:50:32Z (2026-10-21 02:50:32 CDT); the CI gate waited 2 s, then 2 m 14 s to this record: build 4 s, assets 19 s, migrate-push 7 s, stack 1 m 5 s, grants 2 s, public-stats 5 s, card-art 1 s, site 23 s, smoke 4 s

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant