Compare commits

..
Author SHA1 Message Date
l0ng-ai f658a1da99 fix(vcs): align commit author and date fields 2026-11-23 01:32:01 +08:00
Charlie.Weiandcharli117 76d67145f5 test(smoke): give the language-smoke closure tests a 20s timeout (#5240)
The two Language smoke workflow tests compute the repo-wide import closure and crate tree. On a CI runner running the whole suite they took longer than vitest's default 5 s and failed the Frontend job on main.

Co-authored-by: charli117 <[email protected]>
2026-11-23 01:13:43 +08:00
Charlie.Weiandcharli117 cf4273eeea chore(deps): bump url to 2.5.9 for RUSTSEC-2026-0592 (#5237)
url 2.5.8 overflows the stack in Url::origin() on nested blob: URLs (RUSTSEC-2026-0592), which failed Cargo deny on main. 2.5.9 fixes it; form_urlencoded moves to 1.2.3 with it. The rest of the lockfile stays as on main.

Co-authored-by: charli117 <[email protected]>
2026-11-23 01:13:33 +08:00
8 changed files with 103 additions and 265 deletions

No files matched your search

Generated
+4 -4
View File
@@ -2361,9 +2361,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
[[package]]
name = "form_urlencoded"
version = "1.2.2"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e"
dependencies = [
"percent-encoding",
]
@@ -10827,9 +10827,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
version = "2.5.8"
version = "2.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a"
dependencies = [
"form_urlencoded",
"idna",
+60
View File
@@ -85,6 +85,66 @@ test("⌘K commits the checked changes with the typed message", async ({ workben
await expect(changes.getByRole("checkbox", { name: "Include build.gradle.kts in commit" })).toBeHidden();
});
test("commit options align author fields and keep the date editable in a narrow dialog", async ({
workbench: page,
}) => {
await stubRepository(page);
await page.setViewportSize({ width: 1040, height: 700 });
await page.keyboard.press("Meta+k");
const panel = page.getByRole("region", { name: "Commit", exact: true });
await panel.getByRole("button", { name: "Commit Options", exact: true }).click();
const popup = page.getByRole("dialog", { name: "Commit Options", exact: true });
const author = popup.getByRole("textbox", { name: "Author", exact: true });
const date = popup.getByLabel("Author date", { exact: true });
const clear = popup.getByRole("button", { name: "Clear author date", exact: true });
const name = "Regional Ledger Review <[email protected]>";
const time = "2024-06-04T13:20:21";
await author.fill(name);
await date.fill(time);
const authorBox = (await author.boundingBox())!;
const dateBox = (await date.boundingBox())!;
const dateLabel = (await popup.getByText("Author date", { exact: true }).boundingBox())!;
const clearBox = (await clear.boundingBox())!;
expect(authorBox.x).toBeCloseTo(dateBox.x, 0);
expect(dateLabel.y).toBeGreaterThanOrEqual(dateBox.y);
expect(dateLabel.y).toBeLessThan(dateBox.y + dateBox.height);
expect(clearBox.x + clearBox.width).toBeCloseTo(authorBox.x + authorBox.width, 0);
await expect(clear).toBeInViewport({ ratio: 1 });
await page.keyboard.press("Escape");
await expect(popup).toBeHidden();
await page.evaluate(async () => {
const projectModule = "/src/platform/project.ts";
const { useProject } = await import(/* @vite-ignore */ projectModule);
const { settings } = useProject.getState();
useProject.setState({
settings: { ...settings, vcs: { ...settings?.vcs, commit: { ...settings?.vcs?.commit, nonModal: false } } },
});
});
await page.setViewportSize({ width: 650, height: 650 });
await page.keyboard.press("Meta+k");
const dialog = page.getByRole("dialog", { name: "Commit Changes", exact: true });
const options = dialog.getByRole("group", { name: "Commit Options", exact: true });
const compactAuthor = options.getByRole("textbox", { name: "Author", exact: true });
const compactDate = options.getByLabel("Author date", { exact: true });
const compactClear = options.getByRole("button", { name: "Clear author date", exact: true });
await expect(compactAuthor).toHaveValue(name);
await expect(compactDate).toHaveValue(time);
const labelBox = (await options.getByText("Author:", { exact: true }).boundingBox())!;
const inputBox = (await compactAuthor.boundingBox())!;
expect(inputBox.x).toBeCloseTo(labelBox.x, 0);
expect(inputBox.y).toBeGreaterThanOrEqual(labelBox.y + labelBox.height);
const box = (await compactDate.boundingBox())!;
const buttonBox = (await compactClear.boundingBox())!;
expect(box.width).toBeCloseTo(inputBox.width, 0);
expect(buttonBox.y).toBeGreaterThanOrEqual(box.y + box.height);
expect(await options.evaluate((node) => node.scrollWidth - node.clientWidth)).toBeLessThanOrEqual(1);
await compactClear.click();
await expect(compactDate).toHaveValue("");
await expect(compactClear).toBeHidden();
await expect(compactAuthor).toHaveValue(name);
});
test("the Commit window gives its message preferred focus", async ({ workbench: page }) => {
await stubRepository(page);
const stripe = page.locator('[data-stripe-button="commit"]');
-104
View File
@@ -1,104 +0,0 @@
import { expect, stubDesktop, test } from "./fixtures";
const rootSubject = "Start warehouse reporting";
const mergeSubject = "Merge reporting changes";
const firstSubject = "Align regional settlement totals with the warehouse ledger before monthly reconciliation closes";
const secondSubject = "Keep archived settlement adjustments in the regional audit trail after the ledger is rebuilt";
test("Git Log commit choices fit their rows and navigate by keyboard after filtering", async ({ workbench: page }) => {
await page.setViewportSize({ width: 1040, height: 700 });
await stubDesktop(page);
await page.evaluate(
async ({ mergeSubject, firstSubject, secondSubject, rootSubject }) => {
const root = "/dev/acme-api";
const changes = [
[mergeSubject, "Merge Author", [1, 2]],
[firstSubject, "Priya Kapoor", [3]],
[secondSubject, "Morgan Olsen", [3]],
[rootSubject, "Initial Author", []],
] as const;
const id = (i: number) => String(i + 1).repeat(40);
const commits = changes.map(([summary, author, parents], i) => ({
id: id(i),
shortId: id(i).slice(0, 8),
parents: parents.map(id),
refs: i === 0 ? ["HEAD", "main"] : [],
author,
email: "[email protected]",
timeMs: Date.UTC(2026, 10, 15 - i, 10 + i, 30),
summary,
message: summary,
}));
const handlers = window.__ipc.handlers;
handlers.vcs_log = ({ query }) => {
const { skip, limit, range } = query as { skip: number; limit: number; range?: string };
return range ? [] : commits.slice(skip, limit ? skip + limit : undefined);
};
handlers.vcs_log_refs = () => ({});
handlers.vcs_log_users = () => [];
handlers.vcs_branches = () => [];
handlers.vcs_branch_info = () => ({ head: "main", headCommit: id(0), ahead: 0, behind: 0 });
handlers.vcs_config_get = () => null;
handlers.vcs_commit_files = () => [];
handlers.vcs_log_details_batch = ({ revisions }) =>
(revisions as string[]).map(() => ({ message: "", containingBranches: [], signature: "N" }));
const vcsModule = "/src/features/vcs/store.ts";
const contextModule = "/src/platform/context.ts";
const actionsModule = "/src/platform/actions.ts";
const { useVcs } = await import(/* @vite-ignore */ vcsModule);
const { setContext } = await import(/* @vite-ignore */ contextModule);
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
useVcs.setState({ available: true, root, repo: root, roots: [root], branchesLoaded: true });
setContext("vcsAvailable", true);
await executeAction("vcs.showLog");
},
{ mergeSubject, firstSubject, secondSubject, rootSubject },
);
const log = page.getByRole("listbox", { name: "Commits", exact: true });
const merge = log.getByRole("option", { name: new RegExp(mergeSubject) });
await merge.click();
await log.press("ArrowRight");
const chooser = page.getByRole("dialog", { name: "Select Parent Commit", exact: true });
const options = chooser.getByRole("option");
const filter = chooser.getByRole("combobox", { name: "Search commits" });
await expect(filter).toBeFocused();
await expect(options).toHaveCount(2);
const before = (await chooser.boundingBox())!;
expect(before.height).toBeLessThan(200);
const first = options.filter({ hasText: firstSubject });
const subject = first.getByText(firstSubject, { exact: true });
const author = first.getByText("Priya Kapoor", { exact: true });
const hash = first.getByText("22222222", { exact: true });
await expect(subject).toHaveCSS("font-size", "13px");
await expect(author).toHaveCSS("font-size", "12px");
expect((await subject.boundingBox())!.y).toBeLessThan((await hash.boundingBox())!.y);
await expect(subject.locator("..")).toHaveAttribute("title", /Priya Kapoor/);
await page.setViewportSize({ width: 440, height: 520 });
const narrow = (await chooser.boundingBox())!;
expect(narrow.x + narrow.width).toBeLessThanOrEqual(440);
expect(await chooser.evaluate((node) => node.scrollWidth - node.clientWidth)).toBeLessThanOrEqual(1);
await filter.fill("No such change");
await expect(chooser.getByText("No commits", { exact: true })).toBeVisible();
await filter.press("Enter");
await expect(chooser).toBeVisible();
await filter.fill("Morgan Olsen");
await expect(options).toHaveCount(1);
await expect(options.first()).toContainText(secondSubject);
await filter.fill("");
await expect(options).toHaveCount(2);
await filter.press("ArrowDown");
await expect(options.filter({ hasText: secondSubject })).toHaveAttribute("aria-selected", "true");
await filter.press("Enter");
await expect(chooser).toBeHidden();
await expect(log.getByRole("option", { name: new RegExp(secondSubject) })).toHaveAttribute("aria-selected", "true");
await log.getByRole("option", { name: new RegExp(rootSubject) }).click();
await log.press("ArrowLeft");
const children = page.getByRole("dialog", { name: "Select Child Commit", exact: true });
await expect(children.getByRole("option")).toHaveCount(2);
await children.getByRole("option", { name: new RegExp(firstSubject) }).click();
await expect(children).toBeHidden();
await expect(log.getByRole("option", { name: new RegExp(firstSubject) })).toHaveAttribute("aria-selected", "true");
});
+2 -2
View File
@@ -26,12 +26,12 @@ describe("the Language smoke workflow", () => {
const { files, problems } = await smokeInputs(repo, workflow);
expect(problems).toEqual([]);
expect(describeUnselected(await unselected(workflow, [...files.keys()]), files)).toBe("");
});
}, 20000);
it("runs every language when a crate the smoke runs changes", async () => {
const crates = rustSmokeInputs(repo);
expect(describeUnselected(await unselected(workflow, [...crates.keys()]), crates)).toBe("");
});
}, 20000);
});
const dirs: string[] = [];
+7 -7
View File
@@ -33,15 +33,17 @@ export function CommitAuthorFields({
focusAuthor?: boolean;
onChange: (update: Partial<CommitAuthor>) => void;
}) {
const authorId = useId();
const authorDateId = useId();
const date = authorDate ? new Date(authorDate) : null;
return (
<>
<label className={styles.optField}>
<span>
<div className={styles.optIdentity}>
<div className={styles.optIdentityFields}>
<label htmlFor={authorId}>
<T>Author:</T>
</span>
</label>
<Input
id={authorId}
value={author}
title={tx(
preserveOriginal
@@ -53,8 +55,6 @@ export function CommitAuthorFields({
autoSelect={focusAuthor}
onChange={(e) => onChange({ author: e.target.value })}
/>
</label>
<div className={styles.optDate}>
<label htmlFor={authorDateId}>
<T>Author date</T>
</label>
@@ -81,6 +81,6 @@ export function CommitAuthorFields({
)}
</div>
</div>
</>
</div>
);
}
-65
View File
@@ -1,65 +0,0 @@
.search {
display: flex;
padding: var(--space-2) var(--space-3);
}
.search > * {
flex: 1;
min-width: 0;
}
.results {
display: flex;
flex-direction: column;
max-height: max(84px, calc(100vh - 144px));
margin-bottom: var(--space-2);
}
.list {
flex: 1;
}
.choice {
display: flex;
flex-direction: column;
width: 100%;
min-width: 0;
}
.choice > span {
pointer-events: none;
}
.subject,
.author,
.date {
overflow: hidden;
text-overflow: ellipsis;
}
.subject {
font-size: var(--fs-ui);
}
.metadata {
display: flex;
gap: var(--space-2);
align-items: baseline;
color: var(--fg-muted);
font-size: var(--fs-small);
}
.hash {
flex: none;
font-family: var(--font-mono);
}
.author {
flex: 1;
min-width: 0;
}
.date {
flex: none;
max-width: 50%;
}
+11 -70
View File
@@ -1,14 +1,9 @@
import { useId, useState, type KeyboardEvent } from "react";
import { useState } from "react";
import type { Commit } from "@/bindings";
import { tx } from "@/platform/i18n";
import { Dialog, List, SearchField, T, listNavigate } from "@/ui";
import { Dialog, List, SearchField } from "@/ui";
import { openDialog } from "./dialogs";
import { formatTime } from "./model";
import { commitKey } from "./multiRoot";
import styles from "./CommitChooser.module.css";
const ROW_HEIGHT = 42;
const VISIBLE_ROWS = 8;
import { useRowHeight } from "@/ui/density";
export function chooseLogCommit(commits: Commit[], title: string): Promise<Commit | null> {
return new Promise((resolve) => {
@@ -34,76 +29,22 @@ function CommitChooser({
title: string;
onDone: (commit: Commit | null) => void;
}) {
const listId = useId();
const rowHeight = useRowHeight(26);
const [query, setQuery] = useState("");
const [active, setActive] = useState(0);
const filter = query.toLocaleLowerCase();
const shown = commits.filter((commit) =>
`${commit.id} ${commit.summary} ${commit.author}`.toLocaleLowerCase().includes(filter),
const shown = commits.filter((c) =>
`${c.id} ${c.summary} ${c.author}`.toLocaleLowerCase().includes(query.toLocaleLowerCase()),
);
const selected = Math.min(active, shown.length - 1);
const onKeyDown = (event: KeyboardEvent) => {
if (event.nativeEvent.isComposing) return;
if (event.key === "Enter") {
event.preventDefault();
if (shown[selected]) onDone(shown[selected]);
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
const next = listNavigate(event.key, { items: shown, active: selected, wrap: true });
if (next === null) return;
event.preventDefault();
setActive(next);
}
};
return (
<Dialog open title={title} onClose={() => onDone(null)} width={520}>
<div className={styles.search}>
<SearchField
data-autofocus
role="combobox"
aria-expanded
aria-controls={listId}
aria-autocomplete="list"
aria-activedescendant={selected >= 0 ? `${listId}-${selected}` : undefined}
value={query}
onChange={(value) => {
setQuery(value);
setActive(0);
}}
onKeyDown={onKeyDown}
placeholder="Search commits"
aria-label="Search commits"
/>
</div>
<div
className={styles.results}
style={{ height: Math.max(1, Math.min(commits.length, VISIBLE_ROWS)) * ROW_HEIGHT }}
>
<SearchField value={query} onChange={setQuery} placeholder="Search commits" aria-label="Search commits" />
<div style={{ height: 260, display: "flex" }}>
<List
id={listId}
items={shown}
getKey={commitKey}
activeIndex={selected}
onActiveChange={setActive}
renderItem={(c) => `${c.shortId} ${c.summary} — ${c.author}`}
onActivate={onDone}
focusable={false}
rowHeight={ROW_HEIGHT}
aria-label={tx(title)}
empty={<T>No commits</T>}
className={styles.list}
renderItem={(commit) => {
const date = formatTime(commit.timeMs);
return (
<span className={styles.choice} title={[commit.summary, commit.shortId, commit.author, date].join("\n")}>
<span className={styles.subject}>{commit.summary}</span>
<span className={styles.metadata}>
<span className={styles.hash}>{commit.shortId}</span>
<span className={styles.author}>{commit.author}</span>
{date && <span className={styles.date}>{date}</span>}
</span>
</span>
);
}}
rowHeight={rowHeight}
aria-label={title}
/>
</div>
</Dialog>
+19 -13
View File
@@ -309,7 +309,7 @@
}
/* Commit Options popup (gear next to Commit). */
.options {
width: 340px;
width: 384px;
max-height: min(560px, 80vh);
overflow: auto;
padding: 4px 16px 12px;
@@ -350,29 +350,35 @@
flex: 1;
min-width: 0;
}
.optField {
display: flex;
.optIdentity {
container-type: inline-size;
}
.optIdentityFields {
display: grid;
grid-template-columns: minmax(0, 1fr);
align-items: center;
gap: var(--space-2);
gap: var(--space-1) var(--space-2);
color: var(--fg);
font-size: var(--fs-ui);
}
.optField > :last-child {
flex: 1;
min-width: 0;
.optIdentityFields > label {
overflow-wrap: anywhere;
}
.optDate {
display: flex;
flex-direction: column;
gap: var(--space-1);
color: var(--fg);
@container (min-width: 328px) {
.optIdentityFields {
grid-template-columns: fit-content(32%) minmax(0, 1fr);
row-gap: var(--space-1-5);
}
}
.optDateInput {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: var(--space-1);
}
.optDateInput input {
flex: 1;
flex: 1 1 min(100%, 212px);
min-width: 0;
}
.optLink {