Compare commits

..
Author SHA1 Message Date
paseo-bot[bot]andClaude Opus 5.5 32cae04627 Wait for the plugin results route after a directory search (#11939)
The URL changes as soon as the directory submits a search, but the
results route renders only after its registry server call returns. On a
loaded CI runner that call took over 5 s, so the WebKit test failed at
the results heading. Give the directory-to-results transition the same
10 s budget the missed-input-event test already used, in one helper.

Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 21:18:20 +00:00
4 changed files with 13 additions and 38 deletions
@@ -2,7 +2,7 @@ import type pino from "pino";
import type { SubscribeCheckoutDiffRequest, SessionOutboundMessage } from "./messages.js";
import type { WorkspaceGitService } from "./workspace-git-service.js";
import type { WorkspaceRuntimeStore } from "./workspace-runtime-store/index.js";
import { DiffReadError, DiffSubscriptions, type CommitFileRead } from "./diff/index.js";
import { DiffSubscriptions, type CommitFileRead } from "./diff/index.js";
import {
DiffOpcode,
materializeDiffFile,
@@ -169,11 +169,7 @@ export class CheckoutDiffManager {
await subscription.start();
return { initial: await initial, unsubscribe };
} catch (error) {
const checkoutError =
error instanceof DiffReadError && error.code === "NOT_GIT_REPO"
? { code: error.code, message: error.message }
: toCheckoutError(error);
return { initial: { cwd, files: [], error: checkoutError }, unsubscribe() {} };
return { initial: { cwd, files: [], error: toCheckoutError(error) }, unsubscribe() {} };
}
}
scheduleRefreshForCwd(cwd: string): Promise<void> {
@@ -70,29 +70,6 @@ afterEach(async () => {
await ctx.cleanup();
}, 60000);
test("preserves the non-git directory error in legacy checkout diff subscriptions", async () => {
const cwd = tmpCwd();
const subscription = ctx.client.observeCheckoutDiff(cwd, { mode: "uncommitted" });
try {
expect(
await ctx.client.readDiff({
cwd,
base: { kind: "rev", rev: "HEAD" },
head: { kind: "worktree" },
}),
).toMatchObject({ phase: "error", error: { code: "NOT_GIT_REPO" } });
expect(await subscription.ready).toMatchObject({
files: [],
error: { code: "NOT_GIT_REPO" },
});
} finally {
await subscription.release();
rmSync(cwd, { recursive: true, force: true });
}
});
test("pushes file-level checkout diff updates with deterministic path order", async () => {
const cwd = tmpCwd();
-1
View File
@@ -488,7 +488,6 @@ function diffError(error: unknown): DiffError {
};
}
export { DiffReadError } from "./git.js";
export { DiffSession } from "./session.js";
function endpointKey(endpoint: DiffEndpoint): string[] {
+11 -8
View File
@@ -185,9 +185,7 @@ test("filters by search and clears to all plugins", async ({ page }) => {
await submitSearch(page, "graphite");
await expect(page).toHaveURL(/\/plugins\/all\?q=graphite$/);
await expect(
page.getByRole("heading", { level: 1, name: /^Results for “graphite”/ }),
).toBeVisible();
await expectSearchResultsAfterDirectory(page, "graphite");
await expect(page.getByRole("main").getByRole("link", { name: /Graphite/ })).toBeVisible();
await expect(page.getByRole("link", { name: /Dracula/ })).toHaveCount(0);
@@ -217,10 +215,7 @@ test("submits the visible search term when its input event was missed", async ({
await page.keyboard.press("Enter");
await expect(page).toHaveURL(/\/plugins\/all\?q=graphite&window=month$/);
// The URL changes before the results route finishes loading its data and code.
await expect(
page.getByRole("heading", { level: 1, name: /^Results for “graphite”/ }),
).toBeVisible({ timeout: 10000 });
await expectSearchResultsAfterDirectory(page, "graphite");
await expect(page.getByRole("link", { name: "This month" })).toHaveAttribute(
"aria-current",
"true",
@@ -286,7 +281,7 @@ test("searches from the directory on submit, and Back returns to the directory",
await page.keyboard.press("Enter");
await expect(page).toHaveURL(/\/plugins\/all\?q=gra$/);
await expect(page.getByRole("heading", { level: 1, name: /^Results for “gra”/ })).toBeVisible();
await expectSearchResultsAfterDirectory(page, "gra");
expect(await historyLength(page)).toBe(entries + 1);
await page.goBack();
@@ -501,6 +496,14 @@ async function expectDirectorySearch(page: Page, term: string, window: string) {
);
}
// The URL changes as soon as the directory submits, but the results route shows only after
// its registry server call returns. On a loaded CI runner that call has taken over 4 s.
async function expectSearchResultsAfterDirectory(page: Page, term: string) {
await expect(
page.getByRole("heading", { level: 1, name: new RegExp(`^Results for “${term}”`) }),
).toBeVisible({ timeout: 10000 });
}
async function typeSearch(page: Page, term: string) {
await page.getByRole("searchbox", { name: "Search plugins" }).pressSequentially(term);
}