Repository navigation
test: race the ProceedUnlocked registry test-and-set (#330) - #338
Merged
Merged
Conversation
Extract the OPEN_PATHS atomic test-and-set out of open_with into claim_unlocked_path so it can be raced with real threads instead of requiring a genuinely lock-incapable filesystem, which no CI runner can provide. Add a test that spawns 16 threads claiming the same path and asserts exactly one is admitted. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Summary
OPEN_PATHSatomic test-and-set out ofopen_with'sProceedUnlockedarm intoclaim_unlocked_path, a pure refactor with no behavior change.test_claim_unlocked_path_race_admits_only_one, which spawns 16 threads racing to claim the same path and asserts exactly one is admitted.This closes the gap called out in #330: the two-step check-then-insert bug (fixed in #317/#304's final review) was previously guaranteed only by code inspection, since the real trigger path requires a genuinely lock-incapable filesystem that no CI runner can provide. Extracting the registry interaction into its own function lets the race be exercised directly with real threads instead.
Verified the new test actually catches the regression: temporarily reintroduced the two-step (check, then insert) pattern locally and confirmed the test failed (16/16 admitted instead of 1), then reverted to the atomic fix.
Test plan
cargo test --lib storage::backend::file— 16 tests passcargo test(full suite) — 679 unit tests + all integration/doc tests passcargo fmt --check/cargo clippy --libcleanCloses #330
🤖 Generated with Claude Code
https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU