Repository navigation
test: split test_dashboard_chat.py, part 5 of 6 - #20834
Conversation
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
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of 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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
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.
Problem / Motivation
Goal: Move the fifth region of
test/test_dashboard_chat.pyinto 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.pystill 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
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.pygoes from 5,365 to 3,586 lines.TestRunChatTransientRetryis 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 basetest_dashboard_chat.py, except two class helpers kept at 271-283 (_record_queue_inserts) and 573-589 (_binding_failure):TestRunChatTransientRetry)test/test_dashboard_chat_transient_stream.py(new)TestRunChatTransientRetryStreamFailure: retry budget, auth and connection-drop failurestest/test_dashboard_chat_transient_binding.py(new)TestRunChatTransientRetryBindingMismatch: the preserved-thinking binding mismatchtest/test_dashboard_chat_transient_discard.py(new)TestRunChatTransientRetryImageDiscard,TestRunChatTransientRetryPoisonedDiscard: the retained-image and poisoned-conversation discardsThe topic classes reuse
TestRunChatTransientRetry's helpers throughfrom test_dashboard_chat import TestRunChatTransientRetry as _TransientSuiteand_x = _TransientSuite._xlines that keep each member's runtime kind, the shapeTestRunChatModelFallbackalready uses. The underscore alias keeps pytest from collecting the borrowed class twice.TestRunChatTransientRetrykeeps its helpers and the thinking-only retry tests, which other test files import it for.Backwards compatibility
Compatible: test-only.
test_dashboard_chat.pykeeps 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
pytest --coovertest_dashboard_chat.pyat 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 thetest_dashboard_chat_*.pyglob 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 fromTestRunChatTransientRetry:TestRunChatTransientRetryStreamFailure(15),TestRunChatTransientRetryBindingMismatch(10),TestRunChatTransientRetryImageDiscard(9) andTestRunChatTransientRetryPoisonedDiscard(8).-n0.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.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 undersrc/changes.asyncio.wait_for(..., timeout=30)), and their clocks are fakes. No moved line needs aflake-okmarker.Move audit
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.pyare imports: the moved tests tookos,ReplayFamilyandSUBAGENT_SYNTHESIS_PROMPTwith them.git diffandgit diff --minimaladd 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
.github/file-line-cap-baseline.txttest/test_dashboard_chat.pyrow lowered from 5365 to 3586TestRunChatTransientRetryImageDiscardmoves with its"/home/me/shot.bmp"test literal verbatim: the same placeholder shape has passedinternal-content-scanon 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
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)