Repository navigation
refactor: move ChatSidebar's render code into chat-sidebar owners - #20524
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Click through the four destructive sidebar actions (delete folder, delete column, clear closed sessions, delete history session) and confirm each still asks before deleting. [UX-REVIEWED] 9c9efb9 Description read[DESCRIPTION-READ] b56a19661d14f6006de58134b1df25e31f253555bf148449976c86858696a68e That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Five test files each add their own copy of the What this change shipsInventory (10 items) — 10 justifiedIntent: get
[FIRST-PRINCIPLES-REVIEWED] 9c9efb9 Description read[DESCRIPTION-READ] 16ac8810df964ccad3b8c85ab43a680668e9ee6d94c4a800b2c66dfebef75054 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 9c9efb9 Description read[DESCRIPTION-READ] e755529da1fe98e0679c70debd0403da2fff7fb36a3f6d29518074388a10d72f That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
ChatSidebar.tsx (5,360 lines after the session-row move) still drew every lane, folder block, the header, the dock, the Older Sessions pane, the folder modal and the cleanup and model switch panels inline. Those render bodies move verbatim into render owners under pages/chat-sidebar/ that call no hooks; the shell keeps every hook call in its order, the native confirm() dialogs as callbacks, and builds one SidebarScope after its last hook call. The cleanup and bulk model switch hook blocks become owner hooks at the same call position. ChatSidebar.tsx goes to 899 lines. Part of #20192
ec9b608 to
9c9efb9
Compare
|
Rebased: main moved in The two textual conflicts were shared rows next to this PR's own: the restyle baseline gained other files' rows, and #20382/#20534 re-pointed |
|
|
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved after a maintainer read the review lanes on this head: all clean.
When a tag filter or active status chip narrows the session list, a 'Pinned · always shown' caption appears as a header above the first pinned session row in the root lane (tree root and flat list). The caption makes the exemption visible: the pinned band is always shown, whatever the active filter. The caption fires only when a tag filter (activeTagIds.size > 0) or active unpaused status chips (activeFilters.size > 0 && !filtersPaused) are on — not for the model filter or status hides, which do not exempt pinned rows. It is absent during a text search and when no filter narrows the list. The caption is a root-lane header only. Folder bodies and board columns do not repeat it; the plain divider between pinned and unpinned sections is unchanged. New key pages.chatSidebar.pinned_always_shown in all 12 catalogs + en-XA. Three new tests in ChatSidebar.filterDimensions.test.tsx. Compatible with PR #20524 refactoring: uses new listLanes.tsx and scope.ts.
…line (#20749) * fix(sidebar): dim folder and New-menu writes while the gateway is offline Items in the folder and New-chat menus now dim, refuse at the sink and carry one reason row per menu; a folder action refused offline shows a neutral notice and no longer claims "Folder update failed". Ported from #9485 onto main's chat-sidebar split (#20524): the gates live in folderBlocks.tsx, boardLane.tsx and SidebarHeader.tsx, and the sink refusals in the folders/create/drag hooks. The commit's screenshots are dropped. Fixes #20736 * refactor(sidebar): move the offline menu-row gate into utils/offline A new module under website/src/pages trips the feature-map gate; the helper belongs beside offlineProps anyway. Co-authored-by: rnoack1 <rnoack@amazon.com> --------- Co-authored-by: Robert Noack <rnoack@amazon.com> Co-authored-by: EC2 Default User <ec2-user@ip-172-31-10-71.ec2.internal>
When a tag filter or active status chip narrows the session list, a 'Pinned · always shown' caption appears as a header above the first pinned session row in the root lane (tree root and flat list). The caption makes the exemption visible: the pinned band is always shown, whatever the active filter. The caption fires only when a tag filter (activeTagIds.size > 0) or active unpaused status chips (activeFilters.size > 0 && !filtersPaused) are on — not for the model filter or status hides, which do not exempt pinned rows. It is absent during a text search and when no filter narrows the list. The caption is a root-lane header only. Folder bodies and board columns do not repeat it; the plain divider between pinned and unpinned sections is unchanged. New key pages.chatSidebar.pinned_always_shown in all 12 catalogs + en-XA. Three new tests in ChatSidebar.filterDimensions.test.tsx. Compatible with PR #20524 refactoring: uses new listLanes.tsx and scope.ts.
…ist (#20589) * feat(sidebar): label the pinned band while a tag filter narrows the list When a tag filter or active status chip narrows the session list, a 'Pinned · always shown' caption appears as a header above the first pinned session row in the root lane (tree root and flat list). The caption makes the exemption visible: the pinned band is always shown, whatever the active filter. The caption fires only when a tag filter (activeTagIds.size > 0) or active unpaused status chips (activeFilters.size > 0 && !filtersPaused) are on — not for the model filter or status hides, which do not exempt pinned rows. It is absent during a text search and when no filter narrows the list. The caption is a root-lane header only. Folder bodies and board columns do not repeat it; the plain divider between pinned and unpinned sections is unchanged. New key pages.chatSidebar.pinned_always_shown in all 12 catalogs + en-XA. Three new tests in ChatSidebar.filterDimensions.test.tsx. Compatible with PR #20524 refactoring: uses new listLanes.tsx and scope.ts. * refactor(sidebar): read the pinned-band caption flag from the row model The caption predicate restated which filters exempt pinned rows. Each filter dimension now declares exemptsPinned, and buildSidebarRows derives pinnedExemptNarrowing from it, so the caption and the exemption share one rule. Adds tag-filter caption tests (resolved tag shows it, unresolved id does not). --------- Co-authored-by: EC2 Default User <ec2-user@ip-172-31-10-71.ec2.internal>
Problem / Motivation
Goal: Bring
website/src/pages/ChatSidebar.tsxunder the 1,200-line target by moving its render code into owners underpages/chat-sidebar/, with no behaviour change.The repository is adopting a hard rule that no hand-written file exceeds 2,000 lines (#20192). After the session row moved out (#20309),
ChatSidebar.tsxis still 5,360 lines: one component function that draws every lane, folder block, the header, the search dock, the Older Sessions pane, the folder modal and two header-menu panels inline. This second step moves those render bodies out, so the sidebar shell is a file of hooks and wiring.Why it matters
A 5,000-line component is hard to review and collides with every concurrent sidebar change: a fix to a folder menu, a dock notice and the history pane all edit the same function. After this step each of those lives in its own file, and the shell that every one of them depends on is under 900 lines.
Not a goal
confirm()dialogs, the restyle sites or any other backlog the moved code carries.What changed (motivation → approach → change)
The shell keeps every hook call, in its current order, so React runs the same hooks and effects in the same sequence. After its last hook call it builds one
SidebarScopeobject (its props, its own state, what its owner hooks returned and four confirming callbacks) and hands it to render owners that call no hooks. The row and folder factories run once per render, after the scope is built, so the paint-order row stamps belong to that render's pass as before. Two hook blocks that only their own panel reads become owner hooks at the same call position (useSessionCleanup,useBulkModelSwitch, added to the pinnedCALL_ORDER):useSessionCleanupholds the cleanup block's threeuseState, its previewuseQueryand its archiveuseMutation;useBulkModelSwitchholds fouruseState,useId,useAvailableModelsQuery, threeuseMemo, the switchuseMutation, twouseRefanduseListboxKeyboard. Each statement is byte-identical and runs in the same place in the sequence, so the effect-bearing hooks keep their order. The nativeconfirm()dialogs stay inChatSidebar.tsx(the file eslint's native-dialog allowlist names) as the callbacks the owners call.website/src/pages/chat-sidebar/)scope.tsChatSidebarProps(moved) andSidebarScope, the interface between the shell and its render ownerslaneRows.tsxfolderBlocks.tsxlistLanes.tsxboardLane.tsxSidebarHeader.tsxSearchDock.tsxHistoryPane.tsxfolderModal.tsxsessionCleanup.tsxuseSessionCleanupand the cleanup panelbulkModelSwitch.tsxuseBulkModelSwitchand the model switch panelChatSidebar.tsxgoes from 5,360 to 899 lines and keeps every export it had (export { … } fromthe new owners).dateSegment, which both the flat lane and the Older Sessions pane head their groups with, joins the sharedchrome.tsx. Three files are under 150 lines on purpose:folderModal.tsxis the one folder modal, a render owner with its own owner-map row;sessionCleanup.tsxandbulkModelSwitch.tsxeach pair an owner hook (listed inCALL_ORDER) with the one panel that reads it.Move audit
The 96 unmatched removed lines are glue, each accounted for: 68 import lines (each owner imports what its code uses); the 9 JSX slot wrappers whose bodies moved (
{cleanupOpen && (() => {,})()},{bulkModelOpen && (,<ListDock field={(,)} shelf={(,)}>,{folderModal && (and two)}); the 6confirm()call sites, which call the shell's confirming callbacks instead (same keys, same guarded action, same short-circuit);exportadded todateSegmentandChatSidebarProps; four moved comments that named a position in the old file; the six lines of the shell's docblock; and one stale section heading (// ── Session row (reference-style: …) ──) whose component left in #20309.git diffandgit diff --minimaladd the same lines in every changed file (the shell: 107 added, 4,536 removed).One upstream change to
ChatSidebar.tsxlanded after #20309: #20184'stext-warn->text-warn-texton the board's hidden-folders button. It is carried byte-for-byte intochat-sidebar/boardLane.tsx, where the board block now lives.Comment citations (KC28 L29)
Comments and prose that named
ChatSidebar.tsxas the home of code this split (or #20309) moved now name the owner; only the cited path or name changes. Found by a sweep of every comment and doc line that mentionsChatSidebar(303 lines classified, each proposed edit checked against the tree).docs/system-specs/modules/ops-mission-control.md:3006`pages/ChatSidebar.tsx``pages/chat-sidebar/SearchDock.tsx`website/scripts/check-i18n-strings.mjs:532, :593pages/ChatSidebar.tsxpages/chat-sidebar/SearchDock.tsxwebsite/eslint-rules/i18n-strict.js:25`pages/ChatSidebar.tsx``pages/chat-sidebar/SearchDock.tsx`website/src/pages/chat-sidebar/SessionRow.tsx:211./chat-sidebar/rows./rowssrc/kiro_crew/mcp_dashboard.py:1871ChatSidebarchat-sidebar/folderBlocks.tsxwebsite/playwright/chat.spec.ts:11(ChatSidebar.tsx aria-label)(chat-sidebar/SidebarHeader.tsx aria-label)website/playwright/sidebar-folder-alignment.spec.ts:18src/pages/ChatSidebar.tsxsrc/pages/chat-sidebar/folderBlocks.tsxwebsite/playwright/sidebar-folder-collapse-floor.spec.ts:6ChatSidebar's list-view toggleschat-sidebar/folderBlocks.tsx's list-view toggleswebsite/playwright/sidebar-hairline-alignment.spec.ts:15ChatSidebar.tsxchat-sidebar/HistoryPane.tsxwebsite/playwright/sidebar-sticky-folder-header.spec.ts:5ChatSidebarchat-sidebar/folderBlocks.tsxwebsite/scripts/capture-i18n-labels.mjs:8`pages/ChatSidebar.tsx``pages/chat-sidebar/SearchDock.tsx`website/scripts/capture-warn-text-contrast.mjs:32ChatSidebarchat-sidebar/boardLane.tsxwebsite/scripts/check-i18n-strings.mjs:414`ChatSidebar`'s`chat-sidebar/SearchDock.tsx`'swebsite/src/apps/issue-radar/lib/links.ts:127ChatSidebarchat-sidebar/SearchDock.tsxwebsite/src/apps/ops-mission-control/OpsMissionControlPage.tsx:78pages/ChatSidebar.tsxpages/chat-sidebar/SearchDock.tsxwebsite/src/hooks/useAvailableModels.ts:20ChatSidebarchat-sidebar/bulkModelSwitch.tsxwebsite/src/hooks/useAvailableModels.ts:41ChatSidebarchat-sidebar/bulkModelSwitch.tsxwebsite/src/index.css:2255ChatSidebarchat-sidebar/SidebarHeader.tsxwebsite/src/index.css:3119ChatSidebarchat-sidebar/folderBlocks.tsxwebsite/src/index.css:3151ChatSidebarchat-sidebar/folderBlocks.tsxwebsite/src/index.css:3168ChatSidebarchat-sidebar/SessionRow.tsxwebsite/src/index.css:3178ChatSidebarchat-sidebar/SessionRow.tsxwebsite/src/pages/ArtifactDeployPage.tsx:87`FILTER_LABEL_KEY` in ChatSidebar`FILTER_LABEL_KEY` in chat-sidebar/SearchDock.tsxwebsite/src/pages/chat/ToolDetails.tsx:237ChatSidebarchat-sidebar/SearchDock.tsxwebsite/src/pages/chat/messageTime.ts:10ChatSidebar.tsxchat-sidebar/chrome.tsxwebsite/src/pages/chat/sessionOrder.ts:171ChatSidebarchat-sidebar/chrome.tsxwebsite/src/pages/chat/sessionRowWindow.tsx:53ChatSidebar'schat-sidebar/laneRows.tsx'swebsite/src/pages/chat/useChatPageSessionController.ts:116ChatSidebar'schat-sidebar/HistoryPane.tsx'swebsite/src/pages/settings/SecurityPanel.tsx:69pages/ChatSidebar.tsxpages/chat-sidebar/SearchDock.tsxwebsite/src/test/ChatSidebar.offline.test.tsx:31ChatSidebarchat-sidebar/HistoryPane.tsxwebsite/src/test/folderTree.test.ts:140ChatSidebar'schat-sidebar/folderBlocks.tsx's and chat-sidebar/boardLane.tsx'swebsite/src/test/labelKeyTables.test.ts:6`ChatSidebar``chat-sidebar/SearchDock.tsx`website/src/test/recentWindow.test.ts:16ChatSidebar.tsxchat-sidebar/SearchDock.tsxwebsite/src/uiLocations/areas/chat.ts:71ChatSidebarchat-sidebar/SidebarHeader.tsxwebsite/src/utils/channelOrigin.ts:73`ChatSidebar.tsx``chat-sidebar/HistoryPane.tsx`Backwards compatibility
Compatible: every name
pages/ChatSidebar.tsxexported before this change still resolves from it to the same object (SIDEBAR_DISPLACEMENT_WINDOW,FILTER_LABEL_KEY,FILTER_DESCRIPTION_KEY,SORT_LABEL_KEY,FOLDER_SORT_LABEL_KEYare re-exported withexport { … } from), the default export is unchanged, and the specs thatvi.mock('../pages/ChatSidebar')still replace the whole sidebar, because nothing outside the sidebar imports an owner.Removes nothing: a move; no prop, export, route, key or behaviour is removed.
Tests
No assertion's matcher or expected value changes. Source-reading pins now read the code where it lives (KC28 L30 re-points and joins, L40(8) for negative halves), each proven to still reach it by a mutation in its new home that turns it red:
ChatSidebar.ownerComposition.test.ts:CALL_ORDERgainsuseSessionCleanupanduseBulkModelSwitchat their call position.switchSlotCallsiteClassification.test.ts: the folder menu's and folder row's two announced sites move from theChatSidebar.tsxrow to achat-sidebar/folderBlocks.tsxrow.hoverVariantPolicy.test.ts: three rows point atchat-sidebar/folderBlocks.tsxand one atchat-sidebar/HistoryPane.tsx.searchFilterBar.parity.test.tsx: the sidebar entry reads the shell joined with its owners, where the search row now lives.ChatSidebar.hiddenFolderBoardTrace.test.tsx: the hidden-folder control reads the joined sidebar surface it already scans.ResizeHandle.parity.test.tsx,useInteractiveModels.test.ts,kiroLightShellHooks.test.ts,ChatPage.remoteBoundGates.test.tsx: only the negative halves that readChatSidebar.tsxbefore the split (no hand-rolled vertical separator, nofilterInteractiveModels(in the bulk switcher, no hand-spelledsidebar sidebar-innercard, no inlineexecutor === 'remote'in the interrupted-row builder) read the shell joined with every owner; the positive halves still read the one file that holds their construct (ChatSidebar.tsx, orchat-sidebar/SessionRow.tsxfor the crew-bound row)..github/file-line-cap-baseline.txtlosesChatSidebar.tsx's row, which now sits at 899 lines (scripts/check_file_line_cap.py: 0 failures). The row review rulesession-row-fixed-height(website/AUTOSDE.yaml) gainschat-sidebar/HistoryPane.tsx, which draws the history row, and the restyle baseline's 24ChatSidebar.tsxsites move by hand toSearchDock.tsx13,SidebarHeader.tsx9 andboardLane.tsx2 (same total).Local gates on this commit, re-cut from the recipe on main
21cb2ced0cand rebased cleanly onto4cf57981d1(main changed no sidebar file since the first cut):tsc -p tsconfig.app.json0;eslint src --max-warnings 00; jscpd 0 clones;gen-ui-index --checkup to date; restyle ratchet, theme colors, phantom classes, focus cue, i18n gates, feature-map, brand, comment-history and docs-lint pass; take-away: no take-away shape; semgrep 1.78 (CI's rule set) over the 50 changed code files 0 findings, and it parses every new file (scope.tsspells out the twouseScrollEdgesresult types rather than an instantiation expression semgrep cannot parse). Vitest: the 200 sidebar files 2,736/2,736 pass, with every new owner at or above 87.9% lines (SearchDock.tsx88.1%,boardLane.tsx87.9%,folderModal.tsx88.0%, the rest 90-100%); the other 385 files of the frontend related set 11,756/11,756 pass (last run at mainfbca1a17ef); the 68 backend test files that read a changed doc, rule file ormcp_dashboard.py5,134 pass. The 15 re-pointed or joined pins each go red under a mutation in the code's new home.scripts/local-gate.py --dry-runselects 956 backend + 519 frontend files (most of them the cross-surface sets), so the floor above ran instead and CI owns the broad matrix.Manual verification
N/A — a verbatim move whose markup is unchanged; the sidebar's 200 rendering test files cover every moved owner.
Screenshots / video
Why no screenshot: a verbatim code move with no markup, style or copy change, so nothing renders differently.
Related Issues
Part of #20192
Checklist
Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.