Repository navigation
test(issue-radar): seed the crew fabric route tests off the event loop - #16103
jeeshofone wants to merge 1 commit into
Conversation
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 399905e Description read[DESCRIPTION-READ] fb82bd3850cd493ce0ee5afb432f0ba537152da2cfb9042294fe07cdd647f966 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5 Review (fork) — ✅ no blocking findingsReviewed Review detailsNothing blocks — but the new contention test can pass without ever contending, and its prose names the wrong route and the wrong failure. FINDING — test/test_issue_radar_crew_fabric.py:615 — FINDING — test/test_issue_radar_crew_fabric.py:502 — the helper's rationale says FINDING — test/test_issue_radar_crew_fabric.py:601 — the comment claims the on-loop variant "raised CrewLedgerNotRecorded", but the holder owns the lock before the write starts, so [OPUS-REVIEWED] 399905e |
RouteTest seeded the crew ledger by calling commit_work_progress on the event-loop thread, where file_lock makes one attempt. When the crew log writer still held the unit lock, the read-back failed and the write raised CrewLedgerNotRecorded. The write route runs the same call through asyncio.to_thread, so the tests now do too, and a regression holds the unit lock briefly from another thread while seeding. Closes kirodotdev#16093
355046d to
399905e
Compare
|
Disposition for head #16102 (merged 2 Oct 15:07 UTC) fixes the whole class this PR was opened for, not only the seed path here:
Checked locally: this branch rebases cleanly onto current main, but its diff is then redundant. On current main, The other reds on this head come from main or predate the rebase:
No new head will be pushed. |
Problem / Motivation
Goal: Stop
test_issue_radar_crew_fabric.py::RouteTestfailing on Windows CI when the crew log writer still holds a unit's lock while the test seeds the ledger.RouteTest::test_populated_repo_returns_folded_itemsfailed on an unrelated fork PR's Windows shard withCrewLedgerNotRecorded. Its captured log shows the read-back increw_store._landed_sincerefused twice withcould not acquire exclusive file lock: still held after waiting 0.00s (one attempt: an acquire on the event-loop thread never waits ...).Why it matters
The flake turns unrelated PRs red on
Backend Tests (Windows)and fails Coverage Gate and PR Readiness closed with them. The product code is correct, so every such red costs a contributor a re-push for nothing.Not a goal
crew_store._append,_landed_sinceorplatform_lock_compat.file_lock. The write route already runs off-loop, so the one-attempt rule never meets this read-back in production.test_issue_radar_crew_routes.py,test_issue_radar_crew_runtime.py,test_issue_radar_pipeline_routes.py) have no async test that callscommit_work_progressorrecord_crew_checkpointdirectly.What changed (motivation → approach → change)
The two async
RouteTesttests seeded the ledger by calling_step(socommit_work_progress) synchronously on the event-loop thread. On that threadfile_lockgives up after one attempt. Right afterflush()reports drained, the crew log writer thread can still hold the unit's lock, so the read-back loses and_appendraisesCrewLedgerNotRecorded. A loaded Windows runner widens that window.POST /crew/workreachescommit_work_progressthroughroutes._st, which isasyncio.to_thread.GET /crew/fabricrunsfold_fabricthroughasyncio.to_threadtoo. So the fix belongs in the test: a new_seed_stephelper runs_stepthroughasyncio.to_thread, the same way the route does, and both tests use it.A new regression,
test_seeding_survives_a_briefly_held_unit_lock, holds the unit's crew log lock from another thread for 0.3s while it seeds. It then checks that the write came back durable and the route serves the item.Backwards compatibility
Compatible: test-only change; no product code, config or contract is touched.
Tests
test_seeding_survives_a_briefly_held_unit_lock(new): seeding while another thread holds the unit lock records a durable entry, andGET /crew/fabricreturns it. With_seed_stepreverted to an on-loop_stepcall it fails with the CIOSError(still held after waiting 0.00s).test_populated_repo_returns_folded_itemsandtest_non_github_provider_answers_200_emptynow seed through_seed_step; assertions unchanged.test/test_issue_radar_crew_fabric.py(28 passed),RouteTestthree times (6 passed each), andtest/test_sync_io_in_async_gate.py(93 passed). isort, flake8, black (file-level andscripts/check_black_formatting.py) clean. mypy reports one existing error at the_registeredhelper (r.resourcemay beNone), which is also on origin/main.Manual verification
N/A — unit coverage sufficient: the change is test-only and the regression reproduces the CI failure deterministically.
Related Issues
Closes #16093
Pattern harvest
Not generalizable: the defect is this test driving a sync store write on the event loop that its route always runs off-loop;
test_sync_io_in_async_gate.pyalready guards the product side.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)