Summary
tests/test_plugin_version_bump.py exhibits a non-deterministic, order-dependent failure of its 4 version-consistency tests (test_plugin_json_version, test_marketplace_json_version, test_root_readme_version, test_pact_plugin_readme_version) — observed failing ~1 in 4 full-suite runs (python -m pytest tests/), always passing in isolation and at a clean HEAD.
Mechanism (partial)
These 4 tests resolve paths via REPO_ROOT = Path(__file__).resolve()..., which is CWD-sensitive when __file__ is relative (as under python -m pytest tests/). A test that leaks a changed CWD (e.g. a raw os.chdir() not restored on an assertion-raise) would cause a later __file__.resolve() to resolve against the wrong root → stale plugin.json read → these 4 assertions fail.
Investigation so far (during PR #1006 review remediation)
- Grepped all raw
os.chdir across tests/ → exactly one file uses it (test_working_memory_worktree_sync.py, 22 sites, 0 monkeypatch.chdir).
- Audited all enter-sites → every restore is inside a
finally block → assertion-safe → this file is NOT the leaker (initial suspicion falsified).
- Ran the full suite 5× back-to-back (8 total in-session) → zero recurrence; could not reproduce to bisect.
Recommended next step
A dedicated repro harness is needed to find the true leaker: a pytest-randomly seed sweep + a per-test autouse fixture asserting CWD is unchanged after each test. Non-trivial; deferred from PR #1006 (pre-existing, unrelated to #962).
Summary
tests/test_plugin_version_bump.pyexhibits a non-deterministic, order-dependent failure of its 4 version-consistency tests (test_plugin_json_version,test_marketplace_json_version,test_root_readme_version,test_pact_plugin_readme_version) — observed failing ~1 in 4 full-suite runs (python -m pytest tests/), always passing in isolation and at a clean HEAD.Mechanism (partial)
These 4 tests resolve paths via
REPO_ROOT = Path(__file__).resolve()..., which is CWD-sensitive when__file__is relative (as underpython -m pytest tests/). A test that leaks a changed CWD (e.g. a rawos.chdir()not restored on an assertion-raise) would cause a later__file__.resolve()to resolve against the wrong root → staleplugin.jsonread → these 4 assertions fail.Investigation so far (during PR #1006 review remediation)
os.chdiracrosstests/→ exactly one file uses it (test_working_memory_worktree_sync.py, 22 sites, 0monkeypatch.chdir).finallyblock → assertion-safe → this file is NOT the leaker (initial suspicion falsified).Recommended next step
A dedicated repro harness is needed to find the true leaker: a
pytest-randomlyseed sweep + a per-test autouse fixture asserting CWD is unchanged after each test. Non-trivial; deferred from PR #1006 (pre-existing, unrelated to #962).