mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-22 23:56:05 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
56cd621f72 |
No files matched your search
Generated
+4
-4
@@ -2361,9 +2361,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b"
|
||||
|
||||
[[package]]
|
||||
name = "form_urlencoded"
|
||||
version = "1.2.3"
|
||||
version = "1.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e"
|
||||
checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf"
|
||||
dependencies = [
|
||||
"percent-encoding",
|
||||
]
|
||||
@@ -10827,9 +10827,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "2.5.9"
|
||||
version = "2.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a"
|
||||
checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed"
|
||||
dependencies = [
|
||||
"form_urlencoded",
|
||||
"idna",
|
||||
|
||||
@@ -720,81 +720,6 @@ 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,
|
||||
}) => {
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
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");
|
||||
});
|
||||
@@ -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[] = [];
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
.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%;
|
||||
}
|
||||
@@ -1,9 +1,14 @@
|
||||
import { useState } from "react";
|
||||
import { useId, useState, type KeyboardEvent } from "react";
|
||||
import type { Commit } from "@/bindings";
|
||||
import { Dialog, List, SearchField } from "@/ui";
|
||||
import { tx } from "@/platform/i18n";
|
||||
import { Dialog, List, SearchField, T, listNavigate } from "@/ui";
|
||||
import { openDialog } from "./dialogs";
|
||||
import { formatTime } from "./model";
|
||||
import { commitKey } from "./multiRoot";
|
||||
import { useRowHeight } from "@/ui/density";
|
||||
import styles from "./CommitChooser.module.css";
|
||||
|
||||
const ROW_HEIGHT = 42;
|
||||
const VISIBLE_ROWS = 8;
|
||||
|
||||
export function chooseLogCommit(commits: Commit[], title: string): Promise<Commit | null> {
|
||||
return new Promise((resolve) => {
|
||||
@@ -29,22 +34,76 @@ function CommitChooser({
|
||||
title: string;
|
||||
onDone: (commit: Commit | null) => void;
|
||||
}) {
|
||||
const rowHeight = useRowHeight(26);
|
||||
const listId = useId();
|
||||
const [query, setQuery] = useState("");
|
||||
const shown = commits.filter((c) =>
|
||||
`${c.id} ${c.summary} ${c.author}`.toLocaleLowerCase().includes(query.toLocaleLowerCase()),
|
||||
const [active, setActive] = useState(0);
|
||||
const filter = query.toLocaleLowerCase();
|
||||
const shown = commits.filter((commit) =>
|
||||
`${commit.id} ${commit.summary} ${commit.author}`.toLocaleLowerCase().includes(filter),
|
||||
);
|
||||
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}>
|
||||
<SearchField value={query} onChange={setQuery} placeholder="Search commits" aria-label="Search commits" />
|
||||
<div style={{ height: 260, display: "flex" }}>
|
||||
<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 }}
|
||||
>
|
||||
<List
|
||||
id={listId}
|
||||
items={shown}
|
||||
getKey={commitKey}
|
||||
renderItem={(c) => `${c.shortId} ${c.summary} — ${c.author}`}
|
||||
activeIndex={selected}
|
||||
onActiveChange={setActive}
|
||||
onActivate={onDone}
|
||||
rowHeight={rowHeight}
|
||||
aria-label={title}
|
||||
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>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Dialog>
|
||||
|
||||
@@ -403,28 +403,24 @@
|
||||
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;
|
||||
padding: var(--space-1) 10px 0;
|
||||
max-height: 120px;
|
||||
overflow: auto;
|
||||
padding: 4px 10px 0;
|
||||
color: var(--fg-secondary);
|
||||
overflow-wrap: anywhere;
|
||||
font-size: var(--fs-ui);
|
||||
font-size: var(--fs-small);
|
||||
line-height: 1.4;
|
||||
}
|
||||
.checkProblemsIcon {
|
||||
@@ -438,21 +434,13 @@
|
||||
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);
|
||||
|
||||
Reference in new issue
Block a user