Repository navigation
test: retire native-chat cases their fixtures or predicates neutralize - #23968
Conversation
…es neutralize
Semantic sweep of renderer sidebar, right-sidebar and native-chat. 10 cases
removed across 6 files; one test-only production re-export removed.
Two new shapes here, both of which make a case unable to fail:
A fixture that neutralizes its own variation. `NativeChatNoticeRow`'s
`old-reader compatibility` table had six rows, but the test's own
`oldStatusSchema.omit({tone, presentation})` strips the metadata being varied, so
all six render the identical body `{kind:'status', text:'…'}`. Its
schema-acceptance half is owned case-for-case at
`agent-session-journal-schemas.test.ts:310-318`.
A fixture that makes the distinction its name claims impossible. "Counts a new
turn from its stamp, not a row held open by background work" set `turnStartedAt`
and `mainAgent.stateStartedAt` to the same `now - 5_000`, so it could not tell the
two links apart; `native-chat-terminal-turn.test.ts:75` owns the real version.
Also removed: two cases varying `stateHistory`, which no native-chat production
file reads (`NativeChatHookTurnEntry` omits it); the `agent-session` row of a
transport table whose guard is `valueSource === 'dispatched' && transport ===
'catalog'`, so under `reported` the transport is never consulted — the `catalog`
row stays as the only test of the non-dispatched arm; `openclaude` from an
`it.each` where the only agent test on that path is `args.agent === 'codex'`, so
both agents take the identical arm.
Production change: `NativeChatMessageList.tsx` no longer re-exports
`ProviderFrameRow`. That export existed only for
`NativeChatMessageList.provider-frame.test.tsx`; both production callers
(`NativeChatNoticeRow.tsx:9`, `NativeChatMessageRow.tsx:24`) already import it
from `NativeChatTranscriptChrome` directly, so the test now does too.
Kept where the call site differs though the assertions match: a dispatched-pill
tooltip case and a transport-hedge case hit `NativeChatSessionOptionPickers.tsx:278`
(model pill) versus `:302` (options pill). Kept as live branches: the
`lifecycle === null || lifecycle === 'published'` disjuncts, the four distinct
wirings in `native-chat-reader-scroll-input.ts:33-46`, and a ring case that is the
only one reaching the module's own keydown listener, because the sibling's click
path already runs `dropPendingHover`.
Reverses my own restore of `native-chat-assembler-merge-parity.test.ts`. I kept it believing it was a live cross-implementation differential oracle; it is not. `native-chat-session-assembler.ts:233` documents the gate: the `turnKey` fallback "only merges a candidate against an existing message of a DIFFERENT source (#10)". The test passes `sources: { transcript }` — a single source — so that fallback is gated off, the assembler reduces to id-dedup-and-append, and it equals the mobile id-only merge by construction. The assertion is identity === identity. Both contracts it nominally covered are owned directly, by tests asserting concrete values rather than comparing two implementations that degenerate to the same operation: identical same-source prompts surviving at `native-chat-session-assembler.test.ts:328` and `:354` (both citing #10), and id-append order at `mobile/src/session/mobile-native-chat-merge.test.ts:18`. The lesson generalizes: a differential is only worth keeping if the two implementations can actually diverge on the fixture used. Check that the fixture reaches the code that differs.
|
Comments Outside DiffThese findings could not be posted inline.
|
There was a problem hiding this comment.
ℹ️ No critical issues — one coverage gap and one rationale correction, both minor.
Reviewed changes
- Removed ~25 redundant/non-differentiating cases across 16 renderer test files (+27 / −394) in
src/renderer/src/components/native-chat/. - Fixtures that neutralize their own variation —
NativeChatNoticeRow's.omit({tone, presentation})6-row table,NativeChatResolvedView's turn-stamp case with equalturnStartedAt/mainAgent.stateStartedAt, and narrowedit.each/describe.eachaxes (openclaude,agent-session,usageLimited, claude/codex). - Inputs production never reads —
stateHistoryvariations;NativeChatHookTurnEntrystructurally omits the field. - Test-only production re-export removed —
ProviderFrameRowfromNativeChatMessageList.tsx; both production callers already import it fromNativeChatTranscriptChrome. native-chat-assembler-merge-parity.test.tsdeleted as a degenerate differential (second commit,046d88f).
I verified each removal against a surviving owner (details in the summary snapshot). All are redundant or non-differentiating except the one inline finding below. Changed-file lint (oxlint over the 17 locally-present changed files) is clean, so no dangling imports.
ℹ️ The deleted parity test could fail after all — the deletion is still safe, but the rationale overstates it
The current body's "the assertion is identity === identity and cannot fail" is not quite right. On the single-source fixture the cross-source turnKey fallback is indeed gated off (native-chat-session-assembler.ts:253 requires a different source), but that does not make the test unfailable: remove that source gate and u2 collapses into u1, so the assembler returns 3 ids while the id-only merge returns 4 and toEqual fails. Deleting it is still correct, because the same-source gate it exercises is independently pinned by concrete-value assertions at native-chat-session-assembler.test.ts:351 and :375, and append order by mobile/src/session/mobile-native-chat-merge.test.ts:19. Worth correcting the write-up so "cannot fail" isn't the precedent for future *-parity deletions — a differential is only vacuous when the fixture cannot reach the code that differs, which is a narrower claim than "cannot fail".
Technical details
# Parity rationale precision
## Affected sites
- `src/renderer/src/components/native-chat/native-chat-session-assembler.ts:233,253` — cross-source `turnKey` fallback is gated on `existingByTurn.source !== message.source`.
- `src/renderer/src/components/native-chat/native-chat-session-assembler.test.ts:351,375` — `['u-1','u-2']` concrete-value assertions that already pin identical same-source prompts surviving.
- `mobile/src/session/mobile-native-chat-merge.test.ts:18-19` — id-append order pinned on the `mergeNativeChatMessages` wrapper.
## Required outcome
- No code change required. If the invariant "mobile single-source ≡ assembler fallback" is meant to be guarded, a future fixture must use interleaved/unordered or multi-source input so the two implementations can diverge.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| it('keeps the same glyph in every state, so a settling row never changes identity', () => { | ||
| const states: NativeChatSubagentState[] = [ | ||
| 'working', | ||
| 'idle', | ||
| 'completed', | ||
| 'failed', | ||
| 'stopped', | ||
| 'unverifiable' | ||
| ] | ||
|
|
||
| for (const state of states) { | ||
| const { container } = render( | ||
| <NativeChatSubagentRun block={group([{ id: 'a', label: 'read', state }])} /> | ||
| ) | ||
|
|
||
| expect(container.querySelectorAll('.lucide-bot')).toHaveLength(1) | ||
| expect(container.querySelector('.lucide-check')).toBeNull() | ||
| expect(container.querySelector('.lucide-users')).toBeNull() | ||
| cleanup() | ||
| } | ||
| }) |
There was a problem hiding this comment.
This removed case was not neutralized by its own fixture — it varied state across all six NativeChatSubagentState values and asserted the SubagentGlyph contract documented at NativeChatSubagentRun.tsx:95-103 ("fixed across every state — a settling row must not appear to change identity"). The only surviving glyph assertion pins the working state (NativeChatSubagentRun.test.tsx:97-107), so a state-dependent glyph would now regress silently for the other five states.
Technical details
# Cross-state glyph identity no longer covered
## Affected sites
- `NativeChatSubagentRun.test.tsx:142-162` (deleted) — looped every `NativeChatSubagentState`, asserting exactly one `.lucide-bot` and no `.lucide-check`/`.lucide-users`.
- `NativeChatSubagentRun.test.tsx:97-107` — sole surviving glyph test; covers `working` only.
- `NativeChatSubagentRun.tsx:104-110` — `SubagentGlyph` takes no state today; the doc at `:95-103` commits to invariance and names a future swap point (the shared category-icon component, PR #18760).
## Required outcome
- Either keep the deleted cross-state case, or extend the surviving glyph test to loop over states, so the documented invariance stays pinned.
## Open questions for the human
- Is the cross-state glyph invariant still wanted once the shared category-icon component lands?|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThe pull request narrows or removes tests across native-chat transcript, session, UI control, and Claude terminal coverage. It also changes the Priority: ⬇️ Low Merge Risk: 🔵 Low · up to The changes remove useful regression checks for transcript ordering and usage-limited goal controls. Restoring those cases is recommended; the demonstrated risk is limited to reduced coverage, not broken runtime behavior. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/renderer/src/components/native-chat/NativeChatThreadGoalBanner.test.tsx (1)
84-84: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep coverage for resuming a usage-limited goal.
The
usageLimitedstatus maps toactiveand should display theGoal limitedlabel with a Resume action. The remaining banner tests do not render ausageLimitedgoal. The shared contract test checks only the status mapping, not the banner behavior. Add a banner case that asserts the label and Resume action.src/renderer/src/components/native-chat/NativeChatMessageList.queued-turn-order.test.tsx (1)
121-121: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep coverage for hosts without
turnScope.The no-scope path is supported behavior. The remaining test does not assert its interleaved DOM ordering. Restore the removed case.
Suggested fix
-describe.each([['states each row’s turn', true]])( +describe.each([ + ['states each row’s turn', true], + ['states no scope', false] +])(
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 370032a8-7970-4171-88d1-774c1b527544
📒 Files selected for processing (18)
src/renderer/src/components/native-chat/NativeChatComposer.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.provider-frame.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.queued-turn-order.test.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.tsxsrc/renderer/src/components/native-chat/NativeChatMessageList.turn-indicator.test.tsxsrc/renderer/src/components/native-chat/NativeChatNoticeRow.test.tsxsrc/renderer/src/components/native-chat/NativeChatResolvedView.turn-status.test.tsxsrc/renderer/src/components/native-chat/NativeChatSessionOptionPickers.test.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSessionStatus.test.tsxsrc/renderer/src/components/native-chat/NativeChatSubagentRun.test.tsxsrc/renderer/src/components/native-chat/NativeChatTaskList.test.tsxsrc/renderer/src/components/native-chat/NativeChatThreadGoalBanner.test.tsxsrc/renderer/src/components/native-chat/NativeChatView.test.tsxsrc/renderer/src/components/native-chat/claude-model-switch-confirmation.test.tssrc/renderer/src/components/native-chat/claude-terminal-session-options.test.tssrc/renderer/src/components/native-chat/native-chat-active-rail-item.test.tssrc/renderer/src/components/native-chat/native-chat-assembler-merge-parity.test.ts
💤 Files with no reviewable changes (11)
- src/renderer/src/components/native-chat/native-chat-assembler-merge-parity.test.ts
- src/renderer/src/components/native-chat/NativeChatMessageList.turn-indicator.test.tsx
- src/renderer/src/components/native-chat/NativeChatMessageList.tsx
- src/renderer/src/components/native-chat/claude-terminal-session-options.test.ts
- src/renderer/src/components/native-chat/NativeChatTaskList.test.tsx
- src/renderer/src/components/native-chat/NativeChatStructuredSessionStatus.test.tsx
- src/renderer/src/components/native-chat/NativeChatView.test.tsx
- src/renderer/src/components/native-chat/NativeChatResolvedView.turn-status.test.tsx
- src/renderer/src/components/native-chat/NativeChatNoticeRow.test.tsx
- src/renderer/src/components/native-chat/native-chat-active-rail-item.test.ts
- src/renderer/src/components/native-chat/claude-model-switch-confirmation.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

ELI5
Two of the tests removed here could never fail — not because of a timing bug, but because the test's own setup destroyed the thing it was checking.
One had a six-row table varying
toneandpresentation, then called.omit({tone, presentation})on its own schema before rendering. All six rows produced the identical output. The other was named "counts a new turn from its stamp, not a row held open by background work" — and set both timestamps to the same value, so it could not tell the two apart.What Changed
−394 lines across 17 files. 10 cases removed, plus one test-only production re-export.
Fixtures that neutralize their own variation
NativeChatNoticeRowold-reader compatibility(6-rowit.each) — the test's ownoldStatusSchema.omit({tone, presentation})strips the varied metadata, so every row renders{kind:'status', text:'…'}. The schema-acceptance half is owned case-for-case atagent-session-journal-schemas.test.ts:310-318; the untinted-unknown rendering by the sibling that stays.NativeChatResolvedView"counts a new turn from its stamp, not a row held open by background work" —turnStartedAtandmainAgent.stateStartedAtboth set tonow - 5_000, so the contrast in the name is unreachable.native-chat-terminal-turn.test.ts:75owns the real version.Varying an input the production path never reads
stateHistory, which no native-chat production file reads —NativeChatHookTurnEntryomits the field entirely.agent-sessionrow of "does not hedge a reported value on the %s transport" — the guard isvalueSource === 'dispatched' && transport === 'catalog'(shared/native-chat-session-options.ts:67), so underreportedthe transport is never consulted. Thecatalogrow stays: it is the only test of the non-dispatchedarm, since the shared test atnative-chat-session-option-snapshot.test.ts:48only feedsdispatcheddescriptors.openclaudefromit.each(['claude','openclaude'])— the only agent test on that path isargs.agent === 'codex'(use-native-chat-pty-composer-send.ts:70), so both take the identical arm. The aliasing itself is owned atshared/native-chat-agent-support.test.ts:11.A test-only production export removed
NativeChatMessageList.tsxno longer re-exportsProviderFrameRow. That export existed solely forNativeChatMessageList.provider-frame.test.tsx; both production callers (NativeChatNoticeRow.tsx:9,NativeChatMessageRow.tsx:24) already import it fromNativeChatTranscriptChromedirectly, so the test now does too.A deletion I reversed, then un-reversed — and the lesson in it
I restored
native-chat-assembler-merge-parity.test.tsafter an auditor deleted it, arguing it was a live cross-implementation differential oracle rather than the copied-parity junk an earlier PR in this series cleared ~40 of. The auditor pushed back with a better argument and was right, so it is deleted again.Why my reasoning failed: I checked that the assembler still does cross-source
turnKeywork, but not whether the test's own fixture ever reaches it. It does not.native-chat-session-assembler.ts:233documents the gate explicitly — the fallback "only merges a candidate against an existing message of a DIFFERENT source (#10)" — and the test passessources: { transcript }, a single source. So the fallback is gated off, the assembler reduces to id-dedup-and-append, and it equals the mobile id-only merge by construction. The assertion isidentity === identityand cannot fail.My second argument was also weaker than it looked.
mergeNativeChatMessagesWithhaving no other test consumer is true of that exact symbol, but the mobile merge contract is covered throughmergeNativeChatMessagesatmobile/src/session/mobile-native-chat-merge.test.ts:18.Both contracts the file nominally covered are owned directly, by tests asserting concrete values instead of comparing two implementations that degenerate to the same operation:
native-chat-session-assembler.test.ts:328and:354, both citing Add card gap and quick-create in worktree dialog #10;mobile-native-chat-merge.test.ts:18.The refined rule:
*-parity.test.tsdoes split two ways, and the filename tells you nothing — but "it is a differential oracle" is not by itself a reason to keep one. A differential is only valuable if the two implementations can actually diverge on the fixture used. A differential over an input where both sides degenerate to the same operation is as vacuous as a self-comparison.Why
Measured across this audit: 146 junk cases from 360 files read by semantic sweep, against 2 from 36 for the best mechanical detector.
Yield is falling in this area, and that is the finding rather than a problem. One batch returned 2 cases from 20 files (10%) against ~45% elsewhere — and its keeps show why: four
rail-history-jumprows map 1:1 onto four distinct wirings innative-chat-reader-scroll-input.ts:33-46in a module with no test of its own; fiveNativeChatEmptyStatecases map onto distinct arms of aretryingLine ?? words.message ?? defaultchain. Well-factored tests over well-factored code produce few duplicates.Keeps where assertions match but the call site differs: a dispatched-pill tooltip case and a transport-hedge case hit
NativeChatSessionOptionPickers.tsx:278(model pill) versus:302(options pill). And a context-ring Escape case was kept because the sibling's click path already runsdropPendingHover(NativeChatContextUsageRing.tsx:51), making this the only case that reaches the module's own keydown listener at lines 59-64.Linked Issue
N/A — test-suite hygiene, no pre-existing issue.
Visual Proof
N/A — the only production change removes an unused re-export.
Testing
Verified locally on macOS after committing and rebasing onto current main:
pnpm run typecheck— clean, afterrm -f config/tsconfig.*.tsbuildinfo. This is the check that validates the removed re-export.node config/scripts/check-reliability-gates.mjs— passes, 140 gates.pnpm run check:code-quality:changed— passes, 0 findings.Not run locally: e2e and the Windows/Linux/SSH jobs — left to CI.
Removal-only; no new tests.
Review
Adversarial review on the reasoning: each claim cites the production line, so they are checkable directly. The two "fixture neutralizes itself" claims are the most interesting to confirm, and the restored differential oracle is worth a second opinion on whether it should stay restored.
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
:has(+[attr])selectors was kept: it cross-checks that the attribute named in each selector exists on the adjacent element, which no type checker and no happy-dom layout can see.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)