Files
paseo/packages/app/e2e/browser/workspace-archive-cache.spec.ts
Mohamed Boudra 25eb322ef7 fix(app): prevent archived workspaces returning from cache (#3975)
Durable replica reads could race accepted directory replacements and restore rows that had already been removed in memory. Serialize reads behind pending writes and discard reads when the host changes in flight; local archives also suppress targeted cache restoration until removal is acknowledged.
2026-08-28 13:18:26 +02:00

37 lines
1.4 KiB
TypeScript

import { expect, test } from "../support/fixtures";
import { gotoAppShell } from "../support/helpers/app";
import { waitForWorkspaceInReplicaCache } from "../support/helpers/replica-cache-storage";
import { seedWorkspace, type SeededWorkspace } from "../support/helpers/seed-client";
import {
expectWorkspaceAbsentFromSidebar,
selectWorkspaceInSidebar,
} from "../support/helpers/sidebar";
import { waitForSidebarHydration } from "../support/helpers/workspace-ui";
async function archiveWorkspaceOutsideTheApp(workspace: SeededWorkspace): Promise<void> {
const result = await workspace.client.archiveWorkspace(workspace.workspaceId);
expect(result.error).toBeNull();
}
test.describe("Workspace archive cache coherence", () => {
test("an archived selected workspace cannot return from the durable cache", async ({ page }) => {
const workspace = await seedWorkspace({ repoPrefix: "archive-cache-" });
try {
await gotoAppShell(page);
await waitForSidebarHydration(page);
await selectWorkspaceInSidebar(page, workspace.workspaceId);
await waitForWorkspaceInReplicaCache(page, workspace.workspaceId);
await archiveWorkspaceOutsideTheApp(workspace);
await expectWorkspaceAbsentFromSidebar(page, workspace.workspaceId);
await expect(page.getByText("Workspace unavailable", { exact: true })).toBeVisible({
timeout: 30_000,
});
} finally {
await workspace.cleanup();
}
});
});