Repository navigation
test: split four oversized test files under the line cap - #21912
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 Check that the three [DESIGN-REVIEWED] 41f4492 Description read[DESCRIPTION-READ] da5603448db911526c4a359d5e39a890fa1cd9e82284b8016fe28cfc4a156de0 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.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: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: test (17 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: moves tests out of four oversized test files into sibling modules and shared helpers; every removed test function is re-added, plus path-reference updates and baseline file edits. 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/architecture/app-platform-trust-model.md, docs/system-specs/modules/app-kit-platform.md.
Split test_issue_radar_crew_routes.py, test_mcp_gateway_rewriter_fingerprint.py, test_chat_mode_security.py and test_handlers_messaging_coverage.py between their test units into topic files beside them, with the helpers that more than one file reads in a test/<stem>_helpers.py module. Every test moves with an unchanged AST; the collected (class, name, params) multiset, the fixtures per test and the markers are identical. Each original keeps one contiguous run of its own tests and every name its importers read. The four line-cap rows go, the chat mode wait-discipline row follows its three waits to the send part, and two doc sentences name the send part that now pins the behaviour they describe. Part of #20192
c27871a to
41f4492
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: test (17 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: splits four oversized test files into topic siblings plus shared helper modules, drops their line-cap baseline rows and updates the test-name references; no source file changes. 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/architecture/app-platform-trust-model.md, docs/system-specs/modules/app-kit-platform.md.
Problem / Motivation
Goal: Bring four test files that are over the 2,000-line cap down below 1,600 lines each, without changing a single test.
test/test_issue_radar_crew_routes.py(2,374 lines),test/test_mcp_gateway_rewriter_fingerprint.py(2,272),test/test_chat_mode_security.py(2,269) andtest/test_handlers_messaging_coverage.py(2,288) are each over therepository's 2,000-line cap for hand-written files and are listed in
.github/file-line-cap-baseline.txt.Why it matters
A file over the cap must not grow:
scripts/check_file_line_cap.pyreports every change that takes one past itsbaseline row, and AGENTS.md sends new code to a new module, so a feature PR that touches one of these suites either splits
it first or puts its tests somewhere less obvious. Each file is also too long to read as one subject. Part of the
campaign that brings every hand-written file under the cap.
Not a goal
are black-formatted in their new files), and pre-existing flaky shapes keep their behaviour (tracked separately, see
Related Issues).
test_issue_radar_crew_routes.pystays as it is (it is in the blackbaseline).
What changed (motivation → approach → change)
Each file is split between existing test units (at class and section boundaries where the file has them) into topic
files beside it, and the helpers that more than one of the resulting files reads go to a
test/<stem>_helpers.pymodule. The original path keeps one contiguous run of its own tests and still binds every name its importers read; the
two doc sentences whose cited behaviour moved are re-pointed (below).
test_issue_radar_crew_routes.py(2,374 -> 908)GET /crews, create and names, crew read/update/retire, agent identity, the empty-queue sweep, agent-reachable routestest_issue_radar_crew_routes_work.py(798:PUT /crew/work, the skip index, one crew-log entry per write),test_issue_radar_crew_routes_controls.py(708: pause, stop, auto-approval withdrawal, settings, the absent human-wait endpoints, the issue comment, non-finite numbers),issue_radar_crew_routes_helpers.py(296:_CrewRouteCase, the slot, session and state fakes, the request builder)test_mcp_gateway_rewriter_fingerprint.py(2,272 -> 1,196)test_mcp_gateway_rewriter_fingerprint_keep.py(998: the keep on a settings read fault and its refusals, the content that stays cacheable, the legacy settings overlay, the fingerprint file, the transient-keep retention windows),mcp_gateway_rewriter_fingerprint_helpers.py(148:_CMD,_mk_tree,_rewrite, the fixtures)test_chat_mode_security.py(2,269 -> 1,016)api_chat_mode's slot-scope contracttest_chat_mode_security_send.py(1,203: an app's send onto a user slot),chat_mode_security_helpers.py(114: the app-token middleware and the app it mounts, the fixtures,_app_client, the app-control target table)test_handlers_messaging_coverage.py(2,288 -> 1,145)test_handlers_messaging_coverage_channels.py(1,111: the notification, Slack proxy, Teams and channel-config routes, the env writer, the token validators, the small helpers, the module guards),handlers_messaging_coverage_helpers.py(91: the request double,_run,_payload,_state)Three helpers modules are under 150 lines; each exists because two files of its family read the same helpers, and a
*_helpers.pymodule lets both import them without either test file depending on the other (thetest/*_helpers.pyconvention).
The only lines that are not moved code: one closing paragraph in each remainder's docstring naming the new files; the
new files' docstrings; each file's import block, which imports the shared names from its helpers module (four of those
imports carry
# noqa: F401 -- fixtures are requested by name); two helpers fixtures registered by name (@pytest.fixture(name="state") def state_fixture,@pytest.fixture(name="rewrite_counter") def rewrite_counter_fixture, thetest/meetings_helpers.pyconvention, so notest parameter shadows an import); own-line markers on five moved shapes (below); and one comment in
_CrewRouteCase.setUpthat said its patch isolates "every write in the module" and, in the helpers module, says it keeps"every request's store writes in self.root" (comment only).
Backwards compatibility
Compatible: test-only. Every test keeps its name, class, parameters, markers and fixtures; the collected (class, name,
parameters) multiset is identical, and only the file part of a moved test's node id changes.
Removes nothing: no product code changes, and every name other test files import from these modules stays importable
from the original path.
test_cli_spawn_run_agent_crew.pyandtest_crew_routing_and_delegation.py(
importorskip("test_handlers_messaging_coverage"):_mgr,_info,_Req,_state,_run,mod) andtest_subagent_continuable_template.py(_Req,_state) run unchanged and are not skipped.Tests
No test is added or changed. Proof that nothing was lost, BASE
5699d4b00bagainst this head, collected with-n0:--fixtures-per-test(name, sorted fixtures) multisetiter_markers)Per file at HEAD:
test_chat_mode_security.py140 +_send86;test_handlers_messaging_coverage.py121 +_channels145;
test_issue_radar_crew_routes.py57 +_work31 +_controls34;test_mcp_gateway_rewriter_fingerprint.py48 +_keep30.Move audit
bin/move_audit.py(AST), per origin; everychangedunit is a module docstring or a fixture registered by name:The moved units of
test_issue_radar_crew_routes.pyare black-formatted in their new homes (the new files are not in theblack baseline); their AST is unchanged.
Default diff and
--minimaladd the same lines in every file:--minimal+/-.github/file-line-cap-baseline.txtdocs/architecture/app-platform-trust-model.mddocs/system-specs/modules/app-kit-platform.mdtest/chat_mode_security_helpers.pytest/handlers_messaging_coverage_helpers.pytest/issue_radar_crew_routes_helpers.pytest/mcp_gateway_rewriter_fingerprint_helpers.pytest/test_chat_mode_security.pytest/test_chat_mode_security_send.pytest/test_handlers_messaging_coverage.pytest/test_handlers_messaging_coverage_channels.pytest/test_issue_radar_crew_routes.pytest/test_issue_radar_crew_routes_controls.pytest/test_issue_radar_crew_routes_work.pytest/test_mcp_gateway_rewriter_fingerprint.pytest/test_mcp_gateway_rewriter_fingerprint_keep.pytest/wait_discipline_baseline.txtPre-existing shapes moved with a marker
Moved verbatim, each with an own-line marker so the diff-scoped scans do not report the moved line as new code:
issue_radar_crew_routes_helpers._tick:time.sleep(0.004)that lets the crew log's millisecond clock move betweentwo stamps (
# flake-ok:, worded like the mergedissue_radar_crew_store_helpers._tickmarker).mcp_gateway_rewriter_fingerprint_helpers._forward_declared_env_onandchat_mode_security_helpers._hermetic_home:module autouse fixtures on the shared
monkeypatch(# nosemgrep: kirocrew.test-autouse-shared-monkeypatch, betweenthe decorator and the def; no test of either family calls
monkeypatch.undo()).test_chat_mode_security_send.py, the two "slot closes / is relinked during the read" tests:resp = await sendawaits the request task without a timeout after
release.set()(# flake-ok:).Rows, lists and citations
.github/file-line-cap-baseline.txt: the four targets' rows deleted.test/wait_discipline_baseline.txt:3 test_chat_mode_security.py->3 test_chat_mode_security_send.py(all threeshort waits move to the send part).
docs/architecture/app-platform-trust-model.md:128"pinned bytest_chat_mode_security" ->test_chat_mode_security_send;docs/system-specs/modules/app-kit-platform.md:1828"test_chat_mode_securitypinsthis" ->
test_chat_mode_security_send. The behaviours those sentences name are tested in the send part.mcp-gateway-daemon-lifecycle.md:160(the ambient-read tripwire stays intest_mcp_gateway_rewriter_fingerprint.py),test_issue_radar_crew_mcp_tools.py:49(TestAgentIdentityIsTheSessionstays),
test_issue_radar_crew_fabric.py:29(names the routes-test pattern), andconftest.py:1237, an observed envleak between
test_handlers_messaging_coverage.pyandtest_review_fixes.py; the credential-writing tests it refersto now live in
test_handlers_messaging_coverage_channels.py..github/black-baseline.txtkeepstest/test_issue_radar_crew_routes.py: the remainder is still not black-clean.target. CI path references: none.
Manual verification
N/A — test-only move; the local gate below runs the moved tests and every scanner that reads the test tree.
Local gate at this head (CI runs the full matrix):
-n0, one process: 789 passed, 4 skipped (the Windows-only casing test,as at BASE: 688 passed, 4 skipped over the 4 origins).
-n0: 688 passed, 4 skipped.local-gate.py --dry-run: 17 files; frontend 374 cross-surface files, not run: no fileunder
website/changes), every corpus gateleaf_test_scope.corpus_gates()reads (555 files), everysource_corpus/repo_files(scanner (89) and the facade, patch-census and list guards: 603 files,-n 3, at thepre-rebase head: 41,200 passed, 132 skipped, 5 xfailed, 1 failed (
test_history_bindings.py::test_the_member_set_is_the_frozen_inventory,the main red fixed by test(history): list the members #21108 added in the frozen inventory #21792, which this head is rebased onto). At this head (after the rebase and a
docstring-only rewording): the 555 corpus gates,
-n 3: 37,890 passed, 128 skipped, 5 xfailed; the scanners, therelated set and the guards (113 files,
-n 3): 8,022 passed, 21 skipped.test_flake_pattern_ratchet.py-n0: 58 passed.mypy src/kiro_crew: no issues in 2,950 files.comment-history and brand against the merge-base, docs-lint, the line cap, testpaths, feature map, harness parity,
focus cue, woke over the added lines, and the CI semgrep command with
--baseline-commit(0 findings; with--disable-nosemexactly the two autouse sites): all clean.41f44925b9on maina9898a0e21; the proofs above compare BASE5699d4b00b, and no split file changed between the two).Related Issues
Part of #20192
Follow-up: #20383 (pre-existing shapes moved verbatim; de-flake there: #20383 (comment))
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)