Skip to content

test: split four test files just over the line cap into topic modules - #21472

Merged
bolichen97 merged 1 commit into
mainfrom
refactor/linecap-t91-test-discord-resumed-busy
Oct 18, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
refactor/linecap-t91-test-discord-resumed-busy

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bring four test files that sit just over the 2,000-line cap under it by moving their tests, unchanged, into topic modules.

test_discord_resumed_busy.py (2,026 lines), test_push_branch_gate.py (2,016), test_vector_memory_coverage.py (2,016) and test_steer_requeue.py (2,015) are each over the repository's 2,000-line limit for a hand-written file, so each has a row in .github/file-line-cap-baseline.txt.

Why it matters

The cap holds only once the files already over it come under it. Until then, every new test for the Discord hand-off, the push gate, vector memory or the steer requeue lands in a file that is already over and grows it.

Not a goal

  • Changing what any test asserts, or rewriting a test.
  • De-flaking the pre-existing timing shapes the move carries. They are marked and tracked; see Related Issues.
  • Reformatting the kept test_vector_memory_coverage.py. It stays in .github/black-baseline.txt.
  • Touching product code.

What changed (motivation → approach → change)

Each file has to shrink without losing or changing a test, and without making CI's added-line gates re-judge code that did not move. So each original keeps one unbroken run of its own units, and a contiguous block of whole units moves, verbatim, into one sibling module named for what it tests. Module-level helpers that both halves read move to a *_helpers.py module, and each half imports only the names it reads. Shared fixtures are bound by name in each module (_isolated_home = discord_resumed_busy_helpers._isolated_home), the way test_discord_sessions.py already shares its own, so every fixture keeps its name and pytest registers it per module.

File Lines Tests What it pins
test_discord_resumed_busy.py 786 32 the routing decision: steer or queue into the busy dashboard slot, the audience fence, the refusals
test_discord_resumed_busy_after_handoff.py 1,256 44 the hand-off's later life: drop notices and their addresses, the fence bound, cancellation, directive origin, close races, the live queue's bound
discord_resumed_busy_helpers.py 69 – the bound-to-a-busy-dashboard builder, the steerable client, the refusal and redaction strings, the autouse home
test_push_branch_gate.py 1,342 101 the gate's answers: allow, deny, option readings, the enforcement point and its audits
test_push_branch_gate_parser.py 690 26 the parser under it: branch table, tokenizer contract, substitution boundary, quote model, nested payloads
test_vector_memory_coverage.py 971 89 migration, degraded input, backfills, import and export, episodic paths
test_vector_memory_coverage_vector_space.py 1,041 72 its "Additional coverage" section: vector-space lifecycle, lesson dedup, ranking
vector_memory_coverage_helpers.py 57 – the store and embedder builders and raw-row readers
test_steer_requeue.py 1,360 44 tracking and requeue of unconsumed steers, the row's lifecycle state, codex peer steers
test_steer_requeue_entry_meta.py 675 16 what a requeued steer carries on its entry and row: delivery id, send id, decision receipt; hard kill
steer_requeue_helpers.py 28 – the SEL patch fixture and the mid-turn slot

The three helper modules are under 150 lines because they hold only what both halves of one suite share.

TestSteerLifecycleState stays in test_steer_requeue.py: it holds an AWS example key id other than AKIAIOSFODNN7EXAMPLE, which the internal content scan would read as an added line if it moved.

Edits that are not moves

  • Docstrings. Each kept file's module docstring gains one closing paragraph naming its sibling; each new file has its own.
  • Two positional references in moved code. In test_steer_requeue_entry_meta.py, the TestSendIdMapLifecycle docstring said the other pop sites are "pinned above", and one comment cited "the ordering test above". Both tests stay in test_steer_requeue.py, so both now name that module.
  • One moved comment reworded. In discord_resumed_busy_helpers.py, "the refusal every case below either avoids or keeps" names the suites, since that module holds no cases.
  • Own-line marker comments. # nosemgrep: kirocrew.test-autouse-shared-monkeypatch is added on the moved autouse _isolated_home. No module of that family calls monkeypatch.undo(). # flake-ok: is added above six moved unbounded awaits and one zero-delay yield loop in test_discord_resumed_busy_after_handoff.py.
  • Formatting. The new files are black-formatted. That re-wraps lines only in the code moved out of test_vector_memory_coverage.py, whose origin is black-baselined; the AST is unchanged.
  • Rows and citations.
    • The four line-cap baseline rows are deleted.
    • learn-cron-dashboard.md names test_steer_requeue_entry_meta.py as the home of the requeue sendId tests.

Move audit

test/test_discord_resumed_busy.py: 2026 -> 786 lines; moved 99.04% (python-ast)
   changed: Expr [Expr] 17 lines
test/test_push_branch_gate.py: 2016 -> 1342 lines; moved 99.07% (python-ast)
   changed: Expr [Expr] 18 lines
test/test_vector_memory_coverage.py: 2016 -> 971 lines; moved 99.36% (python-ast)
   changed: Expr [Expr] 12 lines
test/test_steer_requeue.py: 2015 -> 1360 lines; moved 98.6% (python-ast)
   changed: Expr [Expr] 17 lines
   changed: TestSendIdMapLifecycle.Expr [Expr] 10 lines
  • The Expr units are the module docstrings; TestSendIdMapLifecycle.Expr is that class's docstring, with the one-line re-point above.
  • Every test function and every helper is AST-identical at HEAD. Marker comments do not change the AST.

