Repository navigation
fix(mission): honor compare-and-swap loss on recovery failure and cancellation writes - #230
Open
jimmyallinai wants to merge 1 commit into
Open
jimmyallinai wants to merge 1 commit into
jimmyallinai wants to merge 1 commit into
Conversation
Author
|
Hi — checking in on this PR, it has been open for a week. I re-verified just now: it is still mergeable with no conflicts, and this repo has no CI configured so there are no failing checks on my side. Happy to adjust the CAS-guard approach or the test coverage if you would like anything changed. |
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.
Issue for this PR
Fixes #229
Type of change
What does this PR do?
MissionRecoveryCoordinator.recover()checked the compare-and-swap result on the claim, crash-block, and completion writes, but ignored it on two later writes:recover()still returnedrecovered/blockedwith a snapshot showing the action asfailed/blocked— a transition that was never persisted. The store still held the action asin_progressfrom the claim, so the next recovery would report it asambiguous-after-crash, contradicting the outcome just returned.outcome: 'cancelled'with a cancelled-state snapshot the store never accepted.Both paths now honor a lost CAS exactly like the completion path already does: return
{ outcome: 'concurrent' }with no fabricated snapshot.executedcarries the action id on the failure path (the executor did run, and its side effect may have happened) and stays empty on the cancellation path (it never ran). This restores the invariant indocs/MISSION_RECOVERY.mdthat a writer which loses the revision comparison reportsconcurrentinstead of asserting state it does not hold.The change is two one-line guards in
src/mission/recovery.ts; no outcome values, schemas, or store semantics change.How did you verify your code works?
outcome: 'recovered'with the action reportedfailedwhile the store still showedin_progress; an abort landing after the claim producedoutcome: 'cancelled'while the store still showedin_progress. After the fix both returnoutcome: 'concurrent'and the stored state is untouched by the losing write.src/__tests__/mission-recovery.test.tscover both paths: on the base commit they fail (2 failed / 8 passed in that file), with the fix the full suite passes —vitest run src: 990 passed, 0 failed.tsc --noEmitclean; eslint on the changed files reports no problems.