refactor(ui): extract session turn changes panel#676
Conversation
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
Code Review
This pull request refactors the SessionTurn component by extracting the turn-change panel logic and UI into a new standalone component, SessionTurnChangesPanel. This change includes the creation of the new component file, updating type definitions in session-turn-changes.ts, and cleaning up session-turn.tsx by removing redundant logic and state. The architecture manifest was also updated to reflect this extraction. I have no feedback to provide as there were no review comments.
Perf delta summaryComparator: pass
|
0bca5d3 to
aad77f6
Compare
77d1b82 to
f0958b4
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/ui/src/components/session-turn.tsx`:
- Around line 450-451: The current visibility gate uses props.turnChanges ===
undefined which hides the legacy diff fallback when turnChanges exists but lacks
this turn; update the condition to check the per-turn entry instead. Replace the
leading check props.turnChanges === undefined with a check that the per-turn
entry is missing (e.g., turnChange() == null or !turnChange()) so the whole
condition becomes something like: when={ (turnChange() == null ||
(turnChange()?.files.length ?? 0) === 0) && edited() > 0 && !working() }; keep
references to the existing helpers turnChange(), edited(), and working() when
making the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 224ee396-19bd-46a3-ba20-7c2e7c14a063
📒 Files selected for processing (3)
packages/ui/src/components/session-turn-changes-panel.tsxpackages/ui/src/components/session-turn-changes.tspackages/ui/src/components/session-turn.tsx
Topology Update (2026-05-16)
Final base:
dev.Dependency status: independent flat PR and parent of the short SessionTurn stack. #677 is stacked on this PR because both slices modify
packages/ui/src/components/session-turn.tsx, and reviewing the diff-summary extraction is cleaner after this panel extraction lands.Review order: review and merge #676 before #677. This PR is independent from #667/#669 and from the message-timeline stack #670 -> #671 -> #672 -> #674 -> #675.
Latest head after review follow-up:
d50f897bd.Summary
Extracted the
SessionTurnturn-change summary/action/file panel intopackages/ui/src/components/session-turn-changes-panel.tsxand moved the turn-change action type into the existingsession-turn-changes.tscontract helper.Why
This continues the #601 message-flow architecture work.
session-turn.tsxstill mixed assistant rendering, legacy diff summary, and turn-change UI. This PR gives the turn-change panel a clear owner before the next #601 slice tackles the remainingsession-turn.tsxover-500 debt.Related Issue
Human Review Status
Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.
Review Focus
data-slotnames, action confirmation behavior, file expansion behavior, and open/show-in-folder callbacks.turnChangesexists but has no visible entry for the current turn.SessionTurnso it survives panel hide/show transitions.visibleTurnChangeis initialized afterworkingso initial renders with turn-change data cannot hit a Solid memo temporal-dead-zone error.Risk Notes
Behavior is intended unchanged. Main risk is a UI wiring regression in turn-change file rows, legacy diff fallback visibility, or the two-click undo/redo confirmation because the panel moved to a separate component. No dependency, persistence, platform, or public package export change.
Architecture Boundary
Owner lane: #601 message flow.
Base/depends on:
dev. #677 depends on this PR.Touched files:
packages/ui/src/components/session-turn.tsxpackages/ui/src/components/session-turn-changes.tspackages/ui/src/components/session-turn-changes-panel.tsxpackages/ui/src/components/session-turn-parent.test.tsArchitecture effect:
session-turn.tsxreduced in this slice but remains over 500 LOC for later [Task] UI rewrite v2 Area A: message flow modular rollout #601 workReview Follow-up
e11b0cbceand resolved. The fallback now gates onhasVisibleTurnChanges(turnChange())instead of the presence of the wholeturnChangesmap.b0b187e35; turn-change expansion state is owned bySessionTurnand passed into the extracted panel.d50f897bd;visibleTurnChangeis declared afterworking.How To Verify
Screenshots or Recordings
Not included. This PR is intended as a behavior-preserving component extraction with no visual or copy changes; Electron manual visual verification was not run.
Checklist