Skip to content

test_skip_path_does_not_delete_holders_lock_file reddened main on macos-3.11 — its assertion cannot tell "P2 deleted the lock" from "P1 finished and released it" #312

Closed

Description

@fdaviddpt

What happened

main is red at 5679609 (#311, a docs-only merge — it cannot have caused this). One leg of twelve:

pytest (macos-latest, 3.11)   failure
>       assert lock_dir.is_dir() and lock_file.exists(), (
E       AssertionError: P2's skip-path cleanup deleted the lock entirely — P1 is still running and now unprotected
E       assert (False)
tests/test_save_session_lock_ownership.py:158: AssertionError
============ 1 failed, 1509 passed, 5 skipped in 453.63s (0:07:33) =============

The other eleven legs passed, including windows-latest, 3.11 and macos-latest, 3.10/3.12.

Why the message is not evidence for what it claims

The test builds a three-process race:

  • P1 runs save-session.sh with STUB_EXTRACT_SLEEP=3.0, so it holds save.lock for ~3 seconds.
  • P2 runs the same script, must hit the skip path, and exit.
  • Line 158 then asserts the lock still exists, on the stated grounds that P1 is still running.

Nothing in the test ever establishes that premise. There is no p1.poll() anywhere in tests/ (grep p1.poll tests/ → 0 results). So when P1's 3-second window closes before P2 finishes spawning bash, writing its env fixture and running the skip path, P1 releases the lock correctly, the file disappears correctly, and the assertion fires with a message accusing P2 of a teardown it never performed.

That run took 453s of wall clock for the suite. A 3.0s budget for "spawn a bash subprocess and let it reach a skip branch" is not a safe margin on a loaded macOS runner, and this is the second time a lock-ownership concurrency test has produced a single-leg red that cleared on a re-run.

This is the three-state defect class landing inside our own test suite: an absence produced by timing, rendered as an absence caused by the code under test. A test that cannot distinguish its failure mode from correct behaviour is not pinning the invariant it names — and the honest failure here is not "this is flaky", it is "this run was inconclusive".

What a fix has to do

Not a product bug, on current evidence

save-session.sh only unlinks save.lock when it owns it (b61acfc, #168), acquisition is mkdir-based (#182/#185), and eleven legs agree. Nothing here says user data was at risk. The defect is that the test cannot prove that — in either direction.

Activity

  1. added a commit that references this issue on Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions