refactor(web): ChatView's thread derivations are tested functions in ChatView.logic#23071

merged1
main
refactor/split2-chatview-logic
opened2d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 2d ago

Four render-time IIFEs were pure derivations of the thread projection. They become named functions in ChatView.logic.ts: the shell built from a directly loaded detail, pending background work, the runs a conversation can revert to, and the workspace mutation key. deriveAvailableRevertTurnCounts and deriveWorkspaceMutationId get focused tests.

BeforeAfter
ChatView.tsx lines4,1904,072

Tests: tsc-rs --noEmit for apps/web, oxlint on the changed files, vp test run src/components/ChatView.logic.test.ts, and the React Compiler coverage test for every changed file (0 bailouts). ChatView stays in the coverage test's slow set.

Part of the ChatView split (7,258 → 3,975 lines across the stack).

Opus 5.5, Claude Code.

🤖 Generated with Claude Code

Checks

All checks passed
Synced from GitHub

Approvability

Verdict: Approved at 34ef2a8

Macroscope's review found this PR approvable — This PR extracts existing ChatView derivations into tested pure helpers and rewires the same production paths to use them. The accompanying test changes are harness-only, with no new capability, schema impact, defaults change, or static-analysis suppression.

No code changes detected at 9d1b048. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 5e5c4e35-083d-4f32-9633-574eed513d04
📥 Commits

Reviewing files that changed from the base of the PR and between 34ef2a8f39c2910749e97351bf37588dbe5dcf13 and 9d1b04843931bceefe82d0296b3dd27f072b636d.

📒 Files selected for processing: 1
  • apps/web/src/components/ChatView.tsx

Limit details: You’ve used all 10 included reviews currently available.

📝 Walkthrough

ChatView now delegates thread-shell presentation, pending background-task selection, available revert-turn counts, and workspace mutation ID derivation to shared logic functions. Tests cover the new derivation conditions and results.

Changes: ChatView projection derivations

Layer / File(s)Summary
Thread presentation and background tasks
apps/web/src/components/ChatView.logic.ts, apps/web/src/components/ChatView.tsx
Shared helpers derive thread-shell fields and pending background tasks from projections. ChatView delegates these calculations to the helpers.
Revert turns and workspace mutation IDs
apps/web/src/components/ChatView.logic.ts, apps/web/src/components/ChatView.tsx, apps/web/src/components/ChatView.logic.test.ts
Helpers derive available revert turns and workspace mutation IDs. ChatView uses the helpers, and tests cover provider-session, provider-thread, completion, and empty-state conditions.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Possibly related issues

  • pingdotgg/t3code#23041 — Both changes refactor and test ChatView timeline or projection derivations that affect thread loading and conversation-pane state.

Suggested reviewers: t3dotgg

Merge Risk: ⚪ Minimal · up to 9d1b0

The extracted thread calculations preserve the previous behavior, and no merge-blocking issue was found.

Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description explains the refactor and lists focused validation results, but it omits the required Problem section and provides no Scope and approval information. It also does not clearly state exp…Add the required Problem section with the affected behavior and context. Add Scope and approval details with the triaged issue or maintainer approval, or explain why an exemption applies. Keep the existing Change and Verification details, i…
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the main change: moving ChatView thread derivations into tested functions in ChatView.logic.
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the refactor and lists focused validation results, but it omits the required Problem section and provides no Scope and approval information. It also does not clearly state expected behavior or reproduction context.

Resolution

Add the required Problem section with the affected behavior and context. Add Scope and approval details with the triaged issue or maintainer approval, or explain why an exemption applies. Keep the existing Change and Verification details, including observed results and any checks not run.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

Note

This review was completed with usage-based billing: files reviewed beyond your plan's included limits are billed at $0.25/file. View usage-based billing.

Comment @coderabbitai help to get the list of available commands.

Added 1 commit

  • refactor(web): ChatView's thread derivations are tested functions in ChatView.logic9d1b048
Synced from GitHub

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 9d1b048.

This comment will update automatically after the next completed run.