test(sel): stabilize cross-process lock tests - #6855
Conversation
Assert loop-side lock behavior from primitive calls instead of wall time, so a loaded runner cannot fail a correct single-shot attempt. Fail immediately if the event-loop path reaches a blocking primitive. Use the existing symlink capability probe for the symlink-specific guard so unprivileged Windows hosts skip while capable runners retain coverage.
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Replaces a flaky wall-clock proxy with structural assertions on the actual lock contract — exactly the shape-not-duration fix the repo's own testing conventions mandate. The sleep gap left by dropping the timing bound is already covered by the adjacent source-level [DESIGN-REVIEWED] b0cb80d |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
NicholasRBowers
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: test (1 file). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: test-files-only change to test/test_sel.py replacing wall-clock timing assertions with structural lock-primitive assertions and gating a symlink test behind requires_symlinks.
Problem / Motivation
Two cross-process SEL tests were nondeterministic on Windows:
Why it matters
These tests can reject unrelated PRs even when production lock behavior is correct. Raising the timeout or rerunning the shard would preserve the false signal. The tests should directly prove the lock contract and explicitly model platform capability.
What changed
try_acquire_lockand require exactly one exclusive, nonblocking attempt.acquire_lockandfile_lockprimitives with fail-fast sentinels for this path.requires_symlinkscapability marker to the symlink-specific security case. Capable CI still runs it; incapable hosts skip explicitly.Production SEL code is unchanged.
Tests
TestCrossProcessSafety: 17 passed, 1 capability skip.test/test_sel.py: 231 passed, 26 capability skips.polled 2 times.No retry, rerun, sleep, timeout increase, threshold relaxation, or warning filter is used.
Manual verification
N/A — the test now proves calls to the actual lock primitives under real contention; mutation checks prove the assertions reject both blocking and polling implementations.
Screenshots / video
Why no screenshot: This changes only backend tests and has no rendered UI effect.
Merge order
Merge #6849 first. It fixes the separate Windows text-mode legacy lock-key flake in the same SEL test area. This PR is test-only and should then merge before replaying the much larger conflicting #4997.