feat(result): load current session snapshot after restart - #137
cursor[bot] wants to merge 4 commits into
Conversation
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>
Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Reject gapped observation_order on reload and return the unique non-superseded published tip for the session a participant is viewing. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
There was a problem hiding this comment.
Prefer successor #157 (ecaec01) over this head.
load_current_result_snapshot_for_session returns Ok(None) when the tip query is empty. Persist can store A superseding B and B superseding A (no supersedes_ref FK). Both refs then appear in the NOT IN set, so the query returns no rows. A restarted worker that treats None as "score now" invents a result.
#157 fails closed when the session has snapshot rows but no unique tip. Two independent tips, gapped observation_order, and exact persist replay stay as in this slice.
Do not merge this head. Do not self-approve #157. Next buyer gap after #157: durable load_response_snapshot / session-current equivalent so a restarted scoring worker can reconstruct the frozen response prefix.
Sent by Cursor Automation: Fix Issues
| &[&session_ref], | ||
| )?; | ||
| match tips.len() { | ||
| 0 => Ok(None), |
There was a problem hiding this comment.
Empty tip set is not the same as "no result yet".
A persist-created A↔B supersession cycle makes every result_snapshot_ref appear in the NOT IN set, so this arm returns None. A worker that scores on absent will invent a published result.
Fail closed when EXISTS a same-session row and tip count is 0. Successor #157 does that.


Why
This slice extended persisted result reload with current-session tip lookup and contiguous observation-order validation.
It is superseded by #157. Exact ancestry was reverified before closure: #157 is two commits ahead of this unchanged head and behind by 0. #157 carries this entire slice and additionally fails closed when a session has result rows but no unique non-superseded tip (cyclic/all-superseded evidence). Do not merge this predecessor.
Supersession evidence
aef54c9c81c90cdb842c3c9d7a04117b2e1648b5106a89b7c24c91ad596c3899803857ab707d2e8eaheadby 2 commits, behind by 0.#157 remains Draft and subject to unchanged exact-head CI/security/review gates. Closing this PR does not promote successor behavior to protected-main truth.