Repository navigation
refactor(ui): colocate side-panel header actions with their slot - #125019
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 1:41 AM ET / 05:41 UTC. ClawSweeper reviewWhat this changesThe PR moves Side chat and Discussion header controls into chat sidebar panel definitions and derives the sidebar header-action map from those definitions. Merge readinessKeep this active maintainer-owned refactor open. The current main branch still uses a separate header-action map, while this head removes that duplicate ownership without changing the shared region’s active-panel behavior. Priority: P3 Review scores
Verification
How this fits togetherThe Control UI builds sidebar panel definitions from chat session state, then supplies panel content and active-panel controls to the shared sidebar region. The changed path preserves the Side chat clear menu and Discussion external-link action while making their panel declarations the source of truth. flowchart LR
State[Chat session state] --> Definitions[Panel definitions]
Definitions --> Content[Panel content map]
Definitions --> Actions[Header action map]
Content --> Region[Shared sidebar region]
Actions --> Region
Region --> Controls[Active panel controls]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +11, Tests +31. Total +42 across 5 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land one definition-owned sidebar flow once exact-head checks are green, with content, availability, empty state, and header actions all derived from the same panel declarations. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a structural refactor, and the relevant question is preservation of existing sidebar controls rather than reproduction of a defect. Is this the best way to solve the issue? Yes. Deriving content and header actions from the same panel definitions removes the remaining parallel slot-keyed map while retaining the shared sidebar-region boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b2709ce10d7f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
e8f2bd2 to
95c3315
Compare
|
Land-ready verification for head
Proof gap: no before/after screenshot was captured because this refactor intentionally preserves rendered markup and behavior. The browser contract test exercises the real Control UI and verifies the production Side chat dropdown and Discussion external-link action shapes directly. |
|
Merged via squash.
|
What Problem This Solves
sidePanelHeaderActions()was the last place a chat side-panel slot's identity lived outside itsdeclaration. It built a second slot-keyed map — an external-link anchor for Discussion, a clear-thread
dropdown for Side chat — which
chat-pane-render.tspassed to the sidebar region separately from thetemplates. So after #124950 gave every slot one definition for availability, content, label, icon, and empty
state, a slot's header controls still came from a different function with its own parameter list.
Why This Change Was Made
This is step 2 of the series that makes one declaration per slot the single source of truth. Header actions
move onto
SidebarPanelDefinition.headerAction, the region'spanelActionsmap is derived bysidebarPanelActions()exactly assidebarPanelTemplates()derives content, andsidePanelHeaderActions()plus its call site are deleted. The inputs those actions need (
discussionOpenUrl,onClearCompanion,connected,pendingQuestion) now thread through the one builder instead of a parallel signature.While in the same file, the availability default
options?.available ?? params !== undefinedbecame a namedhasPaneContextwith a comment. Whether a tab is offered at all is load-bearing enough that it should notread as an incidental undefined-check. No behavior change.
User Impact
None. Same actions on the same panels, same markup, same gating.
Evidence
The jsdom region test previously built its
panelActionsby calling the production function, so it provedtwo separate things: that production's Side chat action is a dropdown, and that the region does not hoist a
destructive control into the always-visible row. Deriving that map from the new definitions inside a jsdom
test is not cheap — the builder constructs every slot's content and needs a full
ChatPageHost— so ratherthan fake production's markup and quietly keep the old assertion text, the two guarantees were split to the
level where each is honest:
the region renders it and does not lift its destructive item into the always-visible row;
chat-sidebar-panel-contract.e2e.test.tscovers production markup against a realControl UI: Side chat's header action is
wa-dropdown.chat-session-rail__menu, the action row has zerodirect
buttonchildren, and Discussion's action carries its external href.That is stronger than what it replaces: the production-markup invariant is now asserted against the running
app instead of a jsdom fixture.
pnpm check:changedgreen; Codex autoreview clean.reviewMetrics — production vs test LOC: production
+76 / −65(net +11), tests+39 / −8. The smallpositive is two inline action templates becoming declarations; it buys the deletion of the last parallel
slot-keyed map in this file. Series running total remains net-negative in production (−17 from #124950).
No
CHANGELOG.mdedit — release-only per repo policy, and this step is behavior-neutral.