refactor(web): decompose RunChat.tsx + RunChat.test.tsx below line caps #194
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab#194
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Decompose
web/src/routes/RunChat.tsx(2956 lines, 40 touches/3mo) andweb/src/routes/RunChat.test.tsx(4325 lines, 41 touches/3mo) — the repo's two worst churn×size files. This is the decomposition-design issue required by the line-cap policy (#193): one named responsibility per new file, agreed here before split code is written.Behavior-preserving refactor. No visual or behavioral change, no test-semantics change — existing queries/test-ids keep working. The vitest suite must pass unmodified in spirit: tests move between files, but assertions don't change.
Component split (proposed layout:
web/src/routes/runchat/, RunChat.tsx stays the route entry)Seams follow the file's own top-level structure:
routes/RunChat.tsx(keeps)runchat/ChatHeader.tsxChatHeader,ChatMenu— header row + overflow menurunchat/Messages.tsxMessageView,ToolChip,ToolGroupView— transcript renderingrunchat/Markdown.tsxMarkdown,BlockView,ListView,TableView,InlineNodes,InlineNode,CodeBlock,CopyButtonrunchat/Composer.tsxComposer,createInterrupt,submitOnEnter,InterruptButton— input, send, interruptrunchat/Dialogs.tsxDialogCard,AnsweredDialog,AnswerLine,DialogPanel,OptionContent,OptionToggle,MultiQuestionForm— question/dialog surfaceAdjust boundaries if reality disagrees (shared module-level state may force a
runchat/shared.tsfor constants/types likeMESSAGE_LIMIT— fine), but each file must keep a nameable responsibility: noRunChat2.tsx, no grab-baghelpers.tswith a single consumer. Heavy import fan-out between the new siblings is the sign the seam is wrong — stop and rethink rather than shear.Test split
Mirror the component split:
RunChat.test.tsxsplits into per-area test files (header/menu, transcript+markdown, composer/interrupt, dialogs, route-level wiring) plus one shared harness module for common setup/fixtures (render helpers, SSE fakes). Every resulting file under 2000 lines; the shared harness is source-class (cap 1000).Sequencing & ratchet
baseline.jsonentries (all resulting files should be under cap — the ratchet test enforces this).vitest,eslint,prettier,vite build— same as the native CI gate).Acceptance