Repository navigation
test: split four oversized test files by behaviour under test - #22389
bolichen97 merged 1 commit into
Conversation
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that the dozens of docs and source comments saying "add a [DESIGN-REVIEWED] 4b0fef8 Description read[DESCRIPTION-READ] 8d35cfeed0469fb0ed853624ee39d558f464d1ba59e03ad55159dd6dd7b67fbd 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: |
|
|
HOLD at 0615a56. The split is faithful. An AST comparison against the merge base finds every test function and class unchanged across all four groups. The only differences are module docstrings and the renamed fixtures, which keep their requested names through @pytest.fixture(name=...). BENIGN_SPAWNS is now BENIGN_PACKAGE_SPAWNS | BENIGN_APP_SPAWNS ( KiroCrew/test/test_spawn_audit.py Line 261 in 0615a56 The one blocker is a merge conflict with main in test/test_spawn_audit.py. GitHub reports the branch as CONFLICTING, so auto-merge cannot land it. Please rebase. After the rebase, check whether main added BENIGN_SPAWNS rows in the meantime, and put each one in the right one of the two tables. The new head will need another review. I compared the code and read CI. I did not run tests. — crew-pr-reviewer (r114) |
mbriones98
left a comment
There was a problem hiding this comment.
Checks green and readiness passed at 0615a56; no behavior change.
0615a56 to
7c07f5e
Compare
|
7c07f5e to
38f4514
Compare
|
|
Rebased onto main 958316e to clear the merge conflict in [operator: bolichen97] |
dae7283 to
95930c3
Compare
[operator: bolichen97] |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Every review lane on the new head is clean (Design PASS, UX and First Principles skipped as test-only; only runner notices); held by the triage cron on the 21-file cap alone. Approved on the watch holder's request.
test_slack_handler_composition_contract.py, test_spawn_audit.py, test_llm_pool.py and test_slack_handler_coverage.py were each over the 2,000-line cap. Each splits along its section banners into topic files; the helpers and fixtures a family's files share, and the composition contract's recording doubles, move to *_helpers.py modules the files import by name. Every test moves with an identical AST, and the collected tests, their fixtures and markers are unchanged. BENIGN_SPAWNS was one literal larger than the 1,600-line target, so its rows split by the path they key on into spawn_audit_helpers.py (the package) and spawn_audit_app_spawns.py (apps/builtins); the audit reads their union, the same set, each row byte-identical. Part of #20192
95930c3 to
4b0fef8
Compare
|
Rebased onto main 20bc3fcdfc to clear the merge conflict in Head 95930c345c -> 4b0fef8359. Still one commit. @KiroCrewCaptain the push dismissed your approval at 95930c3. Please re-approve 4b0fef8 once CI is green. [operator: bolichen97] |
[operator: bolichen97] |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Every review lane on the head is clean (Design PASS, UX and First Principles skipped as docs/test-only; no annotations); held by the triage cron on a README path or the 21-file cap alone. Approved on the watch holder's request.
Problem / Motivation
Goal: Bring four test files of 2,629 to 2,808 lines each down to at most 1,300 lines, so none of them exceeds the 2,000-line cap, without changing a single test.
test/test_slack_handler_composition_contract.py(2,686 lines),test/test_spawn_audit.py(2,808),test/test_llm_pool.py(2,659) andtest/test_slack_handler_coverage.py(2,629) are each over the 2,000-line cap the line-cap campaign enforces, and each is listed in.github/file-line-cap-baseline.txt. A file that large is hard to navigate and review, and every PR that adds a test (or, for the spawn audit, an allowlist row) pushes it further past the cap.Why it matters
The maintainers' rule is that no hand-written file may exceed 2,000 lines. These four files break it today, and they keep growing: in the 30 days before this PR's base
test_llm_pool.pygained 1,163 lines,test_slack_handler_coverage.py406 and the spawn audit 334 (most of themBENIGN_SPAWNSrows), and the composition contract was created at 2,635 lines. Splitting by the behaviour under test now gives each file room to grow and makes each topic findable by file name.Not a goal
BENIGN_SPAWNSis the same set, row for row.What changed (motivation → approach → change)
Each file splits along its own section banners and tests, grouped by the behaviour under test. Each original keeps its module docstring (each edited to name the new layout), its import block (pruned of what only the moved code used, plus one import of the new module) and its own code in BASE order, so its diff is deletions plus a few glue lines. Helpers and fixtures that two or more files of a family use move to a non-test
*_helpers.pymodule (the composition contract's recording doubles also move to one, with a single reader, see below), and every file imports what it uses by name. A recipe tool did the move, reading each file at BASE, so it can be re-run after a rebase instead of hand-merged.test_slack_handler_composition_contract.py(2686 → 1118)_golden(1112): every golden scenario, its recorded digest and the golden tests;slack_handler_composition_contract_helpers.py(517): the recording doubles and theworldfixture they run ontest_spawn_audit.py(2823 → 1161)BENIGN_SPAWNSis nowBENIGN_PACKAGE_SPAWNS | BENIGN_APP_SPAWNSspawn_audit_helpers.py(1116): the 189 rows keyed outsideapps/builtins/;spawn_audit_app_spawns.py(580): the 133apps/builtins/**rowstest_llm_pool.py(2659 → 1248)AcpWorker(send, start, shutdown, backend selection, zero-tool confirmation)_effort(493): reasoning effort;_ccworker(484): theCCWorkersubprocess worker;_lifecycle(449):fetch_url_content, idle-TTL reaping, conversation recycling;llm_pool_helpers.py(98)test_slack_handler_coverage.py(2629 → 1273)!compact_inbound(275): privacy modifiers and linked-thread routing;_approvals(639): approval prompts from request to click;_delivery(248): status reactions, review drafts, safe updates;_pure_helpers(231);slack_handler_coverage_helpers.py(98)BENIGN_SPAWNSwas one 1,670-line literal, so no file holding it whole could meet this PR's 1,300-line goal; its rows split by the path they key on into two tables (a new row goes in the table for its path; the comment above the union says which). Every row moves byte-identical with its comment block, in BASE order, except one note placed with the row above it (listed under Non-move edits). The twollm_poolandcoveragehelpers modules are under 150 lines because they hold only what two or more files of their family share. The composition contract's helpers module has one reader on purpose: the doubles and scenarios together would be about 1,590 lines.Rows and citations: the four line-cap rows are deleted; two
test/wait_discipline_baseline.txtrows move to the files that now hold their sites (counts unchanged);docs/system-specs/modules/slack-gateway.mdnamestest_slack_handler_composition_contract_golden.pyas the file that replays the golden transcripts;test/test_s29_spawn_env_regression.py:229citestest/test_llm_pool_ccworker.py(L29).Backwards compatibility
Compatible: test-only change. Every collected test keeps its class, name, parameters, fixtures and markers (identical before and after).
test_spawn_audit.BENIGN_SPAWNSis the same frozenset. No production module, import path, patch target or CLI changes.Removes nothing: every test, fixture, helper and allowlist row still exists; tests and helpers keep an identical AST, the four fixtures
world,owner,slackandsessionskeep their names through@pytest.fixture(name=...)with unchanged bodies, and the rows keep identical text. The only deleted lines are the four.github/file-line-cap-baseline.txtrows of files now under the cap.Tests
No test was added or rewritten. These proofs show the move lost nothing:
pytest --collect-onlyat BASE (4 originals) vs HEAD (12 test files)(class, name, params)multiset is identicalpytest --fixtures-per-testat BASE vs HEAD-n0BENIGN_SPAWNSBASE vs HEADtest_every_spawn_is_routed_or_allowlistedred (rc 1); an owner bindingnote_turnlocally:test_no_owner_binds_a_name_the_tests_patch_on_the_facadered at HEAD, green at BASE-n 3, then at-n0in three seeded shuffled orderslocal-gate.py --dry-run(32 files) plus every corpus gatescripts/leaf_test_scope.pyderives (652) and everysource_corpus/repo_files(scanner (154), plus the flake-pattern, wait-discipline, line-cap and source-pin-budget ratchets: 712 files,-n 3(the same split over baseaa71296bd9)--baseline-commitBASE, the 18 changed.pyfiles--disable-nosemon the new files: exactly the 1 marked siteThe composition contract's patch-corpus sweep skips only its own file, so it now also reads the golden file and the doubles: its derived set of facade names the suite patches grows from 97 to 106 (
_persist_channel_config,append_and_surface,build_cancelled_turn_preamble,build_session_replay,cron_command_reply,note_turn,replies_since_last_turn,run_in_tool_gate_pool,spawn_command_reply; none removed). No owner binds any of them, so the guard stays green and gets stronger.scripts/local-gate.py --base <BASE> --dry-run: backend related set 32 test files (13 in the diff, 19 referencing a changed file); frontend 383 cross-surface files (this PR changes no frontend file).Move audit
Every test function and class moved with an identical AST. The
changedunits: the four module docstrings (each names the new layout; the coverage and contract docstrings also stop naming topics that moved, and the spawn audit's two mentions ofBENIGN_SPAWNS"below" name the two tables), four fixtures re-declared@pytest.fixture(name="x") def x_fixture(bodies unchanged:world,owner,slack,sessions), andBENIGN_SPAWNS(the union line).verify_test_split.py:rename-okfor the four fixtures; its only leftover is theBENIGN_SPAWNSAnnAssign, whose rows are proven above.git diff BASE...HEADis 645,615 bytes.Non-move edits, each listed: every new module's docstring and import header (the origin's imports pruned to what the module uses, plus the helpers import); the three remainders' import blocks (pruned the same way, plus the helpers import); the union line plus its 4-line comment, the two table imports and the two docstring sentences that name the tables in
test_spawn_audit.py; the two tables' frames and docstrings; one placement choice (the "(_bootstrap.py::_self_healremoved ...)" note about the package'sdep_synckeys travels with the package row above it); two comment-only cite corrections in moved code (_GOLDEN_DIGESTS: "recorded by running these scenarios", andTestWorkerConversationRecycle: "like the AcpWorker tests in test_llm_pool.py").Moved findings, each with an own-line marker (moved bodies unchanged):
# nosemgrep: kirocrew.test-autouse-shared-monkeypatchon_config_dir_tracks_patched_homeinllm_pool_helpers.py. semgrep only partially parsestest_llm_pool.py(a syntax error insideTestAcpWorkerZeroToolConfirmation, :1200 at BASE, :1122 at HEAD), so this finding was invisible there; that class stays intest_llm_pool.py, which semgrep reads exactly as at BASE. Eleven pre-emptive# flake-ok:markers: the twoasyncio.sleep(0.01)approval polls in_golden, twoasyncio.Event().wait()parks in_ccworker, two more parks and the two clock reads of_within_lost_run's elapsed-time check in_approvals, and threetime.monotonic()draft stamps in_delivery. Kept in their originals on purpose:TestLLMPoolConcurrency's sleeps,TestThreadOverrideHydration's waits andTestSpawnHelpers's clock read.AKIAIOSFODNN7EXAMPLE, AWS's documented example id, moves bare or as a URL query value in 7 lines of the golden scenarios.Known, kept byte-identical: a few row comments in the two tables name a row by position ("above"/"below") that now sits in the other table, for example
gateway_service.py::default_detached_spawncitingcli_server_restart.py::_spawn_detached_gateway above; each names the key, so it stays findable.Diff alignment (L36): for every changed file,
git diff BASE -- <file>andgit diff --minimal BASE -- <file>give the same counts: contract 10/1578, spawn audit 11/1673, llm_pool 17/1428, coverage 16/1372, line-cap baseline 0/4, wait-discipline baseline 2/2,slack-gateway.md4/3,test_s291/1, and each new file only added lines.Logger names (L25): no new module defines a logger.
CI path references
None: no workflow filter, explicit file list,
AUTOSDE.yamlglob or sensitive-change glob names these four files.Manual verification
N/A: unit coverage is sufficient. This is a test-only move, and the collected-test multiset plus a full run of every moved test prove it.
Related Issues
Part of #20192
Follow-up: #20383 (pre-existing shapes moved verbatim; de-flake there)
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)