Repository navigation
test: split four oversized test files under the line cap - #21289
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 to check. [DESIGN-REVIEWED] 17644c5 Description read[DESCRIPTION-READ] 59f2178ce37e18470d6bffb4afcaa4b086beb0e68a3b20f24ea4c499f1a84e0f 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: |
d77c4bb to
9fcc477
Compare
|
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved by a maintainer. The triage automation held this on a size, path or category rule only; every review lane is clean.
9fcc477 to
92ea595
Compare
test_members_eventlog_wiring.py, test_split_credential_boundary.py, test_compaction_stop_declined.py and test_chat_slot_switch_atomicity.py were each over 2,680 lines. Each keeps its header and one contiguous run of its own tests, and the rest move verbatim into sibling parts named by behaviour, with the shared fixtures and builders in a *_helpers.py module per file. Every remainder and part is at most 1,335 lines; the collected tests are identical (469). Own-line flake-ok and nosemgrep markers sit above the pre-existing timing and rendezvous shapes the moved code carries. The four line-cap rows leave the baseline, the two wait-discipline rows follow their sites into the parts that hold them, and a comment in test_slack_events_coverage.py names the helper module that imports _event from it. Part of #20192
92ea595 to
17644c5
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved by a maintainer. The triage automation held this on a size, path, category or move-check rule only; every review lane is clean.
Problem / Motivation
Goal: Bring four test files of about 2,700 lines each down to at most 1,600 lines, so none of them exceeds the 2,000-line cap, without changing a single test.
test/test_members_eventlog_wiring.py(2,693 lines),test/test_split_credential_boundary.py(2,713),test/test_compaction_stop_declined.py(2,691) andtest/test_chat_slot_switch_atomicity.py(2,686) are each well past the size the line-cap campaign allows. A file that large is hard to navigate and review, and every PR that adds a test to one 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 each new test makes the eventual split larger and harder to review. Splitting by behaviour now gives each file room to grow and makes each topic findable by file name.
Not a goal
What changed (motivation → approach → change)
Each file splits along its own test classes and section banners, grouped by the behaviour under test. The original path keeps its header and one contiguous run of its own tests. Helpers and fixtures that more than one resulting file uses move to a non-test
*_helpers.pymodule, and every file imports them 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_members_eventlog_wiring.py(2693 → 1258)/api/membersprojections with the lazy config reconcile, and the roster and per-member projections routes as pure reads_startup_reconcile(700): the startup reconcile sweep;_live_writers(321): the activity round trip, the agent PUT hook, member-created slot events, the subscribe baseline;_append_ordering(434): one ordered worker, the shutdown drain, the patrol frame published after its appendtest_split_credential_boundary.py(2713 → 980)_sealed_seams(495): seams under a delivered message;_channel_delivery(556): each channel's own send path;_readings(347): the grade by every reading and the last resort's tags;_rotation_and_tally(407): Discord's rotation, the delivery tallies, the table-aware split, the stable streaming cuttest_compaction_stop_declined.py(2691 → 1335)/compactarm, the dashboard Stop, the queue a forced Stop carries to the successor_surfaces(564): Slack!stop, the shared channel stop, the interrupt route, the spec-builder Pause;_escalation(404): marker and parked-queue bounds, the notices, arming only after delivery;_claude_and_restart(336): the Claude arm and the uncompactable restarttest_chat_slot_switch_atomicity.py(2686 → 1262)_linked_session(855): switches on a linked channel or cron session;_alias_and_bulk(615): alias slots on one session, the project set, the bulk model switchHelper modules:
members_eventlog_wiring_helpers.py(61 lines),split_credential_boundary_helpers.py(58),compaction_stop_declined_helpers.py(158),chat_slot_switch_atomicity_helpers.py(61). Three are under 150 lines because each holds only what several files share; copying it into each part would duplicate code.Glue, the only new text:
_fresh_eventlog,_clear_channel_decline_markers) are imported into every file by name, so each test keeps its BASE autouse set. No fixture is renamed.split_credential_boundary_helpers.SRCis imported by name into the original, sotest_handlers_messaging_composition_contract.py'smonkeypatch.setattr(guard, "SRC", ...)still rebinds the globalTestTheDashboardHandlerLegsOffloadTheSplitterreads; that class stays in the original. The two patch sitestest_session_allocation_bindings.pyreads fromtest_compaction_stop_declined.py's text also stay.# flake-ok:comments sit above the pre-existing timing and rendezvous shapes that move, with an own-line# nosemgrep:directly above each site the repo's semgrep rules report on the new path (listed under Move audit).Rows and citations: the four rows in
.github/file-line-cap-baseline.txtare deleted (each file is now under the cap).test/wait_discipline_baseline.txtre-keys two rows to the parts that hold the counted waits,test_chat_slot_switch_atomicity_alias_and_bulk.pyandtest_members_eventlog_wiring_append_ordering.py(count unchanged, 1 each). Intest/test_slack_events_coverage.py, the comment on the_eventre-export namescompaction_stop_declined_helpers, which now imports it.Backwards compatibility
Compatible: test-only change. Every collected test keeps its class, name, parameters, markers and fixtures (both multisets are identical before and after). The names other test modules read from an original stay there:
test/test_handlers_messaging_composition_contract.pyimportstest_split_credential_boundaryand callsTestTheDashboardHandlerLegsOffloadTheSplitterwithSRCpatched;test/test_session_allocation_bindings.pyreadsrecord_session_startedandwake_other_drainsintest_compaction_stop_declined.py. Both pass unmodified. No production module, import path, patch target or CLI changes.Removes nothing: every test, fixture and helper still exists, moved with an identical AST.
Tests
No test was added or rewritten. These proofs show the move lost nothing:
pytest --collect-onlyat BASE vs HEAD over the 4 originals and 12 new test files(class, name, params)multiset is identicalbin/verify_test_split.py(every BASE top-level unit unchanged at HEAD, byast.dump)-n 3test_slack_events_coverage*.py+ 110 tests that scan the test tree (ratchets, facade guards, leaf/surface selectors, source pins) at-n 3-n 3(splits, importers,test_slack_events_coverage*.py,test_chat_slot_project.py, the ratchets and selectors)test_compaction_stop_declined*.pyfiles at-n0, codepoint ordertest/test_flake_pattern_ratchet.py(-n0, against the merge-base)--baseline-commit <BASE>website/file changes)Ordering note: two tests assert an absolute value of a module-wide drop counter that no fixture resets (
test_the_parked_queue_is_count_bounded_and_the_overflow_is_logged, kept, andtest_decline_markers_are_count_bounded_and_the_overflow_is_counted, moved), so each passes only when no test before it on the worker overflowed that bound. Both fail the same way at BASE when a later bound test is run first. In pytest's own file order the original still runs before its parts, so these tests keep their BASE order; the one failure above came from a locale-sorted (en_US) file list that collected_escalationfirst. The moved assertion carries a# flake-ok:.scripts/local-gate.py --base <BASE> --dry-run: backend related set 24 test files (17 in the diff, 7 referencing a changed file), all run above; frontend 367 cross-surface files, joined only because.github/changed; no file underwebsite/changes, so CI owns that set.Move audit
Every test function and class moved with an identical AST; the only
changedunits are the four module docstrings.git diff BASE...HEADis 595,240 bytes.Moved timing and rendezvous shapes (51
# flake-ok:and 15# nosemgrep:lines), each with an own-line marker in its new file:# flake-ok:+# nosemgrep: kirocrew.test-sleep-as-barrieron the 14 moved sleeps semgrep reports on the new path: 12 in the slot-switch parts (a 50 ms sleep that lets the racing request reach the held lock), the_claimanthold in_claude_and_restart, and the stubbed slow append in_append_ordering.# flake-ok:+# nosemgrep: kirocrew.test-autouse-shared-monkeypatchon_fresh_eventloginmembers_eventlog_wiring_helpers.py(no test that imports it callsmonkeypatch.undo()).# flake-ok:alone on the shapes the AI review rule reads but semgrep does not report: unbounded awaits of request tasks and events, lock and semaphore acquires, the_settle()yield barrier, the 0.05 s, 0.2 s and 0.5 s budgets three tests let run out on purpose, the real-clock escalation-window reads, and the absolute drop-counter read.Credential-shaped literals that move:
KEY = "AKIAIOSFODNN7EXAMPLE"(AWS's documented example id) into the split-credential helpers; the hyphenatedwJalrXUtnFEMI-K7MDENG-bPxRfiCYEXAMPLEKEYand theSecretAccessKeylookalike tag into_sealed_seamsand_readings, byte-identical to lines merged in #14314. The twotoken=AKIAIOSFODNN7EXAMPLEURL literals stay intest_members_eventlog_wiring.py.Diff alignment (L36): each original keeps one contiguous run of its BASE code after its header. For every changed tracked file,
git diff BASE -- <file>andgit diff --minimal BASE -- <file>add the same lines (blank lines counted): members 11/11, split-credential 19/19, compaction 21/21, slot-switch 7/7, slack-events comment 1/1, wait-discipline 2/2, line-cap 0/0.Logger names (L25): no new module defines a logger; the moved
caplogassertions key on production loggers (kiro_crew.eventlog_hooks,kiro_crew.session_lifecycle), so nothing changes.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 the 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: ...)