feat(identity): persist dual-proof write after inspect - #192
feat(identity): persist dual-proof write after inspect#192cursor[bot] wants to merge 20 commits into
Conversation
A buyer who links an anonymous assessment to a Keyverse account must still see that link after process restart. Persist assessment_participant plus append-only link and link-end evidence, reload through the domain lifecycle, and fail closed on conflicting replay or a subject already bound to another participant. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Keep TRACEABILITY, ADR-0020, ERD, and as-built schema pointing at the opened persist/reload vehicle instead of an unnamed Active PR. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Apply each identity link and then its matching ends in one transaction so a complete in-memory unlink+relink aggregate survives restart. Cover one-shot persist, exact replay, and subject reuse after unlink. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Add a tenant-scoped current-subject lookup so a returning Keyverse login can find the same product-owned participant after the anonymous session token is gone. Ended or replaced subjects stay unfindable until they are current again. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Remove the accidentally committed build tree and ignore /target so later local verification cannot leak compiler outputs into the identity-link successor. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
A missing current_participant_identity_link row no longer hides a returning Keyverse login or lets another participant bind the same issuer-scoped subject. Lookup and uniqueness now read append-only link rows that have no matching end. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Name the Active PR vehicle as the successor of #124 so TRACEABILITY, ADR-0020, and the as-built schema do not treat projection-only lookup as the landing contract. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Exact replay of the same identity-link history now reconciles the derived current projection so operator repair cannot hide a returning login behind a missing unique enforcer or leave a stale row after unlink. Name Active PR #133 in TRACEABILITY instead of superseded #124. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
After dump restore the unique enforcer can be missing or stale even though unterminated history is intact. Rebuild every current row from that history, fail closed on two unterminated holders of the same subject, and prefer this successor over #147. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Keep TRACEABILITY, ADR-0020, ERD, and as-built schema pointing at the opened restore-reconcile vehicle instead of an unnamed successor of #147. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Add a read-only inspect so operators can see missing or stale unique-enforcer rows after dump restore, fail closed on two unterminated links for one participant, and run reconcile only when that inspect reports drift. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Fold the #173 buyer path onto the #169 inspect line: a stale current row for an ended Keyverse subject must keep that account occupied until inspect reports drift and restore reconcile rebuilds the unique enforcer. After that path, a later participant can bind the freed subject. Lock ADR-0020 Implementation status to the TRACEABILITY landing PR. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Hosted adapters authorize both current proofs only after restore inspect is clean, persist the append-only history, and recover the same participant from a later valid account. Prefer this write-path head over #160. Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
There was a problem hiding this comment.
Review of #192 (b8f43a8)
Prefer this inspect-then-write head over #183, #178, #166, and #160. Do not merge those predecessors.
What holds
persist_authorized_account_linkinspects current-projection drift before dual-proof authorization, so a stale unique enforcer cannot accept a new first-link and the in-memory participant stays unlinked on refuse.- Recover still resolves from unterminated history while inspect reports drift. That is the intended returning-login path, not a missing inspect gate.
- Realistic PostgreSQL coverage includes restart recover, expired/unused proofs, subject-already-bound, and
restore_drift_refuses_dual_proof_write_until_operator_reconciles. - HTTP and live Keyverse verification stay out of this slice.
Merge gates that are still open
- Draft.
- Required checks were still queued at review time; queued is not acceptance.
- Independent last-push approval is still required. Do not self-approve.
Buyer gap this head does not close
A returning account can recover after restart, but cannot disconnect. The authorized unlink successor on cursor/bc-08d3bd7b-4151-4d01-992f-2afd21638d37-6992 adds that command. Prefer that successor once it is opened; keep #192 unmerged as a predecessor.
Sent by Cursor Automation: Fix Issues
|
Closing as superseded by PR #202. #202 explicitly carries this inspect → dual-proof persist/recover path and adds the missing buyer lifecycle operation: an authorized unlink that appends the link end, clears returning-account recovery, and permits later relink without rewriting historical participant identity. Its current scope says to prefer #202 over #192 and not merge #192 separately. Continue exact-head review on #202 or its later successor. |


Why
PR #178 inspects projection drift and reconciles the unique enforcer after restore. A hosted adapter still had no command that refuses a new dual-proof write while that inspect reports drift, then authorizes both current proofs, persists the history, and recovers the same product-owned participant from a later valid Keyverse account.
TDD
RED
restore_drift_refuses_dual_proof_write_until_operator_reconcilesplants a stale current row for endedkeyverse_subject_write, provespersist_authorized_account_linkreturnsCurrentProjectionDriftwithout mutating the in-memory participant, then after reconcile the laterparticipant_identity_write_epsilonbinds and recovers. GREEN inspects first, authorizes both proofs, persists, and recovers.Scope
Out of scope
Operator next action
After restore, run
inspect_identity_link_current_projection_drift. If it reports drift, runreconcile_identity_link_current_projectionsbefore callingpersist_authorized_account_link. Prefer this head over #178 and #160. Do not merge those. Do not merge this PR until exact-head checks and independent last-push approval are satisfied. Never self-approve.