* fix(app): validate persisted client state Persisted replica data could satisfy TypeScript through an assertion while missing fields required by renderers. Treat every AsyncStorage value as untrusted input, clear values that fail strict schemas, and version the replica DTO so incompatible caches cannot hydrate. * fix(app): preserve validated legacy state * fix(app): preserve validated preferences Preserve supported legacy location fields and every shipped theme while keeping unknown persisted fields rejected. Align browser test seeds with the current preference shape so strict validation exercises the intended provider. * fix(app): migrate legacy agent preferences Released clients stored host/location fields and per-provider thinkingOptionId together. Migrate those exact strict bytes into current preferences without admitting unknown fields. * fix(app): preserve drafts with legacy reviews Accept the exact strict shape released for workspace review attachments so migration can discard that obsolete attachment without clearing every persisted draft.
45 lines
1.8 KiB
TypeScript
45 lines
1.8 KiB
TypeScript
import { randomUUID } from "node:crypto";
|
|
import { metroTest as test } from "../support/fixtures";
|
|
import { expectSessionsEmptyState, openSessions } from "../support/helpers/archive-tab";
|
|
import { gotoAppShell } from "../support/helpers/app";
|
|
import { buildCreateAgentPreferences, buildSeededHost } from "../support/helpers/daemon-registry";
|
|
import { startIsolatedHostDaemon } from "../support/helpers/isolated-host-daemon";
|
|
import { seedWorkspace } from "../support/helpers/seed-client";
|
|
|
|
test("Sessions shows an empty placeholder when the host has no history", async ({ page }) => {
|
|
const serverId = `srv_sessions_empty_${randomUUID().replaceAll("-", "").slice(0, 12)}`;
|
|
const daemon = await startIsolatedHostDaemon(serverId);
|
|
let workspace: Awaited<ReturnType<typeof seedWorkspace>> | null = null;
|
|
|
|
try {
|
|
workspace = await seedWorkspace({
|
|
repoPrefix: "sessions-empty-",
|
|
port: daemon.port,
|
|
});
|
|
const host = buildSeededHost({
|
|
serverId,
|
|
endpoint: `127.0.0.1:${daemon.port}`,
|
|
nowIso: new Date().toISOString(),
|
|
});
|
|
await page.route(/:6767\b/, (route) => route.abort());
|
|
await page.routeWebSocket(/:6767\b/, async (webSocket) => {
|
|
await webSocket.close({ code: 1008, reason: "Blocked developer daemon during e2e." });
|
|
});
|
|
await page.addInitScript(
|
|
({ seededHost, preferences }) => {
|
|
localStorage.setItem("@paseo:e2e", "1");
|
|
localStorage.setItem("@paseo:daemon-registry", JSON.stringify([seededHost]));
|
|
localStorage.setItem("@paseo:create-agent-preferences", JSON.stringify(preferences));
|
|
},
|
|
{ seededHost: host, preferences: buildCreateAgentPreferences() },
|
|
);
|
|
|
|
await gotoAppShell(page);
|
|
await openSessions(page);
|
|
await expectSessionsEmptyState(page);
|
|
} finally {
|
|
await workspace?.cleanup();
|
|
await daemon.close();
|
|
}
|
|
});
|