Repository navigation
test: split four oversized test files by behaviour under test - #22190
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 Nothing to check. [DESIGN-REVIEWED] dbf7db5 Description read[DESCRIPTION-READ] cb3b76070afa6e54c14a9e2c9bdc7033b920fae21785d17dec88432f7b96d07c 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: |
9de8b78 to
b4a5841
Compare
b4a5841 to
c24b4ca
Compare
|
@chenmingwei23 a rebase dismissed your approval. The new head c24b4ca is green, with [operator: bolichen97] |
|
Holding at c24b4ca: GitHub reports a merge conflict with main. Please rebase. The split itself looks faithful. Comparing AST units against the merge base, every test body in the four files is unchanged. The only differences are module docstrings, a repeated — crew-pr-reviewer (r114) |
c24b4ca to
f200160
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Every review lane on the head is clean (only runner notices and PR Scope / Opus size warnings); held by the triage cron on size, path, tie or checklist rules alone. Approved on the watch holder's request.
test_dashboard_updates_coverage.py (2565 lines), test_chat_mirror.py (2475), test_taskq_runner_adapter.py (2453) and test_mcp_gatewayd_coverage.py (2449) were each over the 2,000-line cap. Each now keeps a contiguous run of its own tests (1098, 1526, 1468 and 1408 lines), and the rest moves verbatim into topic siblings: the update apply and the log streams; the mirror-link delivery cases; the runner-adapter durability cases; gatewayd's backend acquire and respawn. Support units that two or more files read live in per-family *_helpers.py modules. Every test moves with an identical AST: the collected (class, name, params) multiset, the fixtures per test and the markers are unchanged. The only non-move lines are the docstrings, the import headers, the taskq clock/store fixtures re-declared with name=, own-line nosemgrep and flake-ok markers above moved findings, the four line-cap rows, one launch-approval exemption row for the respawn part, and the citations that name where the moved tests live. Part of #20192
f200160 to
dbf7db5
Compare
|
@KiroCrewCaptain a rebase dismissed your approval of f200160. Rebased onto main ac8a408: the PR conflicted only in [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.
Problem / Motivation
Goal: Bring four test files of 2,449 to 2,565 lines each down to at most 1,530 lines, so none of them exceeds the 2,000-line cap, without changing a single test.
test/test_dashboard_updates_coverage.py(2565 lines),test/test_chat_mirror.py(2475),test/test_taskq_runner_adapter.py(2453) andtest/test_mcp_gatewayd_coverage.py(2449) are each over the 2,000-line cap thatscripts/check_file_line_cap.pyenforces, 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 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 the behaviour under test 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. Each original keeps its module docstring, the imports its remaining code uses and a contiguous run of its own tests; where one middle block moves, the original keeps the tests on both sides of it, so the moved block leaves the original as one contiguous deletion. Helpers and fixtures that more than one 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_dashboard_updates_coverage.py(2565 → 1098)_apply(639):POST /api/update's refusals and worker, the pip-install report, simulate and cancel;_streams(774): the log level endpoint, the log handlers,GET /api/logs, the chat-message door scan, the dashboard SSE streamtest_chat_mirror.py(2475 → 1526)_link_delivery(901): the mirror-link edge cases, the non-Slack backfill and its claim ordering, the inbound claimtest_taskq_runner_adapter.py(2453 → 1468)accept,admitand its cancel arms, the claim/start boundary, stop-reason recovery, the dependency and input waits_durability(953):_requeue_unstarted's refusals, the adopt sweep, the factory, the store as the only admission path, terminal writes through an outage or a crash, answers read back from the wake eventtest_mcp_gatewayd_coverage.py(2449 → 1408; 1427 at HEAD, which carries main's newTestWriteDiagnostictest from #22310)_acquire_respawn(1012):_acquire_backendand_respawn_backend_for_stubHelper modules:
dashboard_updates_coverage_helpers.py(174 lines),chat_mirror_helpers.py(118),taskq_runner_adapter_helpers.py(112),mcp_gatewayd_coverage_helpers.py(117). Each holds only what two or more files of its family share; three are under 150 lines for that reason.Glue, the only lines whose AST or comments change:
clockandstorefixtures, which tests request by parameter, are re-declared@pytest.fixture(name="x") def x_fixture(thetest/meetings_helpers.pyconvention), so a parameter never shadows an import. The two module autouse fixtures (_isolated_module_state,_clean_gateway_globals) keep their names. Every file of a family imports its fixtures with# noqa: F401, so each test keeps its BASE fixture set.pytestmark = pytest.mark.xdist_group("mcp_gateway"), the group the gateway test files share.# nosemgrep:/# flake-ok:comments sit above the moved semgrep sites, sleeps, yields, unbounded awaits and clock stamps (listed under Move audit).Rows and citations:
.github/file-line-cap-baseline.txtare deleted (each file is under the cap at HEAD).test/test_mcp_launch_approval_gateway.py:_GATEWAY_LAUNCH_FIXTURE_EXEMPTIONSgainstest_mcp_gatewayd_coverage_acquire_respawn.py, the part that holds the respawn tests thetest_mcp_gatewayd_coverage.pyrow exempts at BASE. That row stays, because the declared-env and target-resolver tests stay in the original (a row addition; deleting the new row makestest_gateway_spawn_and_env_tests_choose_launch_approval_fixturefail, naming the part).docs/system-specs/modules/taskq.md:316test_taskq_runner_adapter.py->test_taskq_runner_adapter_durability.py(_requeue_unstarted's read-back)docs/system-specs/modules/taskq.md:952test_taskq_runner_adapter.py->test_taskq_runner_adapter_durability.py(one case per refusal)docs/system-specs/modules/taskq.md:1364test_taskq_runner_adapter.py::test_crash_during_a_deferred_terminal_write_reconciles_the_row->test_taskq_runner_adapter_durability.py::test_crash_during_a_deferred_terminal_write_reconciles_the_row(line 1365's::shorthand names a test in the same file and is unchanged)docs/system-specs/modules/taskq.md:1559test_taskq_runner_adapter.py::test_adopt_pages_past_its_scan_size_so_no_queued_row_is_stranded->test_taskq_runner_adapter_durability.py::test_adopt_pages_past_its_scan_size_so_no_queued_row_is_strandeddocs/system-specs/modules/taskq.md:1694-1696"ran; adopt over accept-only + admit-only rows, twice, ..." -> "ran),test_taskq_runner_adapter_durability.py(adopt over accept-only + admit-only rows, twice, ..." (the cancel and starting-write cases before it keeptest_taskq_runner_adapter.py)docs/system-specs/modules/taskrunner.md:613test/test_taskq_runner_adapter.py->test/test_taskq_runner_adapter_durability.pydocs/system-specs/common/testing-conventions.md:3214test_taskq_runner_adapter.py->test_taskq_runner_adapter_durability.py(_one_warning)docs/system-specs/modules/mcp-gateway-backend-replacement.md:87test_mcp_gatewayd_coverage.TestRespawnBackendForStub->test_mcp_gatewayd_coverage_acquire_respawn.TestRespawnBackendForStubtest/test_mcp_tool_surface.py:12(module docstring)test_mcp_gatewayd_coverage.py->test_mcp_gatewayd_coverage_acquire_respawn.pytest/test_runner_facade.py:457(comment)test_taskq_runner_adapter.py->test_taskq_runner_adapter_durability.pyBackwards compatibility
Compatible: test-only change. Every collected test keeps its class, name, parameters and markers (the multiset is identical before and after). The one test module that imports from an original,
test/test_cross_surface_mirror.py, still imports its three names fromtest_chat_mirror; no production module, import path, patch target or CLI changes.Removes nothing: every test, fixture and helper still exists; each moved unit keeps an identical AST except the
clockandstorefixtures, re-declared withname=and unchanged bodies.Tests
No test was added or rewritten. These proofs show the move lost nothing:
pytest --collect-onlyat BASE (4 originals) vs HEAD (9 test files)(class, name, params)multiset is identicalpytest --fixtures-per-testat BASE vs HEAD-n0-n 3-n0in three seeded shuffled orderstest_cross_surface_mirror.py, the path readerstest_mcp_launch_approval_gateway.py,test_runner_facade.pyandtest_updates_handlers_facade.py, andtest_mcp_tool_surface.py(re-pointed docstring), plustest_flake_pattern_ratchet.py,test_wait_discipline_ratchet.py,test_file_line_cap.py,-n0scripts/leaf_test_scope.pyderives (609) and everysource_corpus/repo_files(scanner (122), plus the ratchets: 701 files,-n 3--baseline-commitBASE over the 16 changed.pyfiles--disable-nosemover the new files exactly the 5 marked sites.woke.ymlover the added linesscripts/local-gate.py --base <BASE> --dry-run: backend related set 71 test files (12 in the diff, 43 name-matched, 16 referencing a changed file); frontend 379 cross-surface files (this PR changes no frontend file).Move audit
Every test function and class moved with an identical AST; the
changedunits are the four module docstrings (one appended layout paragraph each) and the two fixtures re-declared withname=(bodies unchanged).verify_test_split.py: no leftovers (rename-okfor both fixtures).git diff BASE...HEADis about 447 KB.Moved semgrep sites, each with an own-line
# nosemgrep:(no module of these families callsmonkeypatch.undo()):dashboard_updates_coverage_helpers.py(_isolated_module_state) and, intest_dashboard_updates_coverage_streams.py, the class-level_own_shutdown_event(twice) and_warm_status_countsfixtures (test-autouse-shared-monkeypatch, between the decorator and thedef) and the 10 ms pause in the stubbedwait_for(test-sleep-as-barrier). Pre-emptive own-line# flake-ok:markers sit above the 19 moved timing shapes: one-iteration yields and the fake sleep's yield, the 10 ms pause, unbounded awaits of cancelled or parked tasks, the unbounded gather of the update worker, a parkedEvent().wait()task, the hanging writer double, two real-clock stamps and one process-wideasyncio.wait_forstub. Kept in their originals: every other timing shape and semgrep sleep site of the four files, among them theasyncio.sleep(0)yield and thegatherin the dashboard original'sTestExternallyManagedCheck.AKIAIOSFODNN7EXAMPLE, AWS's documented example id, moves bare once insideTestMirrorBackfillFidelity.Moved findings and their markers (BASE site = the line in the original):
test/dashboard_updates_coverage_helpers.py:27def _isolated_module_state(monkeypatch, tmp_path):test/test_dashboard_updates_coverage.py:48test/test_dashboard_updates_coverage_streams.py:309def _own_shutdown_event(self, monkeypatch):test/test_dashboard_updates_coverage.py:1892test/test_dashboard_updates_coverage_streams.py:411await asyncio.sleep(0.01)test/test_dashboard_updates_coverage.py:1991test/test_dashboard_updates_coverage_streams.py:481def _own_shutdown_event(self, monkeypatch):test/test_dashboard_updates_coverage.py:2058test/test_dashboard_updates_coverage_streams.py:488def _warm_status_counts(self, monkeypatch):test/test_dashboard_updates_coverage.py:2064test/test_dashboard_updates_coverage_apply.py:60await asyncio.sleep(0)test/test_dashboard_updates_coverage.py:1044test/test_dashboard_updates_coverage_apply.py:110await hold.wait()test/test_dashboard_updates_coverage.py:1093test/test_dashboard_updates_coverage_apply.py:417await asyncio.gather(*list(state._background_tasks))test/test_dashboard_updates_coverage.py:1399test/test_dashboard_updates_coverage_apply.py:601await asyncio.gather(*list(state._background_tasks))test/test_dashboard_updates_coverage.py:1582test/test_dashboard_updates_coverage_streams.py:387await tasktest/test_dashboard_updates_coverage.py:1969test/test_dashboard_updates_coverage_streams.py:410await asyncio.sleep(0.01)test/test_dashboard_updates_coverage.py:1991test/test_dashboard_updates_coverage_streams.py:416monkeypatch.setattr(asyncio, "wait_for", _no_waiting)test/test_dashboard_updates_coverage.py:1995test/test_dashboard_updates_coverage_streams.py:424await tasktest/test_dashboard_updates_coverage.py:2002test/test_dashboard_updates_coverage_streams.py:498monkeypatch.setattr(sc, "_counts_cache_ts", time.monotonic())test/test_dashboard_updates_coverage.py:2073test/test_dashboard_updates_coverage_streams.py:770resp = await tasktest/test_dashboard_updates_coverage.py:2344test/taskq_runner_adapter_helpers.py:37await asyncio.sleep(0)test/test_taskq_runner_adapter.py:46test/test_taskq_runner_adapter_durability.py:532live = await parked # the slot freed and the live admission claimed ittest/test_taskq_runner_adapter.py:2035test/test_taskq_runner_adapter_durability.py:610await waittest/test_taskq_runner_adapter.py:2112test/test_taskq_runner_adapter_durability.py:863await waittest/test_taskq_runner_adapter.py:2364test/mcp_gatewayd_coverage_helpers.py:45await asyncio.sleep(3600)test/test_mcp_gatewayd_coverage.py:68test/mcp_gatewayd_coverage_helpers.py:77now = time.monotonic()test/test_mcp_gatewayd_coverage.py:112test/mcp_gatewayd_coverage_helpers.py:104await tasktest/test_mcp_gatewayd_coverage.py:138test/test_mcp_gatewayd_coverage_acquire_respawn.py:253old_task = asyncio.create_task(asyncio.Event().wait())test/test_mcp_gatewayd_coverage.py:1242test/test_mcp_gatewayd_coverage_acquire_respawn.py:255await asyncio.sleep(0)test/test_mcp_gatewayd_coverage.py:1243Diff alignment (L36): for every changed file,
git diff BASE -- <file>andgit diff --minimal BASE -- <file>give the same added/deleted counts: dashboard 17/1484, chat mirror 21/970, taskq 19/1004, gatewayd 18/1059, line-cap baseline 0/4, taskq.md 7/7, taskrunner.md 1/1, testing-conventions.md 1/1, mcp-gateway-backend-replacement.md 1/1, test_mcp_tool_surface.py 1/1, test_runner_facade.py 1/1, test_mcp_launch_approval_gateway.py 1/0, and each new file only added lines.Logger names (L25): no new module defines a logger;
_RUNNER_LOGGERis the string"kiro_crew.taskq.adapters.runner", unchanged.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: ...)