Skip to content

test: split test_dashboard_chat.py, part 3 of 6 - #20626

Merged
bolichen97 merged 1 commit into
mainfrom
refactor/linecap-t01-test-dashboard-chat-p3
Oct 15, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
refactor/linecap-t01-test-dashboard-chat-p3

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Move the third region of test/test_dashboard_chat.py into topic test files, every test unchanged, as part 3 of the 6-PR series that brings the file under the 2,000-line cap.

After parts 1 and 2 (#20268, #20596), test/test_dashboard_chat.py still holds 10,082 lines, five times the 2,000-line cap the line-cap campaign sets for hand-written files (#20192). Every chat feature PR edits the same file, so its PRs conflict with each other and nobody can find the tests for one behaviour.

Why it matters

A test nobody can find gets duplicated or goes stale. One topic per file lets a chat PR touch only the files for the behaviour it changes, and keeps each file small enough for a reviewer to read in one pass.

Not a goal

  • Changing any test: names, parametrization, markers, bodies and assertions move as they are.
  • The rest of the file. PRs 4-6 move the TestAcpProcessDiedRecovery requeue tests with BASE lines 19620-21612, then the TestRunChatTransientRetry topic classes, then 24195-26845. Each PR is published after the one before it merges.
  • Changing any production code.

What changed (motivation → approach → change)

Same recipe as parts 1 and 2: split by behaviour under test along the file's own classes and section banners, deleting one region of test_dashboard_chat.py so git's default diff shows the move as deletions (this one: 196 KB). test_dashboard_chat.py goes from 10,082 to 7,900 lines.

This PR moves lines 37-2210 of this PR's base test_dashboard_chat.py (the series base's lines 16811-18987). The three lines it keeps inside that span are the AcpProcessDied handler section banner, which stays above TestAcpProcessDiedRecovery.

File Classes
test/test_dashboard_chat_fork.py (new) TestForkSlot
test/test_dashboard_chat_stop.py (new) TestStopReasonCancelled, TestStopTurnSlotState, TestStopHistoryBanner, TestStopDuringSessionPrep
test/test_dashboard_chat_session_meta.py (extended) TestColorTheme
test/test_dashboard_chat_prompt_prep.py (extended) TestInstalledPackConsentInjection

Every class moves whole and keeps its name. Two references follow code that moved: test/prompts_helpers.py cites TestRunChatEarlyExitHandOff in test_dashboard_chat_refusal.py, where part 2 put it. TestPinnedModelWithheld.test_every_session_teardown_drops_the_verdict also scans the chat_turn owners that the runner composes (#20526), so a session-teardown site that moves there is still checked for its model-verdict reset.

Backwards compatibility

Compatible: test-only. test_dashboard_chat.py keeps every name another test file imports from it (_provider_mock, TestRunChatTransientRetry, TestRunChatModelFallback). Node ids of moved tests change, because the file is part of the id; no expected-failure, symlink or collect-ignore list names any of them.

Removes nothing: every test moves, the 918 collected tests are the same set, and no production code changes.

Tests

  • Collection proof: pytest --co over test_dashboard_chat.py at the series base (30bb0b3) and over it plus the 26 sibling test files at this head gives the same multiset of (class, test, parameters): 918 and 918. No test changes class in this part.
  • Move audit: see below. Test bodies are AST-identical; the flake-pattern ratchet passes at -n0.
  • The teardown scan's wider reach is mutation-proven: a state.sessions.reset(...) with no verdict reset, appended to a chat_turn owner, fails the edited test and passes the old one. test_source_pin_budget.py passes with test_dashboard_chat_token_usage.py still at one source read.
  • The 27 files, the three importers and the guards that scan them (test_source_pin_budget.py, test_flake_pattern_ratchet.py, test_wait_discipline_ratchet.py, test_ci_surface_tests.py, test_leaf_test_scope.py, plus the files this PR edits): 1,213 passed at -n 3. Each new or extended file also passes alone at -n0.
  • CI's semgrep command (p/python p/typescript p/security-audit p/secrets p/owasp-top-ten semgrep/ --baseline-commit) over the changed files: clean. flake8, isort and black: clean on every touched file. mypy is not re-run: no file under src/ changes.

Move audit

test/test_dashboard_chat.py: 10082 -> 7900 lines; moved 99.92% (python-ast)
   changed: Expr [Expr] 8 lines

The one changed unit is the module docstring, which says what the file still holds.

git diff and git diff --minimal add the same lines for every changed file (test/test_dashboard_chat.py: 4 added, 2,186 deleted both ways), so no kept line shows as added.

Justified edits and citations

File Edit Why
.github/file-line-cap-baseline.txt test/test_dashboard_chat.py row lowered from 10082 to 7900 the file shrinks but stays over the cap until part 6
test/prompts_helpers.py docstring cites test/test_dashboard_chat_refusal.py::TestRunChatEarlyExitHandOff the class moved in part 2
test/test_dashboard_chat_token_usage.py the session-teardown scan also reads kiro_crew/dashboard/chat_turn/*.py, counting runner-side sites across the runner and its owners chat_runner now composes chat_turn owners (#20526); a teardown that moves there would otherwise go unchecked

CI path references

None: no workflow path filter or explicit file list names test/test_dashboard_chat.py.

Manual verification

N/A — test-only move; the collection proof and the test runs above cover it.

Related Issues

Part of #20192

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

Move BASE lines 16811-18987 of test/test_dashboard_chat.py into topic
siblings: TestForkSlot to test_dashboard_chat_fork.py and the four
stop classes to test_dashboard_chat_stop.py; TestColorTheme joins
test_dashboard_chat_session_meta.py and the installed-pack consent
tests join test_dashboard_chat_prompt_prep.py. The AcpProcessDied
section banner, which sits above the stop-during-preparation tests,
stays with TestAcpProcessDiedRecovery.

Two references follow moved code: test/prompts_helpers.py cites
TestRunChatEarlyExitHandOff in its new file, and the session-teardown
scan in test_dashboard_chat_token_usage.py also reads the chat_turn
owners the runner composes, so a teardown site that moves there is
still checked for its model-verdict reset.

Test bodies move unchanged, and the collected tests are the same set.

Part of #20192
@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 15, 2026 05:16
@bolichen97
bolichen97 requested a review from CrysisDeu October 15, 2026 05:16
@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

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision 8b8fe6bfdc8d73ef7539931b54d632fab9c122de 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 8b8fe6bfdc8d73ef7539931b54d632fab9c122de — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check one thing: the test_dashboard_chat_token_usage.py edit no longer requires a teardown site in chat_runner itself. Any site in chat_runner or a chat_turn owner now passes, so confirm that relaxing this pin is intended.

[DESIGN-REVIEWED] 8b8fe6b

Description read

[DESCRIPTION-READ] 2369226f5d578f0190b52938ffee7c3c5bd16bab721024c23f389e4c10fe1c48

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

UX Review (Opus 5.5) — ⏭️ skipped

Revision 8b8fe6bfdc8d73ef7539931b54d632fab9c122de 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

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 8b8fe6b

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

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

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 8b8fe6b

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

@bolichen97
bolichen97 enabled auto-merge (squash) October 15, 2026 05:35
@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Design punchline: the teardown scan no longer requires a site in chat_runner.py itself

rebutted (intended): since #20526 chat_runner composes the chat_turn owners on its own globals, so the turn's code is the runner plus those owners, and later stages move turn phases into owners. A pin on chat_runner.py alone would go red the day a teardown moves to an owner, with no behaviour change, and would stay blind to the moved site.
The pin's job is its universal half: every teardown site found must drop the verdict. That half now reaches every chat_turn owner. Mutant: a state.sessions.reset(...) with no verdict reset, appended to chat_turn/recovery.py, fails the new test and passes the old one.
Non-vacuity stays: at least one runner-side site across the runner and its owners, chat_handlers must still have sites, and handler sites stay >= 2, so a scan that loses sight of every runner site still fails.

@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.

Tier 1 auto-approve: test (8 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: moves dashboard chat tests from test_dashboard_chat.py into topic files, with the matching line-cap baseline drop and a test-only scan update; no source change.

@bolichen97
bolichen97 merged commit 91a02c6 into main Oct 15, 2026
101 checks passed
@bolichen97
bolichen97 deleted the refactor/linecap-t01-test-dashboard-chat-p3 branch October 15, 2026 06:47
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