test: bound fs-lock contender cleanup
Summary
Post-merge follow-up to #235 after independent review found that its timeout branch still performed an unbounded worker join.
This tightens the test lifecycle without changing production locking:
- wait for an explicit contender-start handshake before beginning the result watchdog
- distinguish worker disconnection from a real result timeout
- keep the owner live throughout the bounded result window
- after timeout, drop the owner only for cleanup and use a second bounded wait; a persistently stuck worker is detached instead of hanging the test process
- tolerate sender teardown on timeout paths
Verification
cargo +1.93.0 fmt --all -- --checkcargo +1.93.0 test -p agent-file-tools --lib fs_lock::tests— 21 passed- focused test repeated 100 times with a 20-second outer process timeout — 100 passed
The commit is SSH-signed and based on current main at 24744afe.
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Bounds fs-lock test cleanup to avoid unbounded joins when a contender blocks. The old test could hang on timeout; the new test uses handshakes and bounded waits without changing production lock behavior.
- Adds a contender-start handshake (5s) before the watchdog and a bounded result wait (2s); distinguishes disconnection from timeout with clear panics.
- On timeout, keeps the owner live during the wait, then drops it only for cleanup, performs one more bounded wait (1s), and does not join a stuck worker to prevent hanging the test process.
Greptile Summary
This PR bounds cleanup in the filesystem-lock contention test so a stuck worker cannot hang the test process.
- Adds an explicit handshake before starting the result timeout.
- Distinguishes worker disconnection from timeout.
- Releases the owner only during cleanup and bounds the second wait before detaching a persistently stuck worker.
Confidence Score: 5/5
The PR appears safe to merge because the changed test cleanup is bounded and does not alter production lock behavior.
The contender-start handshake preserves the intended live-owner test window, disconnection is handled separately, and both timeout waits are bounded so the regression test cannot hang indefinitely during worker cleanup.
Important Files Changed
| Filename | Overview |
|---|---|
| crates/aft/src/fs_lock.rs | Tightens test-only thread synchronization and timeout cleanup without changing production locking behavior; no actionable defect was identified. |
Reviews (1): Last reviewed commit: "test: bound fs-lock contender cleanup" | Re-trigger Greptile