Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions apps/desktop/e2e/code-review-actions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,48 @@ test("a state change GitHub may have made stays in doubt, blocks the PR and is c
expect(mutations()).toEqual([`PATCH ${PULL}`]);
});


async function focusPane(page: Page, name: "overview" | "changes") {
const split = tid(page, "code-review-split-toggle");
if (await split.getAttribute("aria-pressed") !== "true") await split.click();
await tid(page, `code-review-tab-${name}`).click();
await expect(tid(page, "code-review-workspace")).toHaveAttribute("data-panes", "overview changes");
await expect(tid(page, "code-review-pane-overview")).toBeVisible();
await expect(tid(page, "code-review-pane-changes")).toBeVisible();
}

for (const paneName of ["overview", "changes"] as const) {
test(`header panel focus controls remain local in ${paneName}`, async () => {
h = await launchWithGh(baseWorld()); const page = await openLending();
await focusPane(page, paneName);
const pane = tid(page, `code-review-pane-${paneName}`);
await expect(pane).toBeVisible();
for (const [openerId, panelId] of [["code-review-review", "cr-agent-panel"], ["code-review-merge", "cr-merge"]] as const) {
const opener = tid(pane, openerId);
for (const dismissal of ["Close", "Escape"] as const) {
await opener.click(); const panel = tid(pane, panelId); await expect(panel).toBeVisible();
const close = panel.getByRole("button", { name: "Close", exact: true });
if (dismissal === "Close") await close.click(); else { await close.focus(); await page.keyboard.press("Escape"); }
await expect(panel).toHaveCount(0); await expect(opener).toBeFocused();
expect(mutations()).toEqual([]); expect(h.providerStarts()).toEqual([]);
}
}
});
for (const dismissal of ["Close", "Back", "Escape"] as const) test(`state panel dismissal with ${dismissal} returns focus to ${paneName}`, async () => {
h = await launchWithGh(baseWorld()); const page = await openLending();
await focusPane(page, paneName);
const pane = tid(page, `code-review-pane-${paneName}`), opener = tid(pane, "code-review-state");
await expect(opener).toHaveAttribute("aria-haspopup", "menu"); await opener.click();
await pane.getByRole("menu", { name: "Change state" }).getByRole("menuitem", { name: "Close pull request", exact: true }).click();
const panel = tid(pane, "cr-state-panel");
await expect(panel.getByTestId("cr-preview-destination")).toHaveText("As ada-fixture on example-org/lending #73");
expect(mutations()).toEqual([]); expect(h.providerStarts()).toEqual([]);
if (dismissal === "Escape") { await panel.getByRole("button", { name: "Close", exact: true }).focus(); await page.keyboard.press("Escape"); }
else await panel.getByRole("button", { name: dismissal, exact: true }).click();
expect(mutations()).toEqual([]); expect(h.providerStarts()).toEqual([]);
await expect(panel).toHaveCount(0); await expect(opener).toBeFocused();
await expect(opener).toHaveText("Open");
const other = tid(page, `code-review-pane-${paneName === "overview" ? "changes" : "overview"}`);
await expect(other).toBeVisible(); await expect(tid(other, "code-review-state")).not.toBeFocused();
});
}
8 changes: 4 additions & 4 deletions apps/desktop/src/renderer/code-review/PrPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function PrPane({ pane, changesViews, pr, keyId, changesWidth, treeWidth,
// At most one panel under the header: Merge, a state change picked from the state menu, or an agent review.
const [panel, setPanel] = useState<"merge" | "agent" | PrStateChange | null>(null);
const closeHeaderPanel = () => {
const opener = panel === "agent" ? "code-review-review" : "code-review-merge";
const opener = panel === "agent" ? "code-review-review" : panel === "merge" ? "code-review-merge" : "code-review-state";
setPanel(null);
// Each split pane has its own header: return to the button that opened this panel.
paneElement.current?.querySelector<HTMLElement>(`[data-testid="${opener}"]`)?.focus();
Expand All @@ -83,8 +83,8 @@ export function PrPane({ pane, changesViews, pr, keyId, changesWidth, treeWidth,
return (
<section ref={paneElement} id={`cr-pane-${pane}`} role="tabpanel" aria-labelledby={`cr-tab-${pane}`} className={`cr-pane cr-pane-${pane}`} data-pane={pane} data-testid={`code-review-pane-${pane}`}
onKeyDown={(event) => {
if (event.key === "Escape" && (panel === "agent" || panel === "merge") && event.target instanceof Element
&& event.target.closest('[data-testid="cr-agent-panel"], [data-testid="cr-merge"]')) {
if (event.key === "Escape" && panel !== null && event.target instanceof Element
&& event.target.closest('[data-testid="cr-agent-panel"], [data-testid="cr-merge"], [data-testid="cr-state-panel"]')) {
event.preventDefault();
event.stopPropagation();
closeHeaderPanel();
Expand All @@ -93,7 +93,7 @@ export function PrPane({ pane, changesViews, pr, keyId, changesWidth, treeWidth,
<PrHeader pr={pr} busy={busy} pinned={pinned} caps={caps} onPin={onPin} merge={merge} review={review} filesToggle={pane === "changes" && treeWidth === null ? { shown: filesShown, toggle: () => setFilesShown((v) => !v) } : null} />
{review && panel === "agent" && <AgentPanel key={keyId} agent={review.agent} overview={review.overview} onClose={closeHeaderPanel} onReload={onRetry} />}
{merge && panel === "merge" && <MergePanel key={keyId} writes={merge.writes} overview={merge.overview} onClose={closeHeaderPanel} onMerged={onRetry} />}
{merge && panel && panel !== "merge" && panel !== "agent" && <StatePanel key={`${keyId}:${panel}`} writes={merge.writes} overview={merge.overview} to={panel} onClose={() => setPanel(null)} onDone={onRetry} />}
{merge && panel && panel !== "merge" && panel !== "agent" && <StatePanel key={`${keyId}:${panel}`} writes={merge.writes} overview={merge.overview} to={panel} onClose={closeHeaderPanel} onDone={onRetry} />}
{pane === "overview" && <div ref={body} className="cr-pane-body" data-testid="code-review-overview-body" tabIndex={-1}>
{status ?? <PrOverview key={keyId} pr={pr} caps={caps} retry={onRetry} onChanges={onShowChanges} onPage={onActivityPage} busy={contextBusy} writes={writes} agent={agent} />}
</div>}
Expand Down
13 changes: 13 additions & 0 deletions docs/reviews/2026-11-13-cr-state-panel-focus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Code Review state-panel dismissal and focus

The accepted follow-up starts from protected main `49f46971836c7dc4cb26e686c46f142b41d10b46`. Review and Merge already returned keyboard focus to their own header button, but the state-change panel used a separate Close callback and was excluded from the pane's scoped Escape handler. Close and preview Back left focus on the document body; Escape left the state panel open. The earlier synthetic native observation is retained separately from the normal Electron regressions here.

The repair uses the existing pane-local close handler for the state panel, selects its own state button as the opener, and includes that panel in scoped Escape handling. Close, Back and Escape dismiss only the originating panel and return focus to that pane's state control. Preview-bound write authority and confirmation remain in main; dismissal performs no mutation or provider start.

The baseline state-menu mutation fixture and both Review/Merge control cases passed before production changes. Six new state-panel regressions then failed: Close, Back and Escape in Overview and Changes. Their first traces remain in the external closeout evidence directory. After the repair, all eight focused cases passed with no retries, including the preserved Review/Merge controls and assertions that no synthetic write or provider turn started. The final run explicitly shows Overview and Changes together in split mode, with focus returning to the originating header and never the other pane. These tests use the production Electron/main path with a synthetic gh, not a live repository.

Receipts: `cr-state-panel-focus-baseline-build.log`, `cr-state-panel-focus-baseline.log`, `cr-state-panel-focus-red.log`, `cr-state-panel-focus-red-results/` and `cr-state-panel-focus-green.log` and `cr-state-panel-focus-split-green.log` in the session's retained `modex-closeout` evidence directory. Final full checks, signed source delivery, hosted checks and protected merge require their own exact-source receipts. Human accessibility review and the named-disposable-repository live-write gate remain open; this repair changes no issue checkbox or activation decision.

The exact signed source `0f96bd47298e88597208a1c52c2180bddab2403c` passed full build, typechecking and units (2,588 passed, 36 skipped). Its full desktop E2E ended with 539 passed, 17 skipped and one failed window-position relaunch assertion; site/web E2E did not run after desktop failed. All eight focus cases passed within that run. The first failure, trace, unchanged source manifest and final stage results are retained in `cr-state-panel-focus-full1-terminal-proof.json` and its first-failure directory. Separate diagnostics observed valid saved/planned bounds and a native move after showing the window into the assigned display. Two unchanged persistence controls passed with a private same-code Electron host; a later read during the CF7 full run found that private host assigned to the same macOS Desktop too, and its coordinate assertion also failed. The assignment provenance is unknown; neither OS preferences nor persistence assertions were changed. These facts do not convert either failed full run into a pass or establish a product persistence repair.

The current follow-up changes documentation only; application and test sources remain byte-identical to the reviewed `0f96bd4` and its retained unit run. Fresh final-head build/typechecking, the eight split-pane focus cases and site/web E2E retain their own receipts. Complete hosted source CI and protected merge-queue checks are required before delivery. Human accessibility, named-disposable-repository writes and feature activation remain separate gates, with no issue-checkbox change here.
2 changes: 1 addition & 1 deletion docs/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ before relying on a tick.

## In flight

- **Code Review person-run seed and header-panel focus.** The owned source candidate repairs the actual human-review seed: long description, 101 paged comments, checks/stack/deployment and coherent diffs for all listed synthetic PRs. A normal Electron regression reproduced header Review panel Close dropping focus; Review/Merge Close and scoped Escape now return to their own split-pane button, preserving instructions Escape. Build, workspace typechecks, 2,588 units with 36 skips, 531 desktop E2E cases with 17 opt-in skips, eight site cases and four web cases pass. The isolated seeded overview/activity/panel/diff journey passes; the final fixture-only D5 scroll-density correction passes actual wide/narrow PageDown checks with unchanged diff/inbox positions, its final full units also pass, and protected delivery is pending. Human Result cells stay blank. The checklist uses explicit private-home General opt-in, removes C07 and describes conditional tree folding. Initial signed source `1b2c58b` passed hosted units and iPhone suites but failed two desktop E2E cases. The immutable-comparison fixture race is reproduced and repaired with two deterministic request orderings; the unexplained Markdown ArrowRight failure has validated observation-only diagnostics, with all original assertions retained. The follow-up full build, workspace/E2E typechecks and 2,588 units with 36 skips pass. Full follow-up E2E passes 532 desktop cases with 17 opt-in skips, eight site cases and four web cases, zero failures/retries; exact-head hosted/protected qualification remains pending. The original human candidate is independently preserved and natively qualified in a portable runtime, with human rows still blank. State-change panel focus/Escape remains a named follow-up. [Repair and limits](reviews/2026-11-13-cr-human-seed-focus.md), [CI follow-up](reviews/2026-11-13-pr522-ci-followup.md).
- **Code Review person-run seed and header-panel focus.** Protected main `49f4697` (#522) contains the human-review seed repairs: long description, 101 paged comments, checks/stack/deployment and coherent diffs for all listed synthetic PRs. A normal Electron regression reproduced header Review panel Close dropping focus; Review/Merge Close and scoped Escape now return to their own split-pane button, preserving instructions Escape. Build, workspace typechecks, 2,588 units with 36 skips, 531 desktop E2E cases with 17 opt-in skips, eight site cases and four web cases pass. The isolated seeded overview/activity/panel/diff journey passes; the final fixture-only D5 scroll-density correction passes actual wide/narrow PageDown checks with unchanged diff/inbox positions, its final full units also pass, and protected #522 has since delivered those repairs. Human Result cells stay blank. The checklist uses explicit private-home General opt-in, removes C07 and describes conditional tree folding. Initial signed source `1b2c58b` passed hosted units and iPhone suites but failed two desktop E2E cases. The immutable-comparison fixture race is reproduced and repaired with two deterministic request orderings; the unexplained Markdown ArrowRight failure has validated observation-only diagnostics, with all original assertions retained. The follow-up full build, workspace/E2E typechecks and 2,588 units with 36 skips pass. Full follow-up E2E passes 532 desktop cases with 17 opt-in skips, eight site cases and four web cases, zero failures/retries; exact-head hosted/protected qualification subsequently passed on main `49f4697`. The original human candidate is independently preserved and natively qualified in a portable runtime, with human rows still blank. The separate state-change panel repair adds Close/Back/scoped Escape focus restoration in both panes. Eight focused Electron cases pass; full build/typechecking and 2,588 units with 36 skips passed, while broad desktop E2E retained 539 passes, 17 skips and one window-position failure. Final focused qualification, fresh complete hosted checks and protected delivery remain open; the failed local run is not a pass. [Repair and limits](reviews/2026-11-13-cr-human-seed-focus.md), [CI follow-up](reviews/2026-11-13-pr522-ci-followup.md), [state-panel repair](reviews/2026-11-13-cr-state-panel-focus.md).

- **Code Review line comments integration** (#513, #520). Protected #520 delivered signed squash `967b703768d040d64456c7d118548b97a3bae35b`, tree `6a241c26d089ac4d7daf3e4b30b23a28257010c5`, from qualified source `f9bef70`; #513 is closed as superseded and its owner’s checkout/branch remain preserved. Activity loads the first 100 REST review comments with truthful file/line/reply/unavailable-location labels and partial/capped states. The actual protected checkout passed 2,587 units with 36 skips, 533 desktop cases with fourteen opt-in skips, eight site cases and four web cases, with no retry annotations; both artifacts passed digest/ZIP checks. Corrected source CI passed all twelve checks, including 65 native iPhone units and 43 ordinary UI cases plus one intentional expected-failure control. The first iPhone job’s 30-minute cancellation remains retained; the reviewed whole-job correction to 45 minutes changed no test assertions, individual waits or retries. Hosted simulator, scripted-provider installed CLI and real authenticated-read evidence remain distinct from physical phone, human, live-provider/write and activation acceptance. Resolved-thread state, inline placement and further comment pages remain separate requirements. [Integration and delivery receipt](reviews/2026-11-13-cr-inline-integration.md); [new real-PR benchmark](reviews/2026-11-13-cr-real-pr-benchmark.md).

Expand Down
Loading