Skip to content

feat(result): reload persisted snapshots after restart - #119

Closed
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/bc-1228cee8-be1b-4712-8bf6-03c1a1acd127-a42c
Closed

feat(result): reload persisted snapshots after restart#119
cursor[bot] wants to merge 2 commits into
mainfrom
cursor/bc-1228cee8-be1b-4712-8bf6-03c1a1acd127-a42c

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Why

Protected main already persists immutable result snapshots, but a process restart could not reconstruct the stored provenance and copied observations. A later result-serving worker would have no published snapshot to return, so buyers lose scores after deploy or crash.

This work is superseded by #157 through #137. Exact ancestry was reverified before closure: #137 is two commits ahead of this unchanged head, and #157 is two commits ahead of #137, with neither successor behind its predecessor. #157 carries this reload primitive plus current-session tip selection, contiguous observation-order enforcement, and fail-closed cyclic/all-superseded detection. Do not merge this predecessor.

Supersession evidence

The successor remains Draft and is still subject to unchanged exact-head CI/security/review gates. Closing this PR does not promote successor behavior to protected-main truth.

A published result must survive process restart without calling the
scoring engine again. Reconstruct stored provenance and copied
observations so operators can serve the same snapshot, exact persist
replay stays Duplicate, and gapped or noncanonical evidence fails closed.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@cursor
cursor Bot requested a review from seonghobae August 16, 2026 15:29
Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment

Review of 2350c69 (Draft). No independent last-push review and exact-head CI were still queued at review time. Do not merge #119.

The persist-then-reload primitive is sound: missing header is None, empty observations and noncanonical provenance fail closed, and exact persist replay stays Duplicate. Scope holds: no #97 owner/session binding, no HTTP transport, no psychometric recomputation, no postgres_recovery_invariants.rs edits.

Two holes keep this from being the slice a buyer can use after restart:

  1. TRACEABILITY/CHANGELOG say gapped observation sets fail closed, but load never checks observation_order. The test named result_snapshot_gap deletes every observation row, not a middle gap. Orders 0,2 would rebuild and could be served as the published score.
  2. load_result_snapshot requires a remembered result_snapshot_ref. After deploy or crash the serving path has the assessment session, not that id. Nothing in production calls load.

Successor #137 (feat(result): load current session snapshot after restart) rejects non-contiguous observation_order and adds load_current_result_snapshot_for_session for the unique non-superseded tip. Prefer #137 over this head.

Do not self-approve. Merge only after exact-head Runtime CI, coverage, and an independent last-push review on the preferred head.

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

Comment thread src/postgres_result_snapshot.rs
Comment thread tests/postgres_result_snapshot_persistence.rs
Comment thread docs/TRACEABILITY.md

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer #157 (106a89b) over this head and over #137.

This slice reloads a result only when the worker already remembers result_snapshot_ref, and it accepted gapped observation_order such as 0,2. #137 added session-current tip load and contiguous-order fail-closed. #157 keeps that and fails closed when a supersession cycle leaves no tip, so a restarted worker cannot treat corruption as "no score yet".

Do not merge this head. Do not self-approve #157.

View PR

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

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.

2 participants