Skip to content

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

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

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

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

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

After parts 1-4 (#20268, #20596, #20626, #20696), test/test_dashboard_chat.py still holds 5,365 lines, over two and a half 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. Part 6 moves BASE lines 24195-26845 and brings the file under the cap. It is published after this PR merges.
  • Changing any production code.

What changed (motivation → approach → change)

Same recipe as parts 1-4: split by behaviour under test along the file's own classes, so git's default diff shows the move as deletions (this one: 170 KB). test_dashboard_chat.py goes from 5,365 to 3,586 lines.

TestRunChatTransientRetry is larger than one class may be, so four of its test groups become topic classes. This PR deletes lines 218-2024 of this PR's base test_dashboard_chat.py, except two class helpers kept at 271-283 (_record_queue_inserts) and 573-589 (_binding_failure):

File Class (carved from TestRunChatTransientRetry)
test/test_dashboard_chat_transient_stream.py (new) TestRunChatTransientRetryStreamFailure: retry budget, auth and connection-drop failures
test/test_dashboard_chat_transient_binding.py (new) TestRunChatTransientRetryBindingMismatch: the preserved-thinking binding mismatch
test/test_dashboard_chat_transient_discard.py (new) TestRunChatTransientRetryImageDiscard, TestRunChatTransientRetryPoisonedDiscard: the retained-image and poisoned-conversation discards

The topic classes reuse TestRunChatTransientRetry's helpers through from test_dashboard_chat import TestRunChatTransientRetry as _TransientSuite and _x = _TransientSuite._x lines that keep each member's runtime kind, the shape TestRunChatModelFallback already uses. The underscore alias keeps pytest from collecting the borrowed class twice. TestRunChatTransientRetry keeps its helpers and the thinking-only retry tests, which other test files import it for.

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 31 sibling test files at this head gives the same multiset of (class, test, parameters): 918 and 918, with each topic class mapped back to its source class. The 918 covers the 32 files of the series; the three older siblings the test_dashboard_chat_*.py glob also matches (_handlers_coverage, _pins, _rewind) bring the full glob to 1,183. 42 node ids change class name under the <Class><Topic> rule, all from TestRunChatTransientRetry: TestRunChatTransientRetryStreamFailure (15), TestRunChatTransientRetryBindingMismatch (10), TestRunChatTransientRetryImageDiscard (9) and TestRunChatTransientRetryPoisonedDiscard (8).
  • Move audit: see below. Test bodies are AST-identical; the flake-pattern ratchet passes at -n0.
  • The 32 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): 1,213 passed at -n 3. Each new 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.
  • Timing shapes: the moved tests' waits are bounded (asyncio.wait_for(..., timeout=30)), and their clocks are fakes. No moved line needs a flake-ok marker.

Move audit

test/test_dashboard_chat.py: 5365 -> 3586 lines; moved 100.0% (python-ast)

No unit changed. The module docstring already describes what the file holds after this part. The only lines this PR adds or edits in test_dashboard_chat.py are imports: the moved tests took os, ReplayFamily and SUBAGENT_SYNTHESIS_PROMPT with them.

git diff and git diff --minimal add the same lines for every changed file (test/test_dashboard_chat.py: 1 added, 1,780 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 5365 to 3586 the file shrinks but stays over the cap until part 6

TestRunChatTransientRetryImageDiscard moves with its "/home/me/shot.bmp" test literal verbatim: the same placeholder shape has passed internal-content-scan on merged PRs.

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

Carve four topic groups out of TestRunChatTransientRetry in
test/test_dashboard_chat.py: stream failures (retry budget, auth,
connection drops), the preserved-thinking binding mismatch, and the
retained-image and poisoned-conversation discards, into
test_dashboard_chat_transient_stream.py,
test_dashboard_chat_transient_binding.py and
test_dashboard_chat_transient_discard.py.

The topic classes reuse TestRunChatTransientRetry's helpers through an
underscore-aliased import, the shape TestRunChatModelFallback already
uses. TestRunChatTransientRetry keeps its helpers and the thinking-only
retry tests. 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 13:12
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

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

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] 980a60b

Description read

[DESCRIPTION-READ] 09c4e16bdadbf1e352a3077cb2b274776f18538da2623408f3b4258933d71aac

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

Review details

No findings.

[OPUS-REVIEWED] 980a60b

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

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

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 980a60b

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

@bolichen97
bolichen97 enabled auto-merge (squash) October 15, 2026 13: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.

Tier 1 auto-approve: test (5 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 four TestRunChatTransientRetry suites out of test/test_dashboard_chat.py into three new test files with their bodies unchanged, and lowers that file's line-cap baseline to its new length; test-only.

@bolichen97
bolichen97 merged commit c10f34a into main Oct 15, 2026
102 checks passed
@bolichen97
bolichen97 deleted the refactor/linecap-t01-test-dashboard-chat-p5 branch October 15, 2026 15:07
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 15, 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