Repository navigation
refactor(ui): make the review panel default document part of its slot definition - #125105
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 2:45 AM ET / 06:45 UTC. ClawSweeper reviewWhat this changesMoves the Review panel’s default session-diff document into the side-panel slot definition and caches its document identity across rerenders. Merge readinessKeep open. The slot-owned resolver and host/session identity cache are a coherent replacement for the lifecycle mutation, with no blocking code finding; exact-head CI and the required fresh autoreview remain incomplete. Priority: P3 Review scores
Verification
How this fits togetherThe chat pane converts session and layout state into side-panel definitions before rendering the selected panel. When Review is genuinely open and has no explicit document, it resolves the session diff for the embedded detail panel. flowchart LR
A[Session and layout state] --> B[Chat pane render]
B --> C[Side-panel definitions]
C --> D{Review slot open?}
D -->|yes| E[Resolve session-diff document]
E --> F[Host and session identity cache]
F --> G[Embedded Review panel]
D -->|no| G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +7, Tests +37. Total +44 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the slot-owned resolver and session-aware cache, then land after exact-head CI and a clean fresh autoreview. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR reorganizes an already-implemented Review-panel default rather than reporting a new defect. Is this the best way to solve the issue? Yes. Resolving the default in the slot declaration preserves explicit operator content while putting the default-document policy beside the rest of the slot contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 73ab74ecccdc. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
6f362a9 to
6fc514b
Compare
|
Land-ready proof for exact head
Known proof gaps: none for this behavior-neutral ownership refactor. The existing focused browser-harness cases preserve the Review panel behavior and the new request-count assertion covers rerender identity stability. |
What Problem This Solves
PR #124824 gave the Review panel a default document — the session diff — by seeding it from the pane's
render lifecycle:
seedSessionDiffSidebar(), called fromupdated(), assigningstate.sidebarContentwhenever the detail slot was open with nothing loaded. That fixed the reported bug and is proven by five
e2e cases, but it left the behavior as a special case outside the contract: a render-lifecycle side effect
mutating shared pane state, with a
sidebarContent !== nulllatch quietly doing double duty as both"already seeded" and "keep the object identity stable".
Meanwhile #124950 and #125019 made every other aspect of a slot — availability, content, empty state,
header actions — part of one declaration. Review's default document was the last thing that wasn't.
Why This Change Was Made
The
detailslot now declares its own default document insidebarPanelDefinitions()like every otherslot declares its content: explicit
sidebarContentwins if the operator opened something, otherwise thesession diff resolves when the slot is genuinely open.
seedSessionDiffSidebar(), itsupdated()call,and its imports are deleted — no shim.
The non-obvious part is object identity.
buildSessionDiffSidebarContent()mints a new object per call andthe mounted diff panel takes it as a property, so a resolver that recomputed on every render would hand the
panel a fresh loader each time and refetch
sessions.diffin a loop. The old latch prevented that as a sideeffect of seeding once. This PR makes it explicit: a
WeakMapkeyed by pane host caches the resolveddocument with its
sessionKey, so re-renders reuse identity and a session change rebuilds it. Thatinvariant carries an inline comment at the cache, because it is invisible at the call site.
Gating is preserved exactly:
detailOpenispresented && sidebarLayout.open && detailSlotOpen(layout)—the same three conditions the lifecycle hook checked. The panel is never auto-opened.
User Impact
None. Same panel, same document, same conditions — the behavior from #124824 is unchanged; only its owner
moved.
Evidence
The five e2e cases encoding #124824's behavior pass unchanged — the e2e diff is
+37 / −0, pureaddition, so nothing was adjusted to fit: menu open, persisted-open reload, session switch replacing the
seeded diff, branch-chip open, and a non-git session issuing no request.
New guard for the identity hazard, since no existing test could have caught a refetch loop (they all assert
what renders, never how many times it fetched):
It opens Review, asserts exactly one
sessions.diffrequest, then forces further renders by opening anotherpanel and awaiting two animation frames, and asserts the count is still one.
pnpm check:changedgreen; Codex autoreview clean ("patch is correct").reviewMetrics — production vs test LOC: production
+41 / −34(net +7), tests+37 / −0. Thelifecycle hook's deletion offsets most of the resolver and cache; the remainder buys an explicit invariant
where there was an implicit one. Series running total: −17 (#124950) +11 (#125019) +7 here = net −1 in
production, with four scattered sources now collapsed into one declaration.
No
CHANGELOG.mdedit — release-only per repo policy, and this step is behavior-neutral.