Repository navigation
fix(workflow): reload the store and reap once when a window takes over - #2707
Merged
Merged
Conversation
A second window on one home starts read-only and loads workflows.json once at construction. When the first window dies the second takes state.lock, but its first write put that stale copy back over the records the dead window saved, and its reaper never ran again, so a run the dead window left running held the lane for good. Becoming the writer is now a state change: the first call that finds the host writable after a read-only start re-reads the store once, the way core store.mutate() refreshes before a change, then runs the load-time reaper once on the adopted store. A queued card is not a run, so it is never touched. Every write also refuses if the lock has moved away before the bytes land. Fixes #2704
Collaborator
Author
|
Verdict: PASS at 04ec140 Ran at this tip: Review points, against the tip tree extracted from the tarball (harness packages linked from a local 0.2.1-rc.2 install; a first run without them failed only on
|
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.
Written-by: Dev
Fixes #2704
Owner: Dev
Reviewer: Reviewer
What changed
A window that starts read-only behind another writer now treats taking
state.lockas a state change. The first call that finds the host writable re-readsworkflows.jsononce, then runs the load-time reaper once on that adopted store. That ends the dead window'srunningrun ashost-endedand releases its step Bots;lane.queueis never touched, so a card that was onlyqueuedkeeps its place and starts when the lane drains. A writer that later loses the lock is still refused, andwrite()refuses before its first byte if the host became read-only or this window never took the store over.Red first
test/takeover.test.js(real child processes, realstate.lock, realkill -9) withplugins/workflow/src/service.jsreplaced by the base blob of71855d9d:Ran at this tip:
Not run: whole-repo
npm run verify(the brief limits this to the workflow suite; nocore/file changed, soscripts/ds-bot-patches.mjsandbuild-client.mjs --checkdo not apply).core/scripts/check-arch-docs.mjsneeds a git history this box does not have; the owned pagedocs/subsystems/workflow.mdis updated in the diff.Checkpoint
{
"pr": 2707,
"claim": "Dev",
"issue": 2704,
"summary": "A read-only window that takes the workflow store over re-reads workflows.json before its first change and runs the load-time reaper once. It no longer writes the copy it loaded behind the dead window, and no longer leaves that window's running run holding the lane. Queued cards are untouched and start when the lane drains.",
"files": [
"plugins/workflow/src/service.js",
"plugins/workflow/test/takeover.test.js",
"docs/subsystems/workflow.md",
"changelog.d/2704-workflow-takeover.fixed.md"
],
"checks": {
"ran": "workflow suite + takeover test; scripts/lint-plugins.mjs; .github/scripts/changelog.mjs check",
"result": "green",
"at": "04ec1403b8024cb689f272f98ba9122887c69f80"
},
"next": "none — ready for review"
}