Repository navigation
test: wait for the retired lane to release its unit before the rebuilt writer's flush - #32813
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the test now waits for the hold to be released, the actual precondition of the next flush, rather than an earlier side effect. Product code is unchanged. [DESIGN-REVIEWED] 2f59935 Description read[DESCRIPTION-READ] d645d7102cef98d9f3a5a23dc7460459f1c263e1aea5118a5f9ce27839685571 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 |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 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: |
Opus 5.5 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: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: test (1 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: test-only change in test/test_crew_log_writer_lanes.py; the wait now also waits for the retired lane to release its unit before the rebuilt writer's flush, so the flush does not spend its fake-clock budget against a held unit.
Problem / Motivation
Goal: Make
test_a_rebuilt_writer_does_not_write_beside_a_retired_writers_stuck_lanedeterministic so Backend Tests (Windows) stops going red on unrelated PRs.The test fails on Windows shard 2 at
test/test_crew_log_writer_lanes.py:522(assert rebuilt.flush(timeout=default_timeout())got False) on heads that do not touch the crew log writer (#32499, #32298, #26455).Why it matters
Every backend PR can hit this red on the Windows shard, which costs a rerun and blocks PR Readiness for authors whose change has nothing to do with the crew log writer.
Not a goal
CrewLogWriterorwriter_groups.Holds: the product behavior the test pins is correct.What changed (motivation → approach → change)
rebuilt.flush(...)returns False afterwait_until(lambda: home.steps(unit) == [1])succeeded._write_batch(src/kiro_crew/crew_log/writer.py:1760), but the lane gives the unit back toPROCESS_HOLDSonly later, in thefinallyof_drain_once(src/kiro_crew/crew_log/writer.py:1746-1748), after the batch's bookkeeping. The rebuilt writer runs passes on the test thread on a fake clock its own sleep advances (_run_claimed_passes,writer.py:1549). While the unit is still held,_next_pass_delay_lockedskips it and returnsbatch_deadline_seconds(0.02), so the whole 90 s budget is about 4,500 instant passes. If the retired lane has not released the hold by the time those passes finish (a slow Windows runner), flush returns False.PROCESS_HOLDS.held()(the method is documented "for tests and diagnostics", and the same file already importsPROCESS_HOLDSin two other tests). This is a boundedwait_untilon the real state, no sleep.Alternative considered: make the rebuilt writer's flush wait in real time for a unit another writer holds. It lost because it changes product behavior the first half of the same test pins on purpose (a flush against a held unit returns False within its budget instead of writing beside it), and the race is only in the test's barrier.
Intended? / Repro
Intended? Yes for the product, no for the test.
CrewLogWriter.closekeeps process holds on purpose (src/kiro_crew/crew_log/writer.py:900-901: "a lane stuck in a write still holds its unit, and no lane or inline write of this or a rebuilt writer may write beside it"), and a fake-clock flush against a held unit returning False is what line 517 of the test asserts. The test's barrier at line 521 (home.steps(unit) == [1]) waits for the file, not for the hold release, which comes later (writer.py:1746-1748). Introduced with #31953.Repro: CI only (host rule: no local test runs). Run https://github.com/kirodotdev/KiroCrew/actions/runs/42399858342/job/128486448508, Backend Tests (Windows) (2), PR #32499 head 837566e:
FAILED test/test_crew_log_writer_lanes.py::test_a_rebuilt_writer_does_not_write_beside_a_retired_writers_stuck_lane - assert False(1 failed, 33725 passed). Same failure in runs 42396500729 (job 128476650590) and 42420640985 (job 128550333104).Backwards compatibility
Compatible: test-only change; no product code touched.
Removes nothing: the diff only tightens one test's wait condition.
Tests
test/test_crew_log_writer_lanes.py::test_a_rebuilt_writer_does_not_write_beside_a_retired_writers_stuck_lane: the barrier before the second flush now waits for both step 1 in the file and the retired lane's release of the unit, so the flush runs only once the unit is free. All existing assertions stay.Manual verification
Static gates only (black, isort, flake8 on the changed file); CI runs the test.
Screenshots / video
N/A — test-only change, no UI.
Related Issues
Fixes #32634
Sibling sweep
Swept: git grep -n "retired = _writer|rebuilt" -- test/ and git grep -n "wait_until(lambda: home.steps" -- test/
Siblings: none -- no other test flushes a second writer against a unit a retired writer's lane still holds
Pattern harvest
Rule candidate: review-prompt
Pattern: "a test barrier waits for a side effect (file content) that is published before the lock/hold the next step depends on is released"
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.