Repository navigation
Ignore main's context in the review-gate diff id; fix the round-lock race (work-system 1.28.1) - #91
Merged
Conversation
gering
force-pushed
the
task/harden-mandate-diff-id-and-round-lock
branch
2 times, most recently
from
October 22, 2026 21:20
079af77 to
1119bf9
Compare
A -U3 diff carries three of main's lines around every lane hunk, so a rebase over main edits next to a lane hunk flipped covered to no (#89). - lane_diff_id hashes a -U0 diff: the lane's +/- lines, their file, hunk order and git's function context as the place; line numbers stay out - inter-hunk context and the indent heuristic are pinned - reviews recorded by 1.28 (context) and 1.23-1.27 (legacy) still match their unchanged lane via lane_compat_ids; delta keeps showing context - tests recompute the old ids from the old algorithms Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BJZ4tA8d432yqatzZMJqFw
acquire_round_lock told "cannot create" from contention by checking for the lock after a failed mkdir, but the holder can release it in between, so a concurrent booking exited 4 (CI flake on #86; 16 of 72 stressed runs locally). - decide from mkdir's own error: "File exists" is contention, anything else exits 4 at once - write the pid aside and rename it in, so lock_is_stale never reads a partial pid - deterministic test via a mkdir shim that fails once with "File exists" Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BJZ4tA8d432yqatzZMJqFw
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BJZ4tA8d432yqatzZMJqFw
gering
force-pushed
the
task/harden-mandate-diff-id-and-round-lock
branch
from
October 23, 2026 14:55
1119bf9 to
22d295e
Compare
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.
Two fixes in
plugins/work-system/scripts/mandate.sh.1. A rebase over main's neighbouring lines keeps coverage
On #89, a rebase flipped
coveredtono(changed-since-review) although the lane's own lines were unchanged.lane_diff_idhashed a-U3diff, whose three context lines per hunk come from main.-U0diff (measured:-U0alone is enough; stripping context after-U3would keep-U3's hunk merging). A hunk's place is its file, its order among the file's hunks, and git's function-context line. Line numbers are not part of it, because any main insertion above would shift them.no: a lane line that changes, or that moves under another header or past another lane hunk. A main edit to the hunk's function-context line still fails closed.diff_id_form=context, masked-U3) or earlier (legacy) still match their unchanged lane, with the old argv, so this also holds under a non-default diff config. The tests recompute both old ids from the old algorithms.deltastill shows context;diff_form=maskedis nowcontext-free.2.
acquire_round_lockTOCTOU (CI flake, rc=4)After a failed
mkdir, the lock code tested[ ! -d "$lock" ]to tell "cannot create" from contention. The holder can release the lock in between, so a concurrent booking exited 4. Reproduced under parallel load: 16 of 72 runs failed.mkdir's own error (File exists= contention). The fix passed 168 runs under load with 0 failures.lock_is_stalenever reads a partial pid. A young lock without a pid is never stale, which covers themkdir-to-pid gap.mkdirshim that fails once with "File exists" and leaves no lock behind.Review
Local
/swarm:review(Claude + gpt-6.1-sol + grok-4.7; 2 grok clusters timed out): 11 findings. Agreed fixes are applied and recorded (covered=yes via=agreed-fixes). Not changed:/sessionsfixes.Checks
test_mandate.py: all tests passscripts/check-structure.py: OK (pre-existing pr-flow/opendescription warning)work-system 1.28.0 → 1.28.1 (patch).
🤖 Generated with Claude Code
https://claude.ai/code/session_01BJZ4tA8d432yqatzZMJqFw