Repository navigation
Conversation
git ls-remote matches its pattern against the end of each ref name, so asking for refs/autoform-claims/k also lists refs such as refs/heads/refs/autoform-claims/k, or the claim of a key ending in /refs/autoform-claims/k. _remote_oid used the first line of that output, so read, holds, acquire, renew and release could act on another ref's commit. _remote_oids already keeps only the exact ref for the batch operations, and _remote_oid now does the same.
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.
Fixes the single-key claim operations reading the wrong ref when another ref's name ends in the same path. 2 files, +22/-3, one commit.
git ls-remote <repo> refs/autoform-claims/klists every ref whose name ends in the pathrefs/autoform-claims/k. That includesrefs/heads/refs/autoform-claims/k, and the claim ref of a key such asa/refs/autoform-claims/k, since claim keys may contain/._remote_oidtook the first line of that output, soread,holds,acquire,renewandreleasecould act on another ref's commit._remote_oids, which serves the batch operations, already keeps only the exact ref (#135)._remote_oidnow does the same.What this changes, checked on main and on this branch with the same scripts:
a/refs/autoform-claims/kmade this worker'sread("k"),holds("k")andacquire("k")raise, whileacquire_many(["k"])succeeded. The error isClaimTransportErrorwith a fresh scratch directory andMalformedLeaseErroronce the peer's commit is local. Afteracquire_many,holds,renewandreleaseonkraised too, so aHeartbeatonkwould setlost. On this branch all of them see onlyrefs/autoform-claims/k.refs/autoform-claims/<key>gone and a branchrefs/heads/refs/autoform-claims/<key>holding this worker's lease,release(key)deleted that branch, becausegit pushexpands the destinationrefs/autoform-claims/<key>to the branch when no exact ref exists. On this branchreleasefinds no claim and returnsTruewithout pushing.How likely: the CLI's own keys come from
author_claim_key, whose slug has no/, so they cannot shadow each other. Reaching either case needs a foreign or oddly named ref in the board repository. Every failure above refuses, by raising or returningFalse, except the branch deletion, which removes a ref other than the claim.The new test,
test_single_key_operations_read_only_the_exact_claim_ref, fails on main withClaimTransportError. Calling_remote_oids([key])from_remote_oidwould also fix the bug, buttest_overlapping_batch_racereplaces_remote_oidswith a two-party barrier, and single-key calls through it deadlock that test.Overlaps with open PRs:
claims.pyandtests/test_claims.pythrough theiropen-statements-revisionbase. Each merges with this branch without a textual conflict.open-statements-revision's history after this branch leaves two byte-identical_remote_oidsdefinitions inclaims.py, and ruff does not flag them. That history already conflicts with main in 21 files. Rebasing Deploy Pages only after autoform verify passes, and refuse a lean: name defined twice #140's and Bind statement: formalized to a recorded statement_hash #141's own commits onto main avoids the duplicate, since those commits do not touchclaims.py.Validation at exact head
32d0fa4a:ruff check autoform_cli servers testsis clean.tests/test_claims.py(101),tests/test_claim_cli.py(10),tests/test_dashboard.py(14) andtests/test_impact.py(73) pass.