L36 diff parity: for every changed file, git diff and git diff --minimal add and delete the same number of lines. For the originals that is +20/-1260, +4/-678, +15/-1060 and +11/-666 both ways; every new file is +N/-0.

Backwards compatibility

Compatible: no product behaviour changes. Every test keeps its name, class, parameters, markers and fixtures. No other test module imports from the four originals.

Removes nothing: the change moves tests between files; no product function, path or key is removed.

Tests

  • Collected multiset. Collected at BASE (424 tests in four files) and at HEAD (424 across eight), the (class, name, params) multiset is identical.
  • Markers and fixtures. For every one of the 424 tests, the marker list and the full fixture closure (item.fixturenames, autouse included) are identical at BASE and HEAD.
  • Runs. The eight modules pass 424/424 in 5 runs at -n0. The backend related set from local-gate --dry-run (17 files, test_security.py included) passes at -n0.
  • Guards. test_flake_pattern_ratchet.py (against the merge-base), test_wait_discipline_ratchet.py, test_source_pin_budget.py, test_file_line_cap.py, test_nodeid_length_guard.py, test_leaf_test_scope.py and test_cwd_relative_repo_reads_gate.py pass. The budget row for test_steer_requeue.py is unchanged, because its four source reads stay there.
  • Local gate. scripts/local-gate.py --dry-run selects 17 backend test files and 367 cross-surface frontend specs. No website/ file changes and no spec reads these test files, so the backend set ran.
  • Other checks, all clean: isort, flake8, the black gate, the subprocess-encoding gate, check_file_line_cap.py (0 failures), docs-lint, the comment-history, brand and harness-parity gates, and semgrep 1.78 with CI's configs and --baseline-commit (0 findings, 0 parse errors).

Manual verification

N/A — test-only move; the collection, fixture and marker proofs above cover 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

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 17, 2026 04:51
@bolichen97
bolichen97 requested a review from buluoray October 17, 2026 04:51
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

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

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision c653c0ae1ab57caee5282f2f90ed29b105a92c94 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 github-actions Bot added the readiness: checking Automated validation is still running label Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] c653c0a

Description read

[DESCRIPTION-READ] 3f84134f699497867539766271123d36be5ef65e2ac649d204c72191082bf628

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

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] c653c0a

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

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

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c653c0a

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

@bolichen97
bolichen97 enabled auto-merge (squash) October 17, 2026 05:05
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 17, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-t91-test-discord-resumed-busy branch from c0e451a to 07ce572 Compare October 17, 2026 11:19
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in .github/file-line-cap-baseline.txt since this head went green (23affa7 -> 5682590); CI re-running.

The only conflict was in other changes' rows of the line-cap baseline. It resolves to main's rows minus this PR's four. Outside that file, the patch is identical to the previous head (git patch-id --stable unchanged), and every AI lane passed on the previous head c0e451aaa5.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 17, 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.

Tier 1 auto-approve: test (13 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 test files just over the line cap into topic modules with shared helpers; the spec edit only renames a test reference. 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/system-specs/modules/learn-cron-dashboard.md.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 17, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-t91-test-discord-resumed-busy branch from 07ce572 to 3735729 Compare October 17, 2026 17:49
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in .github/file-line-cap-baseline.txt since this head went green (5682590 -> 4b066e0); CI re-running.

The only conflict was in other changes' rows of the line-cap baseline. It resolves to main's rows minus this PR's four. Outside that file the patch is identical to the previous head 07ce572be2 (git patch-id --stable unchanged), and every AI lane passed on the previous head.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 17, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-t91-test-discord-resumed-busy branch from 3735729 to cd0def2 Compare October 18, 2026 07:00
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main 9d088c8 after #21640 fixed the shard-7 facade-scan timeout (main moved from 4b066e0); CI re-running.

The rebase had no conflicts. The patch is identical to the previous head 3735729fa8 (git patch-id --stable unchanged), and the only change at that head was the main-side Backend Tests (3.12, 7) timeout, tracked on #21441.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 18, 2026
test_discord_resumed_busy.py, test_push_branch_gate.py,
test_vector_memory_coverage.py and test_steer_requeue.py were each
just over the 2,000-line cap. Each keeps one contiguous run of its
units, and a contiguous block of whole units moves verbatim into one
sibling module named for what it tests. Helpers both halves read move
to a *_helpers.py module, and shared fixtures are bound by name in
each module, so every test keeps its name, parameters, markers and
fixture closure (424 tests, identical multiset).

The four line-cap baseline rows are deleted, and the spec citation of
the requeue sendId tests names their new module.

Part of #20192
@bolichen97
bolichen97 force-pushed the refactor/linecap-t91-test-discord-resumed-busy branch from cd0def2 to c653c0a Compare October 18, 2026 11:17
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main 924c159 after #21792 fixed the frozen history-bindings inventory (main moved from 9d088c8); CI re-running.

The only conflict was other changes' rows in .github/file-line-cap-baseline.txt. It resolves to main's rows minus this PR's four. Outside that file the patch is identical to the previous head cd0def220d (git patch-id --stable unchanged). The only reds at that head were Backend Tests (3.12, 1) and (Windows) (1) on test_history_bindings.py, plus Coverage Gate.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 18, 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.

Tier 1 auto-approve: test (13 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: test-only split of four test files just over the line cap into topic modules and helpers; 171 test functions removed and re-added. 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/system-specs/modules/learn-cron-dashboard.md.

@bolichen97
bolichen97 merged commit b136617 into main Oct 18, 2026
104 checks passed
@bolichen97
bolichen97 deleted the refactor/linecap-t91-test-discord-resumed-busy branch October 18, 2026 13:27
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants