Skip to content

test: race the ProceedUnlocked registry test-and-set (#330) - #338

Merged
adityamukho merged 1 commit into
mainfrom
test-330-proceed-unlocked-race
Aug 23, 2026
Merged

adityamukho merged 1 commit into
mainfrom
test-330-proceed-unlocked-race

Conversation

@adityamukho

Copy link
Copy Markdown
Collaborator

Summary

  • Extracts the OPEN_PATHS atomic test-and-set out of open_with's ProceedUnlocked arm into claim_unlocked_path, a pure refactor with no behavior change.
  • Adds 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 pass
  • cargo test (full suite) — 679 unit tests + all integration/doc tests pass
  • cargo fmt --check / cargo clippy --lib clean
  • Confirmed the new test fails when the old two-step race is reintroduced

Closes #330

🤖 Generated with Claude Code

https://claude.ai/code/session_01YMWSutMLJJ7Y5b8hs9ZaCU

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

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/storage/backend/file.rs 75.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit ea84436 into main Aug 23, 2026
17 checks passed
@adityamukho
adityamukho deleted the test-330-proceed-unlocked-race branch August 23, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: pin the ProceedUnlocked registry test-and-set against regression

1 participant