Add comprehensive race condition & state conflict xfail test suite #627
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
tests/test_race_conditions.pywith 17 tests (15 xfail, 2 passing) documenting every discoverable state conflict in libtmuxCategories
Category 1 — Create-query races (6 xfail): Two-step "create → query" pattern fails when state changes between the tmux command and the follow-up list query.
Category 2 — Object staleness after external mutation (3 xfail, 1 pass): Cached Python objects become invalid after the underlying tmux object is killed externally. Includes killed session/window/pane access patterns.
Category 3 — DX frustrations (3 xfail, 1 pass): Natural API usage patterns that produce confusing or silent failures — dead server
sessionsreturning[], inconsistent error handling betweensessions/windows/panesproperties.Category 4 — Query/filter edge cases (2 xfail):
QueryList.filter()with typo field names silently returns empty lists;fetch_objby mutable keys fails after renames.Category 5 — ID recycling after server restart (1 xfail): Stale Python refs with recycled
$0IDs silently match wrong objects after server restart.Test plan
uv run pytest tests/test_race_conditions.py -v— 2 passed, 15 xfaileduv run ruff check tests/test_race_conditions.py— no errorsuv run mypy tests/test_race_conditions.py— no errorsuv run pytest— full suite passes (874 passed, 1 skipped, 15 xfailed)