Skip to content

test: split three oversized test files by topic (part 2 of 2) - #20587

Merged
bolichen97 merged 1 commit into
mainfrom
refactor/linecap-t15-test-prompts-p2
Oct 15, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
refactor/linecap-t15-test-prompts-p2

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bring test/test_apps_registry_coverage.py under the 2,000-line cap by moving its front half into topic files, without changing a single test.

Part 1 (#20537, merged) split test/test_prompts.py and test/test_runtime_reconcile.py, and moved test/test_apps_registry_coverage.py's shared fakes and its tail half out. The file still holds 3,597 lines, almost twice the cap.

Why it matters

The maintainers' rule is that no hand-written file may exceed 2,000 lines. This file breaks it, and its topics are already separate: the registry's small gates, its manifests, where it installs from, and its build step. Splitting along those seams makes each topic findable by file name and gives each file room to grow.

Not a goal

  • Changing, renaming, fixing, de-flaking or re-parametrizing any test. Every test moves with an identical AST.
  • Changing production code. Only tests and one line-cap baseline row change.
  • Fixing the pre-existing semgrep findings that move with their tests: they are marked, not rewritten.

What changed (motivation → approach → change)

The file splits along its own section banners, by the behaviour under test. The original path keeps the build step, TestRunAppBuild. That class cannot move: the file is listed in .github/black-baseline.txt, new files must be black-clean, and black grows the class to 1,577 lines, which leaves no room for a new file's header under 1,600. Kept in place it keeps its BASE layout, and it is the original's one suffix run, so git's default diff lines it up. A recipe tool did the move from part 1's head, so it can be re-run after a rebase instead of hand-merged.

File (lines) Holds
test_apps_registry_coverage.py (3597 → 1562) the build step: _run_app_build's command selection and execution
test_apps_registry_coverage_gates.py (407) streamed log lines, the child environment, URL shape, the clone sandbox mode, trusted hosts, owner-designated repos, the SEL credential grant, the registry file and its edition rows
test_apps_registry_coverage_manifests.py (850) the manifest cache and its garbage collection, subdirectory containment, the manifest fetch, resolve / merge / enrich
test_apps_registry_coverage_provenance.py (793) candidate resolution and the index cache's provenance key, the git-provenance reader, the stale-checkout sweep, the process-group kill

Part 1's test_apps_registry_coverage_install.py, _characterization.py and apps_registry_coverage_helpers.py are unchanged; every new part imports the shared fakes from that helpers module.

Glue, the only lines whose AST or comments change:

  • The remainder's module docstring names its five siblings.
  • Three pre-existing kirocrew.test-sleep-as-barrier findings move into _provenance (TestCloneOriginUrl, and two in TestKillProcessGroup: hangs in fake processes that a patched timeout or the kill path cuts short). Each gets an own-line # nosemgrep: <rule> -- <reason> directly above it and an own-line # flake-ok: <reason>, code unchanged.
  • .github/file-line-cap-baseline.txt deletes the file's row.

Backwards compatibility

Compatible: test-only change. Every collected test keeps its class, name and parameters (the multiset is identical before and after). No other test module imports from this file. 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 checks show the move lost nothing:

Check Result
pytest --collect-only over the 6 test_apps_registry_coverage*.py files vs the file at the series' BASE 383 = 383; the (class, name, params) multiset is identical
the 6 files at -n 3 383 passed
test/test_flake_pattern_ratchet.py, test/test_wait_discipline_ratchet.py, test/test_file_line_cap.py (-n0) 211 passed
semgrep 1.78, CI configs, --baseline-commit origin/main, over the 4 changed files 0 findings; with --disable-nosem over the 3 new files exactly the 3 marked findings, and every file parses
isort / flake8 / black --check over the changed files; scripts/check_file_line_cap.py clean; 0 failures

Move audit

test/test_apps_registry_coverage.py: 3597 -> 1562 lines; moved 99.45% (python-ast)
   changed: Expr [Expr] 18 lines   (module docstring: names the five siblings)

The one changed unit is the module docstring. Every test function and class moved with an identical AST, black-formatted in its new file.

Diff alignment: the original keeps one suffix run (TestRunAppBuild) after its header, and git diff --numstat and git diff --minimal --numstat add the same lines (test_apps_registry_coverage.py 4/4). git diff origin/main...HEAD is 183,674 bytes.

Content scan: TestEnvHelpers moves ssh -i /home/me/.ssh/id_ed25519 verbatim; the same placeholder home shape (/home/u/.ssh) merged in #20166.

Logger names: no new module defines a logger.

CI path references

None: no workflow filter, explicit file list, AUTOSDE.yaml glob or sensitive-change glob names this file.

Manual verification

N/A: unit coverage is sufficient. This is a test-only move; the collected-test multiset and a full run of every moved test show it.

Related Issues

Part of #20192

Follow-up: #20383 (pre-existing shapes moved verbatim; de-flake there)

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Part 1 split test_prompts.py and test_runtime_reconcile.py and moved
test_apps_registry_coverage.py's shared fakes and its tail run into
apps_registry_coverage_helpers.py and the _install and _characterization
parts. This moves the front run: the small gates and helpers the
registry checks before it fetches (streamed log lines, the child
environment, URL shape, sandbox mode, trusted hosts, the registry file)
to _gates, the manifest cache, fetch, merge and enrichment to
_manifests, and candidate resolution, the git-provenance reader, the
stale-checkout sweep and the process-group kill to _provenance.

test_apps_registry_coverage.py keeps the build step, TestRunAppBuild
(1,562 lines). Kept in its original file it keeps its BASE layout
(the file is in .github/black-baseline.txt, and black grows the class
past what a new 1,600-line file can hold).

Every test function and class moves with an identical AST, black-
formatted in its new file. The collected (class, name, params) multiset
is identical (383 tests). Glue: the remainder's module docstring names
its five siblings; an own-line nosemgrep and flake-ok marker sits above
each of the three pre-existing sleep sites that move. The line-cap
baseline drops the file's row.

Part of #20192
@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 15, 2026 02:07
@bolichen97
bolichen97 requested a review from CrysisDeu October 15, 2026 02:07
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 0411f78d25751ecd1f83399e8006baf660b7d115 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision 0411f78d25751ecd1f83399e8006baf660b7d115 ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Advisory — does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 0411f78d25751ecd1f83399e8006baf660b7d115 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that the autouse _explicit_registry_execution_admission import in each new file does what the old single module did. Each file imports it with # noqa: F401.

[DESIGN-REVIEWED] 0411f78

Description read

[DESCRIPTION-READ] 380171129a304c47b4ab83071dd1f8bdb490d17e93cf77143d4c328514d0ef57

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 0411f78d25751ecd1f83399e8006baf660b7d115 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 0411f78

Verdict parsed from the review's SHA-scoped output markers for commit 0411f78d25751ecd1f83399e8006baf660b7d115.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 0411f78d25751ecd1f83399e8006baf660b7d115: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 0411f78d25751ecd1f83399e8006baf660b7d115 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 0411f78

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 0411f78d25751ecd1f83399e8006baf660b7d115: <one-sentence reason>

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Design PASS punchline: the autouse admission import in each new file

checked (no change needed): every new part imports _explicit_registry_execution_admission from apps_registry_coverage_helpers.py by name, so pytest registers the autouse fixture in each module exactly as the single module did; # noqa: F401 only tells flake8 the name is used by pytest, not by code.
pytest --fixtures-per-test at this head lists _explicit_registry_execution_admission in the closure of sampled tests from _gates, _manifests and _provenance (and, in part 1, _install and _characterization), the same as at the series BASE; the only closure difference is _isolate_display_verdicts, a root test/conftest.py autouse fixture main added in #19753 for every test.
All 383 collected tests pass in the six files at this head, so no part runs a registry path without the admission.

@bolichen97
bolichen97 enabled auto-merge (squash) October 15, 2026 02:35
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 15, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved after a maintainer read the review lanes on this head: all clean.

@bolichen97
bolichen97 merged commit 8d9b360 into main Oct 15, 2026
100 of 101 checks passed
@bolichen97
bolichen97 deleted the refactor/linecap-t15-test-prompts-p2 branch October 15, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants