Skip to content

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

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

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

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Move the last region of test/test_dashboard_chat.py into topic test files, every test unchanged, so the file ends under the 2,000-line cap; part 6 of 6.

After parts 1-5 (#20268, #20596, #20626, #20696, #20834), test/test_dashboard_chat.py still holds 3,586 lines, over 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. This part takes the file off the line-cap baseline, so the cap guards it from here on.

Not a goal

  • Changing any test: names, parametrization, markers, bodies and assertions move as they are.
  • Splitting the three older siblings the series did not create (test_dashboard_chat_handlers_coverage.py, _pins.py, _rewind.py).
  • Changing any production code.

What changed (motivation → approach → change)

Same recipe as parts 1-5: 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: 260 KB). test_dashboard_chat.py goes from 3,586 to 929 lines and its row leaves .github/file-line-cap-baseline.txt.

This PR deletes lines 934-3586 of this PR's base test_dashboard_chat.py (the series base's lines 24195-26845), plus the three-line "Bulk model switch" banner at 349-351, which travels with TestBulkModelSwitch:

File Classes
test/test_dashboard_chat_model_pick.py (new) TestSlotProbeWrapsSharedRestoreBody, TestBulkModelSwitch, TestSlotModelGuard
test/test_dashboard_chat_model_live_switch.py (new) TestSlotModelLiveSwitch, TestSlotModelSwitchContextBroadcast
test/test_dashboard_chat_fork_tail.py (new) TestForkSlotTail
test/test_dashboard_chat_slot.py (extended) TestSlotsGetWarmsGitLabAllowlist, TestSourceLinkUrlsExcludeIssues
test/test_dashboard_chat_session_authority.py (extended) TestSessionReload, TestCloseBroadcastDurability
test/test_dashboard_chat_unflushed_tail.py (extended) TestUnflushedTailOrderingAndSnapshot
test/test_dashboard_chat_history.py (extended) TestHistoryResumeInterruptedTurnMarker
test/test_dashboard_chat_api_chat.py (extended) TestApiChatStalledReader

Every class moves whole and keeps its name. test_dashboard_chat.py keeps three classes:

  • TestRunChatTransientRetry, with its thinking-only retry tests and the stream harness (_make_state, _wire_sessions, _client, _drain_bg) that five files reuse: the three test_dashboard_chat_transient_* siblings, test_fallback_row_attribution_8560.py and test_turn_stats.py;
  • TestAcpProcessDiedRecovery, with its two redaction tests and the harness test_dashboard_chat_provider_recovery.py reuses;
  • TestRunChatModelFallback, which other test files import.

The module docstring now names those helpers so they stay bound in the file.

Backwards compatibility

Compatible: test-only, plus four citation edits in comments and docs. test_dashboard_chat.py keeps every name another test file imports from it (_provider_mock, TestRunChatTransientRetry, TestRunChatModelFallback, TestAcpProcessDiedRecovery). 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 34 sibling test files at this head gives the same multiset of (class, test, parameters): 918 and 918. 91 node ids move file and none changes class. The 918 covers the series' 35 files; the three older siblings bring the full test_dashboard_chat*.py glob to 1,183.
  • Move audit: see below. Test bodies are AST-identical; the flake-pattern ratchet passes at -n0.
  • The 35 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 test_autonudge.py and the files whose comments this PR edits: 1,275 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. scripts/check_file_line_cap.py: 0 failures with the row removed. mypy is not re-run: no file under src/ changes.

Move audit

test/test_dashboard_chat.py: 3586 -> 929 lines; moved 96.32% (python-ast)
   changed: TestSlotProbeWrapsSharedRestoreBody [ClassDef] 116 lines
   changed: Expr [Expr] 7 lines

The changed units:

  • the module docstring, which says what the file still holds and which files reuse its helpers;
  • one docstring sentence in TestSlotProbeWrapsSharedRestoreBody. It said TestRunChatModelFallback was "above"; it now says TestRunChatModelFallback (test_dashboard_chat.py).

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

Justified edits and citations

File Edit Why
test/test_dashboard_chat_model_live_switch.py, test/test_dashboard_chat_session_authority.py own-line # flake-ok: <reason> above moved sleeps (5, with their # nosemgrep: kirocrew.test-sleep-as-barrier markers) and above the three release_*.wait() parks in TestSlotModelLiveSwitch's concurrent-pick tests the shapes are pre-existing; flake-ok is the exemption the tests-are-deterministic rule lists, and the test bodies stay AST-identical. De-flaking them is #20377
test/test_dashboard_chat_fork_tail.py own-line # nosemgrep: kirocrew.test-autouse-shared-monkeypatch above TestForkSlotTail._tail_fork_enabled the pre-existing class-local autouse default is re-reported once its file path is new
.github/file-line-cap-baseline.txt test/test_dashboard_chat.py row deleted the file ends at 929 lines, under the cap
docs/system-specs/modules/model-fallback.md cites TestSlotProbeWrapsSharedRestoreBody in test/test_dashboard_chat_model_pick.py the class moved
docs/system-specs/common/testing-conventions.md, test/conftest.py, test/test_autonudge.py name test_dashboard_chat_session_authority.py as the home of TestCloseBroadcastDurability the class moved

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

Follow-up: #20377 (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

Move the last region of test/test_dashboard_chat.py, BASE lines
24195-26845, into topic siblings: model pick (restore probe, bulk
switch, canonical-key guard), model live switch and tail fork; the
GitLab allowlist and source-link tests join
test_dashboard_chat_slot.py, reload and close broadcasts join
test_dashboard_chat_session_authority.py, the unflushed-tail ordering
tests join test_dashboard_chat_unflushed_tail.py, the history-resume
marker joins test_dashboard_chat_history.py, and the stalled-reader
tests join test_dashboard_chat_api_chat.py.

test_dashboard_chat.py ends at 929 lines: TestRunChatTransientRetry
with its shared harness, TestAcpProcessDiedRecovery's redaction tests,
and TestRunChatModelFallback, which other test files import. Test
bodies move unchanged except one docstring that names where
TestRunChatModelFallback lives; the collected tests are the same set,
and the cited locations follow the moved classes.

Part of #20192
@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 16, 2026 01:22
@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision b52921bbe884d5f00009ae8e4648fcaee8b6bd64 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

UX Review (Opus 5.5) — ⏭️ skipped

Revision b52921bbe884d5f00009ae8e4648fcaee8b6bd64 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 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] b52921b

Description read

[DESCRIPTION-READ] 9ce5410ce8a9554dc68296862906b4f7cbee38afc017984d844118e083906098

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 b52921bbe884d5f00009ae8e4648fcaee8b6bd64 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] b52921b

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

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

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] b52921b

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

@bolichen97
bolichen97 enabled auto-merge (squash) October 16, 2026 01: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 16, 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 (14 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 test/test_dashboard_chat.py into topic files; test code moved, references updated, line-cap baseline entry dropped. 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/common/testing-conventions.md, docs/system-specs/modules/model-fallback.md.

@bolichen97
bolichen97 merged commit 235ef4e into main Oct 16, 2026
101 checks passed
@bolichen97
bolichen97 deleted the refactor/linecap-t01-test-dashboard-chat-p6 branch October 16, 2026 03:04
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 16, 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