refactor: remove legacy workspace UI state

This commit is contained in:
2026-08-10 22:56:00 +02:00
parent fc19b0d67c
commit 90684c3280
12 changed files with 283 additions and 130 deletions
+14 -22
View File
@@ -27,13 +27,13 @@ beforeEach(() => {
http.get("/api/workspace-registry/status", () =>
HttpResponse.json({ branch: "main", head: "a".repeat(40), ahead: 0, behind: 0, degraded: false })),
http.get("/api/workspaces", () => HttpResponse.json([{
id: "psd-clinical", name: "PSD Clinical", displayName: "PSD Clinical", description: "Clinical data",
language: "en", file: "workspaces/psd-clinical.yaml",
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/tmp/psd", state: "operational" },
id: "psd-clinical", name: "psd-clinical", displayName: "PSD Clinical", description: "Clinical data",
language: "en", file: "psd-clinical.yaml",
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/tmp/psd" },
}])),
http.get("/api/workspaces/psd-clinical", () => HttpResponse.json({
workspace,
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/tmp/psd", state: "operational" },
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/tmp/psd" },
})),
);
});
@@ -163,12 +163,12 @@ test("proposes a different valid ID when duplicating a 63-character workspace ID
const maxWorkspace = { ...workspace, workspace: { ...workspace.workspace, id: maxId } };
server.use(
http.get("/api/workspaces", () => HttpResponse.json([{
id: maxId, name: "Maximum", displayName: "Maximum", language: "en", file: `workspaces/${maxId}.yaml`,
revision: { id: maxId, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/tmp/maximum", state: "operational" },
id: maxId, name: maxId, displayName: "Maximum", language: "en", file: `${maxId}.yaml`,
revision: { id: maxId, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/tmp/maximum" },
}])),
http.get(`/api/workspaces/${maxId}`, () => HttpResponse.json({
workspace: maxWorkspace,
revision: { id: maxId, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/tmp/maximum", state: "operational" },
revision: { id: maxId, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/tmp/maximum" },
})),
);
renderManager();
@@ -213,23 +213,15 @@ test("runs validation and installation test with only sanitized messages", async
expect(within(screen.getByTestId("workspace-diagnostics")).queryByText(/password|token|secret/i)).not.toBeInTheDocument();
});
test("shows a migration banner for legacy descriptors and does not load editor details for them", async () => {
test("loads a state-free registry revision and displays only its commit", async () => {
const user = userEvent.setup();
server.use(
http.get("/api/workspaces", () => HttpResponse.json([
{
id: "psd-clinical", name: "PSD Clinical", displayName: "PSD Clinical", description: "Clinical data",
language: "en", file: "workspaces/psd-clinical.yaml",
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/tmp/psd", state: "migration_required" },
},
])),
);
renderManager();
await user.click(await screen.findByRole("button", { name: "PSD Clinical" }));
expect(await screen.findByText("This workspace uses a legacy descriptor and must be migrated to schema v3 before new sessions or publication.")).toBeVisible();
expect(screen.queryByLabelText("Vector collection")).not.toBeInTheDocument();
expect(await screen.findByLabelText("Vector collection")).toBeVisible();
expect(screen.getByText(`Revision ${"a".repeat(12)}`)).toBeVisible();
expect(screen.queryByText(/migration required/i)).not.toBeInTheDocument();
});
test("shows an actionable unavailable message when a workspace summary omits its canonical revision", async () => {
@@ -237,8 +229,8 @@ test("shows an actionable unavailable message when a workspace summary omits its
server.use(
http.get("/api/workspaces", () => HttpResponse.json([
{
id: "broken-workspace", name: "Broken workspace", displayName: "Broken workspace", description: "Broken data",
language: "en", file: "workspaces/broken-workspace.yaml",
id: "broken-workspace", name: "broken-workspace", displayName: "Broken workspace", description: "Broken data",
language: "en", file: "broken-workspace.yaml",
},
])),
);
@@ -288,7 +280,7 @@ test("shows an accessible retry when the selected workspace detail query fails",
calls += 1;
return calls === 1 ? new HttpResponse(null, { status: 503 }) : HttpResponse.json({
workspace,
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/tmp/psd", state: "operational" },
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/tmp/psd" },
});
}));
renderManager();