Repository navigation
refactor(testing): drop a dead teardown operand and an unread field - #24016
Conversation
`_terminate_process_group` ended with `escaped_ended and not root_already_exited`, but every path where the root had already exited returns earlier, so the second operand is always true there. It now returns `_end_escaped_descendants(escaped)` directly. `_FakeResponseCM.__init__` stored the canned `WireResponse` as `_resp`, which neither the class nor the aiohttp methods it borrows ever read. No test checked that last line's False answer: with main's line replaced by `return True`, the only related reds were test_spawn_audit.py's tree scans, which red the same way on an unmodified copy. A parametrized test in test_harness.py now pins it for a live root whose saved child sits in another process group. It passes against the code before this change. Comments in the same two files: a sentence crediting the escaped descendants' safety to a `created_after` filter this POSIX path never applies is removed; the queue rationale drops a clause saying the unbounded queue bounds read-ahead, and its "old selector poll" aside; the cold-import note names `cold_hint` and the liveness state rather than an earlier message; the `TAIL_CHUNKS` and unknown-group comments stop narrating earlier designs; and the fake's list of attributes the borrowed methods read gains `headers`, `_in_context` and `_resolve_charset`. testing-conventions.md repeats that list and is corrected with it. On POSIX the teardown's SIGKILL of a saved descendant does not re-check its creation token, though two comments in harness.py say it does. That is #24013 and is not changed here.
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this only touches test-harness internals. The dropped operand is always true where it was read, the dropped field has no reader, and the new test pins the verdict. [DESIGN-REVIEWED] 8b76aa3 Description read[DESCRIPTION-READ] 62641516fc4465c99f426975bdaa51c5bbbe61ea88499edfaa66f8180a7dc474 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: both code edits change no behaviour (the base shows What this change shipsInventory (5 items) — 5 justifiedIntent: make the test harness's teardown verdict and fake aiohttp response read as what they actually do, and pin that verdict with a test. This is a FIX (dead code and false comments).
[FIRST-PRINCIPLES-REVIEWED] 8b76aa3 Description read[DESCRIPTION-READ] 07b78fbf22c1f7dd1e2fa485003d9078f03c70ff25cca137dfd0fd468dfec21b That sha256 names the PR description this verdict read. Recompute it with |
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: |
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: |
|
Answers for head
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: refactor (4 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: drops an operand that is always true on the POSIX teardown path (the root-already-exited case returns earlier) and an unread field in the test harness, trims stale comments, and adds a test for the escaped-descendant verdict. Spec files changed as a ride-along (a minority of the diff on both file count and changed lines), not reviewed as a design decision: docs/system-specs/common/testing-conventions.md.
Problem / Motivation
Goal: Remove a dead operand from the test harness's teardown verdict and an unread field from its fake aiohttp response, pin that verdict with a test, and correct the comments this description lists in those two files, without changing what either does.
src/kiro_crew/testing/runs real gateways and fake channel wires for the suite. Two of its files carry state that never matters and comments that contradict the code:_terminate_process_groupends withreturn escaped_ended and not root_already_exited. Every path where the root had already exited returns before that line, sonot root_already_exitedis always true there, yet reads as if a crashed root could reach the last verdict.False: replacing the line withreturn Truered only 20test_spawn_audit.pytree scans, which red the same way on an unmodified copy._FakeResponseCM.__init__stores the canned response asself._resp. Nothing reads it, while the class docstring says it supplies only the attributes aiohttp's borrowed methods read.testing-conventions.md, leaves out three the borrowed methods do read:headers,_in_contextand_resolve_charset.created_afterfilter this POSIX path never applies; a comment below it in the same function says so._StdoutPumpdocstring says the queue stops the reader reading ahead without bound; the queue is unbounded and takes every chunk until the reader is handed off after READY.deque", "the originalexcept OSError").Why it matters
Nothing is broken. That verdict decides whether the harness deletes a test gateway's HOME while a child it saved may still be writing there, so the line should read as what decides it, and a test should fail if it stops deciding it. A comment that names the wrong guard sends the next reader to the wrong function.
Not a goal
kill_pid_pinnedchecks identity only on Windows, so twoharness.pycomments (the_end_escaped_descendantsdocstring and the paragraph above the live-descendant walk) describe a pin POSIX lacks. That gap is POSIX harness teardown SIGKILLs a saved descendant without re-checking its creation token #24013; those comments state the rule its fix should meet.kiro_crew/testing/a read-only scout found false, in__init__.py,wait.py,fixtures.pyandchannel_fixtures.py. This PR edits comments only in the two files it changes in code.fake_acp_backend.pyandfake_computer_use.py, which open PRs (feat(subagents): remote agents as subagents over A2A #10171, feat(code-review): add guided review fix workflow #5274, fix(security): classify redaction by what a value can do (awaiting design approval) #22887) change.What changed (motivation → approach → change)
The teardown verdict now returns the escaped-descendant answer directly, the fake stops storing a field nobody reads, and each comment listed above is restated to match the code beside it, or deleted.
_terminate_process_group, last lineescaped_ended = _end_escaped_descendants(escaped), thenreturn escaped_ended and not root_already_exitedreturn _end_escaped_descendants(escaped)_FakeResponseCM.__init__self._resp = resp_FakeResponseCMdocstring,testing-conventions.mdharness.pycreated_aftersentence, read-ahead clause, selector anddequeasides deleted; cold-import and unknown-group comments restatedtest/test_harness.pyWhy the operand is dead:
root_already_exitedis assigned once, and both of its exits (the Windows branch and the POSIXreturn False) come before the last line._end_escaped_descendantsreturns onlyTrueorFalse, sox and Trueisx.Backwards compatibility
Compatible: neither code change does anything at runtime, since the dropped operand is always true where it was read and nothing read the dropped field.
Removes nothing:
_respis private, with no reader insrc/,test/,docs/or the aiohttp 3.14.3 methods the fake borrows;take_away_check.pyfinds no take-away shape.Tests
TestTeardownDoesNotTrustTheRootsExit::test_a_live_roots_verdict_waits_on_its_escaped_descendants, cases[True]and[False]. It stages a live root whose saved child sits in another process group and checks that the child reaches_end_escaped_descendantswith its recorded token and that the verdict is that function's answer. It passes against main'sharness.py, so it pins existing behaviour; with main's last line replaced byreturn True, only[False]reds.-n0.test_harness.py: 10 runs at-n 4 --dist loadgroup --max-worker-restart=2, and its 85 ids shuffled (seed 25102) at-n0. All green; the flake-pattern ratchet is green.test/e2e/that namekiro_crew.testing.harness,fake_channel_wireorfrom kiro_crew.testing import, plustest_spawn_audit.pyandtest_internal_python_isolation.py, which readharness.pyby path. 707 passed, 25 skipped._terminate_process_groupover 139,968 stubbed inputs: identical verdicts and call logs whenever_end_escaped_descendantsreturns a bool, which it always does. The security lens found no control changed shape and no touched file keystone.created_aftersentence promised a token-pinned kill the POSIX path does not perform, and that the commit message repeated it. Both adjudicators upheld both and ruled to delete the sentence and the commit message's claim.harness.pycomments make the same claim. Both adjudicators ruled to leave them as the rule POSIX harness teardown SIGKILLs a saved descendant without re-checking its creation token #24013's fix should meet, and to file that gap publicly.scripts/scrub-lint.shis absent from the checkout. The frontend did not run, as nothing underwebsite/,.github/orscripts/changed.Manual verification
N/A: neither code change does anything at runtime, and the related tests run both files.
Screenshots / video
Why no screenshot: backend-only change to test-harness internals, their comments and one spec paragraph; no page, card or string changes.
Related Issues
Part of #16523
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)