t3code icon indicating copy to clipboard operation
t3code copied to clipboard

Remove dead mobile components and validation errors

Open amnesiaof opened this issue 1 month ago • 1 comments

Four things in apps/mobile have no callers. Each was checked with git grep -w across apps, packages, scripts, infra and docs, and every reference found is the definition itself.

ThreadAgentSpawnCard at apps/mobile/src/features/threads/thread-work-log.tsx:1270 is a memo component of about 55 lines with one reference, its own definition.

The StatusPill component function in apps/mobile/src/components/StatusPill.tsx is never rendered. Two files import the StatusTone type from that module, at features/connection/connectionTone.ts:1 and features/threads/ThreadDetailScreen.tsx:87, so keep the type and drop the 22-line component.

apps/mobile/src/features/threads/projectThreadCreationValidation.ts exports validateProjectThreadCreation, three error classes and a union type. The validate function's only reference is its own definition at line 55, and every error class is referenced only inside that same file. resolveProjectThreadCreationBranch in the same module is live, called from NewTaskDraftScreen.tsx:125,1011 and new-task-flow-provider.tsx:119,1133. Cutting the rest saves about 45 of the file's 71 lines.

apps/mobile/src/components/MaterialSegmentedControl.tsx is a 6-line return null stub that cannot run. SegmentedControl.tsx:14 gates on Platform.OS === "android", and Metro resolves MaterialSegmentedControl.android.tsx for Android, which holds the real Jetpack Compose control. Move the iOS control into the unsuffixed file, let the .android sibling keep overriding it, and reduce SegmentedControl.tsx to a re-export. That matches the shim pattern MaterialSwitch.tsx, MaterialNewThreadButton.tsx and CustomSnoozeSheet.tsx already follow.

isNativeReviewDiffHighlighterAvailable in apps/mobile/src/features/diffs/nativeReviewDiffHighlighter.ts has zero references repo wide.

About 135 lines.

amnesiaof avatar Oct 05 '26 16:10 amnesiaof

[!NOTE] Grok responding on behalf of Julius.

Triage

Thanks for the careful cleanup audit, @amnesiaof! Most of what you listed is unused, but a couple of items turned out to still matter, and one isn't in the tree.

What I found

  • ThreadAgentSpawnCard in apps/mobile/src/features/threads/thread-work-log.tsx has no callers, since subagent batches render through ThreadSubagentGroup. AgentSpawnSummary in apps/mobile/src/lib/threadActivity.ts is only referenced by that card. SubagentStatusDot is still used by SubagentRow.
  • StatusPill is never rendered. StatusTone has no other readers either. connectionTone only feeds a screenTone prop on ThreadDetailScreen that nothing reads, because connection status already goes through connectionFloatingStatus.
  • validateProjectThreadCreation and the ProjectThreadTaskRequiredError, ProjectThreadBaseBranchRequiredError, and ProjectThreadCreationValidationError errors are unused. NewTaskDraftScreen already blocks an empty task and a worktree with no branch before submit. resolveProjectThreadCreationBranch is still called from NewTaskDraftScreen and new-task-flow-provider.tsx.
  • isNativeReviewDiffHighlighterAvailable isn't in the current tree. apps/mobile/src/features/diffs/nativeReviewDiffHighlighter.ts is live, because useNativeReviewDiffHighlighting.ts calls highlightNativeReviewDiffVisibleRows.
  • MaterialSegmentedControl.tsx returning null is the non-Android module that Metro resolves. SegmentedControl only renders it on Android, where MaterialSegmentedControl.android.tsx is used instead. The stub body never runs, but the file has to exist for the import to resolve.

Likely fix area

  • One option is a cleanup that removes the unused card plus AgentSpawnSummary, the StatusPill / StatusTone / connectionTone / screenTone chain, and the unused validation function and errors.
  • The segmented control stub and the diff highlighter module look like they should stay. Reshaping the segmented control into platform modules would be a separate change.

A maintainer will decide on the fix direction.

juliusmarminge avatar Oct 05 '26 16:10 juliusmarminge