Skip to content

feat(api): run-to-snapshot identity and explicit snapshot reads (#1229) - #1236

Merged
athvin merged 5 commits into
mainfrom
issue/1229-run-snapshot
Nov 25, 2026
Merged

athvin merged 5 commits into
mainfrom
issue/1229-run-snapshot

Conversation

@athvin

@athvin athvin commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Closes #1229

🚧 Claimed by an agent session — 2026-11-25T11:16:22Z, session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 on brians-MacBook-Pro.
The claim is this open draft PR: closing it releases the claim.

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

"Read the results of run R" is now expressible and exact.

  • The run records its snapshot. finish stamps runs.snapshot_end with the lake's latest snapshot, read just before the finish update commits. Every stage commits on its own, so that is the snapshot holding the run's results. RunItem serves it as snapshot.
  • Result list reads accept snapshot=. golden-records (local and remote lake paths) and duplicates accept it. A snapshot newer than the latest, or one contradicting the cursor, is a 422. One expired by retention is a 410. Neither is ever a read of a different snapshot. The rules are in read::pin_requested, which is pure.
  • Session::snapshot_bounds (dedupe-core) and its remote twin give (oldest, latest) retained.

Why

#1229, part of #521. A newer run moving the lake between a job.succeeded and the customer's first read used to change what they read.

Proof

make check: 1,182 passed, 0 failed. er-server + er-cli --tests against Postgres with DEDUPE_E2E_DUCKLAKE=1: 491 passed. make frontend: 963 passed, 1 failed: run-cost.spec.ts on mobile-safari, an element-not-found timeout. This diff's frontend changes are only the generated API files, which nothing on that page imports, so it is not this change. The PR's required Playwright tier is the judge.

  • run_snapshot_read.rs (real lake, DEDUPE_E2E_DUCKLAKE): two full runs, where R+1 adds one company. It asserts:
    • R's recorded snapshot is exactly the one before finish's own commit;
    • R precedes R+1;
    • golden is 4 at R and 5 at latest, with 3 duplicate groups at R;
    • after expire_snapshots, requesting R is Expired.
  • pin_requested_tests (4): pass-through, exact read at a retained snapshot, expired and future refused, and a cursor that must agree and triggers no catalog read.
Mutation Result
M1: finish stamps latest - 3 survived the first version of the test: golden and duplicate reads are identical a few snapshots earlier, because the last writes are reviews and metrics. Fixed by asserting the exact snapshot (r == after_r - 1); now fails.
M2: the expiry branch disabled fails (Expired expected)

Risk & rollback

finish gains one catalog read before its update. Runs finished before this have snapshot: null, and that is documented. Rollback: git revert <merge-sha>; the column stays and simply stops being written.

Post-merge ledger

Closed by: agent · session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 on Mac · 2026-11-25T18:32:45Z

  • main is green with this change on it: merge 432d337e. Push runs rust 45609751372, frontend 45609751571, images 45609751497, infra 45609751387, devcontainer 45609751379, marketing preview 45609751278: all success.
  • images: run 45609751497 succeeded.
  • deploy converged. Process proof was read once the AWS session was restored (2026-11-26). The live colour in dev (ci/web-api-green-5d5f9c8844-88dxb, logged "er-server listening" at 01:36:40Z) and prod (app/web-api-blue-7544598cbb-8rjth, at 01:51:39Z) both run er-api@sha256:5d993716…, built from bae09b2e, which contains this merge (git merge-base --is-ancestor 432d337e bae09b2e holds). (Earlier note: the latest deploy (DEPLOY_SHA: 432d337e, 12:05Z) succeeded; the deploy workflow succeeded, but the AWS SSO session (er-platform / er-prodadmin) expired at 12:10Z before the live pods' logs could be read. A workflow conclusion is not process proof. To be ticked after aws sso login.)
  • the push-only surface: deploy is green. drift and kind were already red on schedule before feat(api): typed response structs, batch 3 — reviews+merges (#1193) #1202.
  • the board card: E11.2 — Run-to-snapshot identity, explicit snapshot reads #1229 was closed by feat(api): run-to-snapshot identity and explicit snapshot reads (#1229) #1236 through the merge automation.
  • follow-ups: none for this child. E11.3 — Bulk export: async artifact with expiry, tenant-scoped #1230–E11.6 — Results edge matrix, and #896 #1233 continue E11.
  • what was learned is written down: in the PR body's Discoveries (runs.snapshot_* were declared and never written) and the commit message. The first test version passing a wrong snapshot is the mutation-test-the-scenario-too lesson again.

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

  • The ticket's probe said the run had no snapshot. In fact runs already declared snapshot_start / snapshot_end, but nothing ever wrote them, so both were always NULL. snapshot_start stays unwritten. Nothing needs it, and a value no reader uses is a value nobody checks.
  • run_stages.snapshot_end exists too, but run_stages has no writer (see the observability skill on stage_record_line), so it could not stand in.

Measurements

Files

bmoore813 and others added 5 commits November 25, 2026 03:43
…1229)

finish stamps runs.snapshot_end with the lake's latest snapshot, read just
before the update commits; RunItem serves it as snapshot. Nothing wrote
snapshot_end before, so the column was always NULL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…y when gone (#1229)

golden-records and duplicates accept snapshot=. A snapshot past the latest
or contradicting the cursor is a 422; one expired by retention is a 410,
never a read of a different snapshot (pin_requested, pure and unit-tested).
run_snapshot_read.rs reads run R's results after run R+1 over a real lake.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

The marketing preview was removed because this PR is closed or merged.

@athvin
athvin marked this pull request as ready for review November 25, 2026 12:00
@athvin
athvin merged commit 432d337 into main Nov 25, 2026
51 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 25, 2026 12:01 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
marketing-preview — 5622eb9c Deployed Nov 25, 2026 by athvin via remove closed PR previews #55
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.

E11.2 — Run-to-snapshot identity, explicit snapshot reads

2 participants