Repository navigation
fix(ui-react): preserve newer principal outcome after cancellation - #4046
Merged
Merged
Conversation
Owner
Author
|
Collisions at head |
This was referenced Nov 15, 2026
Merged
Merged
schlessera
marked this pull request as ready for review
November 16, 2026 05:03
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3093
What changed
Cancellation now revalidates the captured queue entry after its storage deletion succeeds or fails. When a reconnect under a different principal has already signed the entry out and forgotten it, the late cancellation continuation stops there. The newer Signed out outcome stays, and the forgotten entry can no longer send a stale
ask_answer_statusquery, install a cancelled receipt entry or re-settle itself through the failed-delete replay. Normal cancellation, deletion-failure recovery, Edit, accepted-receipt handling and logout/disposal semantics are unchanged. Includes a patch changeset for@schlessera/brain-ui-react.Resumes the approach of the earlier draft #3116 (its single commit cherry-picked onto current main), which this PR supersedes.
Why this shape
Takeover already uses entry identity (
entries.get(id) === entry) as its authority check. A principal change settles and forgets an entry without advancing the lifecycle epoch, so the existingdisposed || epochchecks cannot see it. Adding the same narrow identity check to both cancellation continuations covers this case. We did not add terminal-state ranking, tombstones, a queue policy change or a protocol change: the issue rules all of them out of scope.This is a stale-continuation check that drops an obsolete continuation. It is not a fail-closed guard that restricts anything, so the proportionate-containment checklist does not apply.
Proof
Base
origin/mainate1ce188d7; head8c294206f.packages/ui-react/tests/answer-delivery.test.ts, covering deletion success and failure across a same-principal and a different-principal reconnect. Each one holds the first deletion, connects, releases the deletion and joins the actualcancel()promise.manager.tsfromorigin/main, new tests): 69 pass / 2 fail. Both different-principal cases fail atexpect(h.delivery()).toBe(connectedDelivery)(line 476).success: … different principal connectionat line 476. Restored.failure: … different principal connectionat line 476. Restored.bun run test packages/ui-react/tests/answer-delivery.test.tsgives 71 pass / 0 fail, 351 expect() calls, exit 0.bun scripts/collisions.ts --json --paths <manager.ts, answer-delivery.test.ts>before claiming showed a path collision only with the superseded fix(ui-react): preserve newer principal outcome after cancellation #3116. Every other report was closure-only. The--prresult is recorded in a comment below.bun run check:pr --base origin/main # exit 0: lint/leakage, env docs, changesets, 456 affected fast tests pass{"version":1,"kind":"brain-check-pr-receipt","head":"8c294206f883e04de11e308d1954dbf0c3a8e59d","base":"origin/main","mode":"focused","startedAt":"2026-11-15T20:52:18.647Z","finishedAt":"2026-11-15T20:53:13.693Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":19559.210956999996},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":209.5568179999973},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":118.37302500000078},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":20.17562600000383},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":35119.137887000004}]}Checklist
docs/reflect the change, or nothing documented moved.Anything left open
Nothing beyond hosted candidate confirmation and merge.
🤖 Generated with Claude Code