Repository navigation
test: retire private-predicate duplicates in the renderer - #23945
Conversation
Fifth audit wave, renderer-scoped. Same shape as #23941: delete private-predicate cases whose behavior is already asserted through the module's real entry point, then make the symbol module-private again. Two whole files went as provider-local replays: `terminal-paste-payload-metadata` (same corpus, same inputs, same expectations as `lib/paste-payload-metadata`, just renamed symbols) and `repro-8784-ghe-avatar-fallback` (every case now asserted through the rendered component in `github-user-avatar.test.tsx`). Dead production code removed where tests were its only callers: `resolveImeModifierGesture`, `isCodexTerminalStartupCommand` (its codex branches are covered by `isKnownTuiAgentTerminalStartupCommand`), `reconcileSelectionKeys` (superseded by `reconcileSourceControlSelectionState`, which the hook calls), and `chatFontScaleShortcutLabels` (nothing renders those labels). Roughly three quarters of the flagged modules were detector false positives and were left untouched; the scanner cannot see re-export barrels, `.web.ts` platform variants, build-time overrides, or `*ForTests` inspection seams. `accumulateWorkItemPages` is deliberately NOT deleted despite having only test callers. It, the dead `filesystem-directory-listing-limit` module, and `resolveImeModifierGesture` all landed unwired in the same refactor (#16177), and unwired page accumulation is more likely a lost wiring step than dead weight. Deleting it would erase that evidence.
|
| } | ||
|
|
||
| export function getRuntimeProjectRefreshEnvironmentIds(args: { | ||
| function getRuntimeProjectRefreshEnvironmentIds(args: { |
There was a problem hiding this comment.
Reachable-only refresh coverage lost The removed selector test checked that a runtime gets a project refresh when it becomes reachable but was already desired. The surviving subscriber test checks a runtime becoming desired and reachable together. Please retain the reachable-only case through the subscriber so a future change cannot silently leave that runtime’s projects stale.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| import { cn } from '@/lib/utils' | ||
|
|
||
| export function githubAvatarUrl(login: string): string { | ||
| function githubAvatarUrl(login: string): string { |
There was a problem hiding this comment.
Whitespace avatar cases untested Deleting the GHE regression test removes checks for whitespace-only avatar URLs and logins. The remaining component tests cover a missing URL and an empty login, but not these inputs. Please test both through
GitHubUserAvatar so a future change cannot create a bogus image request instead of showing the login fallback or initials.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
ℹ️ No critical issues — one minor coverage gap.
Reviewed changes
- Deleted two duplicate test files —
terminal-paste-payload-metadata.test.ts(replayed thelib/paste-payload-metadata.test.tscorpus) andrepro-8784-ghe-avatar-fallback.test.ts(GHE avatar cases moved togithub-user-avatar.test.tsx). - Removed dead production symbols with zero non-test callers —
resolveImeModifierGesture(+ its event type),isCodexTerminalStartupCommand,reconcileSelectionKeys,chatFontScaleShortcutLabels(+ its now-unusedisMacPlatformimport),getLineageEffectiveChildStart, and three unused re-export aliases interminal-paste-payload-metadata.ts. - De-exported helpers still used within their own module — the six
is*QueryTooLargepredicates,clampChatFontScale,githubAvatarUrl,getTerminalStartupCommandToken,findLargeTextControlPasteTarget,resolveModifierRouting,getAiVaultResumePlatform,getSetupGuideStepSection, and the three runtime-environment set-difference selectors. - Dropped the matching direct-helper tests, relying on the public entrypoints (
openHttpLink,filter*/get*State, the store subscriber,GitHubUserAvatar, etc.).
I re-verified the removal claims independently: no de-exported or deleted symbol has a remaining cross-module reference (including mobile/), the resolveModifierRouting matrix is byte-equivalent to http-link-routing.test.ts:612-661, the runtime-environment selectors are exercised through createRuntimeEnvironmentStoreSyncSubscriber, and getLineageEffectiveChildStart was introduced in d4530a8a8b with only its own test as a caller (never wired), so deleting it is consistent with the stated resolveImeModifierGesture rationale rather than a lost-wiring case. The "one immediate-parent step" invariant is still pinned at the real boundary by WorktreeList.lineage-child-real-card.test.tsx:381.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| it('trims whitespace-only avatarUrl and falls back to login.png for github.com', () => { | ||
| expect(resolveGitHubUserAvatarSrc('octocat', ' ')).toBe( | ||
| 'https://github.com/octocat.png?size=64' | ||
| ) | ||
| expect(resolveGitHubUserAvatarSrc('octocat', null)).toBe(githubAvatarUrl('octocat')) | ||
| }) | ||
|
|
||
| it('returns null when neither avatarUrl nor login is usable (no bogus request)', () => { | ||
| expect(resolveGitHubUserAvatarSrc('', '')).toBeNull() | ||
| expect(resolveGitHubUserAvatarSrc(' ', null)).toBeNull() | ||
| }) |
There was a problem hiding this comment.
The PR body says every case here is now asserted in github-user-avatar.test.tsx, but that file only covers a trimmed real URL (resolveGitHubUserAvatarSrc('u', ' https://… ')) and login === ''. The two whitespace-only branches — avatarUrl=' ' falling back to the login URL, and login=' ' returning null — are the exact cases the JSDoc calls out ("Empty/whitespace API values and empty logins never produce a bogus request"), and they lose their only assertion.
Technical details
# Whitespace-only avatar inputs lose coverage
## Affected sites
- `src/renderer/src/components/github/repro-8784-ghe-avatar-fallback.test.ts:21-31` (old) — deleted `it(...)` blocks asserting `resolveGitHubUserAvatarSrc('octocat', ' ')` and `resolveGitHubUserAvatarSrc(' ', null)`.
- `src/renderer/src/components/github/github-user-avatar.test.tsx:97-107` — replacement describe covers only a padded real URL and `''` login.
- `src/renderer/src/components/github/github-user-avatar.tsx:38-51` — `resolveGitHubUserAvatarSrc` trims both inputs; the whitespace-only collapse is the behavior in question.
## Required outcome
- The whitespace-only `avatarUrl` fallback and whitespace-only `login` → `null` stay covered after the repro file is removed.
## Suggested approach
- Add two `expect` lines to the `resolveGitHubUserAvatarSrc` describe in `github-user-avatar.test.tsx`.|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 📝 WalkthroughWalkthroughThis change narrows or removes renderer helper exports across query filtering, UI components, runtime selection, command handling, and terminal utilities. It removes related direct helper tests, while retaining several tests of filtering outcomes and command behavior. Some helper implementations remain unchanged but are now module-local; other helpers and their associated tests were removed. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The cleanup is mergeable; adding focused avatar fallback tests would preserve coverage for null and whitespace-only avatar URLs. Architecture SummaryArchitecture risk: 🟡 Medium · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
Reliability and maintainability
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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 (1)
src/renderer/src/components/github/github-user-avatar.tsx (1)
4-4: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover null and whitespace-only avatar fallbacks through
GitHubUserAvatar.The deleted regression test covered two reachable inputs that the surviving component tests do not cover. A future regression could make
GitHubUserAvatarrender initials or an incorrect image URL instead ofhttps://github.com/octocat.png?size=64. Add these cases through the component entry point rather than restoring tests for the privategithubAvatarUrlhelper.Suggested fix
it('falls back to the login URL when no avatar_url is available', () => { ;({ root, container } = render(<GitHubUserAvatar login="octocat" />)) const img = container.querySelector('img') expect(img?.getAttribute('src')).toBe('https://github.com/octocat.png?size=64') }) + it('falls back to the login URL for a whitespace-only avatar_url', () => { + ;({ root, container } = render( + <GitHubUserAvatar login="octocat" avatarUrl=" " /> + )) + const img = container.querySelector('img') + expect(img?.getAttribute('src')).toBe('https://github.com/octocat.png?size=64') + }) + + it('falls back to the login URL for a null avatar_url', () => { + ;({ root, container } = render( + <GitHubUserAvatar login="octocat" avatarUrl={null} /> + )) + const img = container.querySelector('img') + expect(img?.getAttribute('src')).toBe('https://github.com/octocat.png?size=64') + }) + it('degrades to an initials placeholder when the image fails to load (GHE 404)', () => {
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 5147d447-f0aa-4f20-8194-bc6347a055fc
📒 Files selected for processing (37)
src/renderer/src/components/github/PRFilterPickers.test.tssrc/renderer/src/components/github/PRFilterPickers.tsxsrc/renderer/src/components/github/github-mention-option-filter.test.tssrc/renderer/src/components/github/github-mention-option-filter.tssrc/renderer/src/components/github/github-pr-reviewer-candidate-filter.test.tssrc/renderer/src/components/github/github-pr-reviewer-candidate-filter.tssrc/renderer/src/components/github/github-user-avatar.tsxsrc/renderer/src/components/github/repro-8784-ghe-avatar-fallback.test.tssrc/renderer/src/components/jira-project-picker-filter.test.tssrc/renderer/src/components/jira-project-picker-filter.tssrc/renderer/src/components/native-chat/native-chat-font-scale.test.tssrc/renderer/src/components/native-chat/native-chat-font-scale.tssrc/renderer/src/components/right-sidebar/source-control/listing/use-selection.tssrc/renderer/src/components/right-sidebar/useSourceControlSelection.test.tssrc/renderer/src/components/settings/worktree-symlink-path-filter.test.tssrc/renderer/src/components/settings/worktree-symlink-path-filter.tssrc/renderer/src/components/sidebar/worktree-list/rows/indentation.test.tssrc/renderer/src/components/sidebar/worktree-list/rows/indentation.tssrc/renderer/src/components/terminal-pane/terminal-paste-payload-metadata.test.tssrc/renderer/src/components/terminal-pane/terminal-paste-payload-metadata.tssrc/renderer/src/components/terminal-pane/terminal-startup-command-classifier.test.tssrc/renderer/src/components/terminal-pane/terminal-startup-command-classifier.tssrc/renderer/src/components/workspace-cleanup/use-workspace-cleanup-row-order.test.tssrc/renderer/src/hooks/ipc-events/runtime-environment-subscription-selection.tssrc/renderer/src/hooks/useIpcEvents-runtime-environment-selectors.test.tssrc/renderer/src/lib/ai-vault-resume-command.test.tssrc/renderer/src/lib/ai-vault-resume-command.tssrc/renderer/src/lib/browser-palette-search.test.tssrc/renderer/src/lib/browser-palette-search.tssrc/renderer/src/lib/feature-education-telemetry.test.tssrc/renderer/src/lib/feature-education-telemetry.tssrc/renderer/src/lib/http-link-modifier-routing.test.tssrc/renderer/src/lib/http-link-routing.tssrc/renderer/src/lib/ime-composition-keyboard-event.test.tssrc/renderer/src/lib/ime-composition-keyboard-event.tssrc/renderer/src/lib/large-text-control-paste.test.tssrc/renderer/src/lib/large-text-control-paste.ts
💤 Files with no reviewable changes (18)
- src/renderer/src/components/right-sidebar/source-control/listing/use-selection.ts
- src/renderer/src/components/github/PRFilterPickers.test.ts
- src/renderer/src/components/right-sidebar/useSourceControlSelection.test.ts
- src/renderer/src/components/github/github-mention-option-filter.test.ts
- src/renderer/src/components/terminal-pane/terminal-paste-payload-metadata.ts
- src/renderer/src/components/sidebar/worktree-list/rows/indentation.ts
- src/renderer/src/components/settings/worktree-symlink-path-filter.test.ts
- src/renderer/src/components/terminal-pane/terminal-paste-payload-metadata.test.ts
- src/renderer/src/lib/ime-composition-keyboard-event.test.ts
- src/renderer/src/lib/ime-composition-keyboard-event.ts
- src/renderer/src/components/sidebar/worktree-list/rows/indentation.test.ts
- src/renderer/src/lib/feature-education-telemetry.test.ts
- src/renderer/src/hooks/useIpcEvents-runtime-environment-selectors.test.ts
- src/renderer/src/components/workspace-cleanup/use-workspace-cleanup-row-order.test.ts
- src/renderer/src/components/github/repro-8784-ghe-avatar-fallback.test.ts
- src/renderer/src/lib/large-text-control-paste.test.ts
- src/renderer/src/lib/browser-palette-search.test.ts
- src/renderer/src/components/native-chat/native-chat-font-scale.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Resolve ime-composition-keyboard-event conflicts with stablyai#23945: keep its removal of resolveImeModifierGesture and this branch's Enter/Escape key-gesture generalization. Co-Authored-By: Claude Opus 5.5 <[email protected]>

ELI5
Fifth batch of the test cleanup, this one all in the renderer. Removes tests that poke a private helper through a door the app itself never uses, where the same behavior is already checked through the real entry point — then closes the door.
What Changed
Nothing changes for users. 2 test files deleted, ~15 trimmed, several dead production symbols removed. −479 lines.
Two files deleted as provider-local replays:
terminal-paste-payload-metadata.test.ts— all 4 cases were the same corpus, same inputs and same expectations aslib/paste-payload-metadata.test.ts, with renamed symbols.repro-8784-ghe-avatar-fallback.test.ts— every case is now asserted through the rendered component ingithub-user-avatar.test.tsx.Dead production code removed (tests were its only callers):
resolveImeModifierGesture+ its type — never wired since it landed.isCodexTerminalStartupCommand— zero production callers; itscodex/codex-branches are covered byisKnownTuiAgentTerminalStartupCommand.reconcileSelectionKeys— superseded byreconcileSourceControlSelectionState, which the hook actually calls.chatFontScaleShortcutLabels— nothing renders those labels.terminal-paste-payload-metadata.ts; the coordinator imports only the twomeasure*aliases.De-exported (still used inside their own module):
clampChatFontScale,githubAvatarUrl,getTerminalStartupCommandToken,findLargeTextControlPasteTarget,resolveModifierRouting,getAiVaultResumePlatform,getSetupGuideStepSection, the three runtime-environment set-difference selectors, and fiveis*QueryTooLargesize predicates.The largest single trim is
describe('resolveModifierRouting')inhttp-link-modifier-routing.test.ts: all four modifier×setting combinations plus the unmodified case are already driven throughopenHttpLinkathttp-link-routing.test.ts:612-661.Why
A test that reaches a private helper through an export added only for it measures the helper, and makes that export look load-bearing to the next reader.
Roughly three quarters of the flagged modules were detector false positives and were left completely untouched. The scanner cannot see re-export barrels,
.web.tsplatform variants resolved by the bundler, build-time overrides (mobile/web-entry/web-overrides.json), or*ForTestsinspection seams. Every module was re-verified by hand before any edit. I'm stating the rate because it bounds how much to trust the detector — not the review.Alternatives considered: rewriting each private test at the real boundary is better than deleting, but it means authoring tests, which needs its own authoring-gate justification per test and does not belong in a removal PR. So: delete only where coverage already exists at the stronger boundary, and file the rest as follow-ups (below).
One deletion I reverted, and why
An auditor deleted
accumulateWorkItemPages(~150 lines: page-boundary buffering, dedupe, cancellation, with 10 dedicated cases) as dead code. It is dead — zero production callers. I restored it.Tracing it turned up a pattern: it, the dead
src/shared/filesystem-directory-listing-limit.tsmodule, andresolveImeModifierGestureall landed unwired in the same commit —07b13c846899 refactor git repository host boundaries (#16177). For pagination, "nobody calls it" is more likely a lost wiring step than dead weight, and deleting the code erases the evidence that #16177 may have dropped it. An owner should ask whether that refactor lost wiring, not whether the code is unused.resolveImeModifierGesturestays deleted — a gesture resolver is not a correctness guard and nothing suggests missing wiring.Findings escalated, not acted on
right-sidebar/checks-panel-review-creation.ts—shouldOpenChecksPanelCreateComposer(the documented gate that blocks review creation when review existence is unproven) andresolveChecksPanelHostedReviewBaseRefhave zero production callers, reachable only frommobile/src/source-control/mobile-pr-create.test.ts. Left exported and untouched. This is the second unwired fail-closed guard this audit has found.onboardingFeatureSetupRunTelemetry/onboardingFeatureSetupTelemetryFeaturehave no production caller, soonboarding_feature_setup_runandonboarding_feature_setup_toggledare never emitted — anyone reading those dashboards is reading an empty series.src/rendererpopulates theuserFieldKeysRPC param, so the wired main-side shaping (jira-issue-mutations.ts:58-63,toUserFieldValue) can never fire.getJiraUserCreateFieldKeys,isJiraUserCreateField,isJiraScalarUserCreateFieldandjira-user-picker.tsxare all callerless. Left intact — an unshipped feature, not dead weight.useSidebarResize.ts,useGlobalFileDrop.tsand the settings panes (AgentsPane,GeneralPane,PrivacyPane,QuickCommandsPane) export component internals purely for unit tests and have no render test at all;TerminalErrorToast.tsxpins ~40 cases of user-facing error copy through private helpers where only 7 component-render cases exist;agent-paste-draft.tssendBracketedPasteToRunningAgentis a zero-caller wrapper carrying 5 unique cases.Linked Issue
N/A — test-suite hygiene, no pre-existing issue.
Visual Proof
N/A — no product code path changes. Production edits remove an
exportkeyword or delete code with no non-test callers.Testing
Verified locally on macOS, after committing and rebasing (an earlier wave verified before its final commit and missed a late file — corrected process):
pnpm run typecheck— clean, afterrm -f config/tsconfig.*.tsbuildinfo.node config/scripts/check-reliability-gates.mjs— passes, 140 gates. No gate names either deleted file.pnpm run check:code-quality:changed— passes, 0 findings.rg(multi-path ripgrep silently returns zero matches in this repo — it reports exit 1 and looks exactly like "no references", which corrupted one auditor's first two sweeps).Not run locally: e2e and the Windows/Linux/SSH jobs — left to CI.
Removal-only; no new tests.
Review
Push back on any production deletion you think was premature — typecheck plus a single-path grep is strong evidence, not proof against reflective or string-keyed access. The symbols are listed by name above for that reason. Also worth a second opinion: whether
accumulateWorkItemPagesshould be restored (my call) or removed.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
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)