Compare commits

..
Author SHA1 Message Date
l0ng-ai 33614e81ef fix(debugger): give Memory class filtering room 2026-11-23 09:06:15 +08:00
l0ng-ai 844c2f3145 test(maven): wait for the background refresh of jdtls import roots (#5272)
external_maven_link_persists_reloads_and_unlink_keeps_files failed on the macOS runner: setting languages.java.maven.linkedProjects refreshes the language server's import roots on a blocking task, and the test read them right after build_model returned. It now waits up to 5 s for them to change.
2026-11-23 05:18:24 +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
10 changed files with 150 additions and 259 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",
+15 -2
View File
@@ -49,7 +49,7 @@ async fn external_maven_link_persists_reloads_and_unlink_keeps_files() {
assert_eq!(b.pom, canonical);
assert_eq!(dunce::canonicalize(root.join(&b.dir)).unwrap(), sibling);
assert_eq!(host.project("main").unwrap().content_roots(), vec![sibling.clone()]);
assert_eq!(host.project("main").unwrap().lsp.jdtls_import_roots(), vec![sibling.clone()]);
assert_eq!(import_roots(&host, |roots| !roots.is_empty()).await, vec![sibling.clone()]);
let reloaded = ops::build::build_model(&host, "main").await.unwrap();
assert_eq!(
@@ -63,13 +63,26 @@ async fn external_maven_link_persists_reloads_and_unlink_keeps_files() {
let gone = ops::build::build_model(&host, "main").await.unwrap();
assert!(gone.maven.unwrap().projects.iter().all(|p| p.artifact_id != "b"));
assert!(host.project("main").unwrap().content_roots().is_empty());
assert!(host.project("main").unwrap().lsp.jdtls_import_roots().is_empty());
assert!(import_roots(&host, |roots| roots.is_empty()).await.is_empty());
assert_eq!(saved(), Vec::<String>::new());
assert_eq!(std::fs::read_to_string(root.join("pom.xml")).unwrap(), a_pom);
assert_eq!(std::fs::read_to_string(sibling.join("pom.xml")).unwrap(), b_pom);
host.shutdown().await;
}
/// The language server's Maven import roots once `ready` holds: a settings change refreshes them in
/// the background.
async fn import_roots(host: &Host, ready: impl Fn(&[std::path::PathBuf]) -> bool) -> Vec<std::path::PathBuf> {
for _ in 0..200 {
let roots = host.project("main").unwrap().lsp.jdtls_import_roots();
if ready(&roots) {
return roots;
}
tokio::time::sleep(std::time::Duration::from_millis(25)).await;
}
host.project("main").unwrap().lsp.jdtls_import_roots()
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn reactor_module_beside_a_trusted_project_is_a_content_root_until_removed() {
let temp = tempfile::tempdir().unwrap();
+78
View File
@@ -3,6 +3,7 @@
* with its frames and variables, and stepping and resuming go back to the adapter. The adapter is
* stubbed at the IPC layer; `crates/ide-dap/tests` drives real ones.
*/
import type { JvmMemoryResult } from "../src/platform/ipc";
import { expect, ipcCalls, openFromTree, stubDesktop, test } from "./fixtures";
const ROOT = "/dev/acme-api";
@@ -114,6 +115,83 @@ test("stops at a breakpoint, shows frames and variables, steps and resumes", asy
await expect(debug.getByText("CreateOrderRequest(sku='A-1', qty=2)")).toBeHidden();
});
test("Memory gives class filtering the available toolbar width and exposes changed-only filtering", async ({
workbench: page,
}) => {
const rows = [
{ name: "OrderCache", instances: 64, deltaInstances: 12 },
{ name: "OrderRepository", instances: 16, deltaInstances: 0 },
].map((row) => ({ ...row, bytes: row.instances * 16, deltaBytes: null, module: null, ambiguous: false }));
const result: JvmMemoryResult = {
status: "ready",
snapshot: {
rows,
totalInstances: 80,
totalBytes: 1280,
javaVersion: "21",
takenWhileSuspended: true,
hasBaseline: true,
elapsedMs: 5,
source: "debugger",
},
};
await stubDesktop(page);
await page.evaluate(
async ({ result, id }) => {
const caps = { jvmMemory: true, jvmHeap: true };
window.__ipc.handlers.debug_capabilities = () => caps;
window.__ipc.handlers.debug_jvm_memory_classes = () => result;
const debugPath = "/src/features/debugger/state.ts";
const { adoptSession } = await import(/* @vite-ignore */ debugPath);
adoptSession(id, { adapter: "java-debug", name: "Billing Service", status: "paused", caps });
const dockPath = "/src/workbench/toolwindows/store.ts";
const layout = await import(/* @vite-ignore */ dockPath);
layout.moveToolWindow("debug", "bottom");
layout.setToolWindowSize("bottom", 300);
layout.showToolWindow("debug", true);
},
{ result, id: SESSION },
);
const debug = page.getByRole("region", { name: "Debug", exact: true });
await debug.getByRole("tab", { name: "Memory" }).click();
const toolbar = debug.getByRole("toolbar", { name: "Memory", exact: true });
const filter = toolbar.getByRole("textbox", { name: "Filter classes" });
const options = toolbar.getByRole("button", { name: "View Options" });
const grid = debug.getByRole("grid", { name: "Memory", exact: true });
await expect(grid.getByText("OrderRepository", { exact: true })).toBeVisible();
expect((await filter.boundingBox())!.width).toBeGreaterThan((await toolbar.boundingBox())!.width / 2);
await page.evaluate(async () => {
const dockPath = "/src/workbench/toolwindows/store.ts";
const layout = await import(/* @vite-ignore */ dockPath);
layout.moveToolWindow("debug", "right");
layout.setToolWindowSize("right", 330);
});
await expect.poll(async () => (await toolbar.boundingBox())!.width).toBeCloseTo(330, 0);
const bar = (await toolbar.boundingBox())!;
const gear = (await options.boundingBox())!;
const input = (await filter.boundingBox())!;
expect(input.width).toBeGreaterThan(bar.width / 2);
expect(input.x + input.width).toBeLessThan(gear.x);
expect(gear.x + gear.width).toBeLessThanOrEqual(bar.x + bar.width);
await filter.fill("cache");
await expect(grid.getByText("OrderRepository", { exact: true })).toBeHidden();
await toolbar.getByRole("button", { name: "Clear", exact: true }).click();
await expect(grid.getByText("OrderRepository", { exact: true })).toBeVisible();
await options.press("Enter");
const changed = page.getByRole("menuitemcheckbox", { name: "Changed only" });
await expect(changed).not.toBeChecked();
await changed.press("Enter");
await expect(grid.getByText("OrderRepository", { exact: true })).toBeHidden();
await expect(options).toHaveAttribute("aria-pressed", "true");
await expect(options).toBeFocused();
await options.press("Enter");
await expect(changed).toBeChecked();
});
test("Evaluate keeps a multiline expression and its result visible in a short dialog", async ({ workbench: page }) => {
await page.setViewportSize({ width: 580, height: 420 });
await stubDesktop(page);
-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[] = [];
@@ -241,7 +241,8 @@ describe("MemoryView", () => {
expect(screen.getByRole("button", { name: "刷新内存视图" }).getAttribute("data-tooltip")).toBe("刷新内存视图");
const filter = screen.getByRole("textbox", { name: "筛选类" });
expect(filter.getAttribute("placeholder")).toBe("筛选类");
expect(screen.getByRole("checkbox", { name: "仅显示有变化的" })).toBeTruthy();
fireEvent.click(screen.getByRole("button", { name: "视图选项" }));
expect(screen.getByRole("menuitemcheckbox", { name: "仅显示有变化的" })).toBeInTheDocument();
} finally {
await setLocale("en");
}
@@ -299,10 +300,15 @@ describe("MemoryView", () => {
expect(screen.getByText("Cache$Entry")).toBeTruthy();
fireEvent.change(screen.getByRole("textbox", { name: "Filter classes" }), { target: { value: "" } });
fireEvent.click(screen.getByRole("checkbox", { name: "Changed only" }));
const options = screen.getByRole("button", { name: "View Options" });
fireEvent.click(options);
fireEvent.click(screen.getByRole("menuitemcheckbox", { name: "Changed only", checked: false }));
expect(screen.getByText("Heap$Live")).toBeTruthy();
expect(screen.queryByText("Cache$Entry")).toBeNull();
expect(screen.queryByText("Dup")).toBeNull();
expect(options).toHaveAttribute("aria-pressed", "true");
fireEvent.click(options);
expect(screen.getByRole("menuitemcheckbox", { name: "Changed only", checked: true })).toBeInTheDocument();
});
it("sorts by the clicked column and reports it with aria-sort", async () => {
@@ -18,8 +18,8 @@
}
.filter {
flex: 0 1 240px;
min-width: 80px;
flex: 1;
min-width: 0;
}
.banner,
+30 -8
View File
@@ -1,7 +1,7 @@
/** Memory tab of the Debug tool window: live instance counts per class of the debugged JVM, and heap capture. */
import { useEffect, useMemo } from "react";
import { useEffect, useMemo, useRef, useState } from "react";
import clsx from "clsx";
import { Checkbox, Icon, IconButton, Input, List, T } from "@/ui";
import { Icon, IconButton, List, Menu, SearchField, T } from "@/ui";
import { executeAction } from "@/platform/actions";
import { useTx } from "@/platform/i18n";
import type { JvmClassRow, JvmMemorySnapshot } from "@/platform/ipc";
@@ -112,6 +112,8 @@ export function MemoryView({ session }: { session: DebugSession }) {
const id = session.id;
const entry = useMemory((s) => s.bySession[id]);
const query = entry?.query ?? DEFAULT_QUERY;
const optionsButton = useRef<HTMLButtonElement>(null);
const [optionsOpen, setOptionsOpen] = useState(false);
const result = entry?.result ?? null;
const snapshot = entry?.snapshot ?? null;
const source = snapshot?.source ?? "histogram";
@@ -161,17 +163,37 @@ export function MemoryView({ session }: { session: DebugSession }) {
disabled={entry?.loading || !canRefresh}
/>
<HeapCaptureButton session={session} />
<Input
<SearchField
className={styles.filter}
value={query.filter}
onChange={(e) => setMemoryQuery(id, { filter: e.target.value })}
onChange={(filter) => setMemoryQuery(id, { filter })}
placeholder="Filter classes"
aria-label="Filter classes"
/>
<Checkbox
checked={query.changedOnly}
onChange={(changedOnly) => setMemoryQuery(id, { changedOnly })}
label="Changed only"
<IconButton
ref={optionsButton}
icon="settings"
title="View Options"
size="small"
iconSize={16}
pressed={query.changedOnly}
aria-haspopup="menu"
aria-expanded={optionsOpen}
onClick={() => setOptionsOpen(!optionsOpen)}
/>
<Menu
open={optionsOpen}
onClose={() => setOptionsOpen(false)}
anchor={optionsButton}
placement="bottom-end"
aria-label="View Options"
items={[
{
label: "Changed only",
checked: query.changedOnly,
run: () => setMemoryQuery(id, { changedOnly: !query.changedOnly }),
},
]}
/>
</div>
{backend && (
-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>