From 45b757e5d066f8bb39e2f50097d35fbcc3b05e4c Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Mon, 23 Nov 2026 02:14:37 +0800 Subject: [PATCH] fix(vcs): keep commit check actions visible while reading results --- e2e/commit.spec.ts | 75 ++++++++++++++++++++++++++ src/features/vcs/CommitView.module.css | 20 +++++-- 2 files changed, 91 insertions(+), 4 deletions(-) diff --git a/e2e/commit.spec.ts b/e2e/commit.spec.ts index ca6c3859b5..eb0d4ccec6 100644 --- a/e2e/commit.spec.ts +++ b/e2e/commit.spec.ts @@ -720,6 +720,81 @@ test("Commit Options applies a named TODO filter independently of the TODO windo expect(await ipcCalls(page, "vcs_commit")).toEqual([]); }); +test("commit check text scrolls independently of its status icon and retry action", async ({ workbench: page }) => { + await stubRepository(page); + await page.setViewportSize({ width: 850, height: 650 }); + await page.evaluate(async () => { + const registryPath = "/src/features/vcs/commitCheckRegistry.ts"; + const layoutPath = "/src/workbench/toolwindows/store.ts"; + const { registerCommitCheck } = await import(/* @vite-ignore */ registryPath); + const layout = await import(/* @vite-ignore */ layoutPath); + layout.moveToolWindow("commit", "left"); + layout.setToolWindowSize("left", 238); + for (let index = 0; index < 6; index++) { + registerCommitCheck({ + id: `test.commitLayout.${index}`, + order: index - 1000, + title: `Ledger check ${index + 1}`, + run: () => { + if (index === 0) document.body.dataset.checkRuns = String(Number(document.body.dataset.checkRuns ?? 0) + 1); + return { + severity: "error", + text: "The regional settlement totals differ from the monthly inventory audit and need a second review.", + fix: + index === 5 + ? { + label: "Review final check", + run: () => { + document.body.dataset.commitCheckReviewed = "yes"; + }, + } + : undefined, + }; + }, + }); + } + }); + await page.keyboard.press("Meta+k"); + const commit = page.getByRole("region", { name: "Commit", exact: true }); + await commit.getByRole("textbox", { name: "Commit message" }).fill("Review the settlement totals"); + await commit.getByRole("button", { name: "Commit Options", exact: true }).click(); + const options = page.getByRole("dialog", { name: "Commit Options", exact: true }); + await options.getByRole("button", { name: "Run Commit Checks", exact: true }).click(); + + const feedback = commit.getByRole("alert").filter({ hasText: "Ledger check 1" }); + const first = feedback.getByText("Ledger check 1", { exact: true }); + const second = feedback.getByText("Ledger check 2", { exact: true }); + const results = first.locator("../.."); + const icon = feedback.locator("svg").first(); + const retry = commit.getByRole("button", { name: "Rerun Commit Checks", exact: true }); + const commitAnyway = commit.getByRole("button", { name: "Commit Anyway", exact: true }); + await expect(commitAnyway).toBeInViewport({ ratio: 1 }); + await expect(first).toHaveCSS("font-size", "13px"); + const firstRow = (await first.locator("..").boundingBox())!; + const secondRow = (await second.locator("..").boundingBox())!; + expect(secondRow.y - (firstRow.y + firstRow.height)).toBeCloseTo(4, 0); + expect(await results.evaluate((node) => node.scrollHeight > node.clientHeight)).toBe(true); + const statusTop = (await icon.boundingBox())!.y; + const retryTop = (await retry.boundingBox())!.y; + await results.evaluate((node) => { + node.scrollTop = node.scrollHeight; + }); + expect(await results.evaluate((node) => node.scrollTop)).toBeGreaterThan(0); + expect((await icon.boundingBox())!.y).toBeCloseTo(statusTop, 0); + expect((await retry.boundingBox())!.y).toBeCloseTo(retryTop, 0); + const details = feedback.getByRole("button", { name: "Review final check", exact: true }); + await expect(details).toBeInViewport({ ratio: 1 }); + await expect(icon).toBeInViewport({ ratio: 1 }); + await expect(retry).toBeInViewport({ ratio: 1 }); + await expect(commitAnyway).toBeInViewport({ ratio: 1 }); + await details.click(); + await expect(page.locator("body")).toHaveAttribute("data-commit-check-reviewed", "yes"); + await retry.click(); + await expect(page.locator("body")).toHaveAttribute("data-check-runs", "2"); + await expect(first).toBeVisible(); + expect(await ipcCalls(page, "vcs_commit")).toEqual([]); +}); + test("the TODO check reports unreadable files and can retry after they become available", async ({ workbench: page, }) => { diff --git a/src/features/vcs/CommitView.module.css b/src/features/vcs/CommitView.module.css index 708f11dc40..67d6f1be35 100644 --- a/src/features/vcs/CommitView.module.css +++ b/src/features/vcs/CommitView.module.css @@ -403,24 +403,28 @@ align-items: flex-start; justify-content: space-between; gap: var(--space-1); + min-height: var(--h-control-small); } .checkFeedback > .checkProblems { + align-self: stretch; flex: 1; } +.checkFeedback .checkProblemsList { + align-self: stretch; +} .checkFeedback > button { flex: none; } .checkProblems { flex: none; display: flex; + align-items: flex-start; gap: var(--space-1-5); min-width: 0; - max-height: 120px; - overflow: auto; - padding: 4px 10px 0; + padding: var(--space-1) 10px 0; color: var(--fg-secondary); overflow-wrap: anywhere; - font-size: var(--fs-small); + font-size: var(--fs-ui); line-height: 1.4; } .checkProblemsIcon { @@ -434,13 +438,21 @@ color: var(--success); } .checkProblemsList { + display: flex; + flex-direction: column; + gap: var(--space-1); min-width: 0; + max-height: 150px; + overflow: auto; + overscroll-behavior: contain; } .checkProblemTitle { color: var(--fg); } .checkProblemLink { + max-width: 100%; padding: 0; + text-align: start; border: 0; background: none; color: var(--accent);