refactor: remove legacy workspace UI state
This commit is contained in:
@@ -36,8 +36,8 @@ test("submitting includes browser-local migrated preferences and calls onCreated
|
||||
workspace: "default", provider: "zai", model: "glm-5.2", thinking: "low",
|
||||
})),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([{
|
||||
id: "default", name: "default", file: "default.yaml", displayName: "Default",
|
||||
revision: { state: "operational" },
|
||||
id: "default", name: "default", file: "default.yaml", displayName: "Default", language: "en",
|
||||
revision: workspaceRevisionFixture("default"),
|
||||
}])),
|
||||
http.get("/api/workspaces/default", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("default", ["zai/glm-5.2"], "zai/glm-5.2"),
|
||||
@@ -67,7 +67,7 @@ test("first-run direct dialog creation waits for registry policy without a mount
|
||||
let policyRequestStarted = false;
|
||||
const policyMayFinish = new Promise<void>((resolve) => { releasePolicy = resolve; });
|
||||
const revision = {
|
||||
id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" as const,
|
||||
id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot",
|
||||
};
|
||||
localStorage.setItem("thothii.workspace-registry.v1.preferences", JSON.stringify({
|
||||
workspaceId: "psd-clinical", provider: "deepseek", model: "deepseek-v4-pro", thinking: "medium",
|
||||
@@ -76,7 +76,7 @@ test("first-run direct dialog creation waits for registry policy without a mount
|
||||
http.get("/api/workspaces", () => {
|
||||
summaryRequestStarted = true;
|
||||
return HttpResponse.json([{
|
||||
id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical",
|
||||
id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", language: "en",
|
||||
revision,
|
||||
}]);
|
||||
}),
|
||||
|
||||
@@ -24,12 +24,12 @@ test("new sessions send the browser-selected workspace, model, provider, and thi
|
||||
}));
|
||||
server.use(
|
||||
http.get("/api/workspaces", () => HttpResponse.json([{
|
||||
id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical",
|
||||
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" },
|
||||
id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", language: "en",
|
||||
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot" },
|
||||
}])),
|
||||
http.get("/api/workspaces/psd-clinical", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("psd-clinical"),
|
||||
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" },
|
||||
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot" },
|
||||
})),
|
||||
http.post("/api/sessions", async ({ request }) => {
|
||||
body = await request.json();
|
||||
@@ -135,10 +135,13 @@ test("footer shows cumulative k-token counters after workspace and context gauge
|
||||
http.get("/api/settings", () => HttpResponse.json({
|
||||
workspace: "psd", provider: "zai", model: "glm-5.2", thinking: "medium",
|
||||
})),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([{ name: "psd" }])),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([{
|
||||
id: "psd", name: "psd", file: "psd.yaml", displayName: "PSD", language: "en",
|
||||
revision: { id: "psd", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot" },
|
||||
}])),
|
||||
http.get("/api/workspaces/psd", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("psd"),
|
||||
revision: { id: "psd", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" },
|
||||
revision: { id: "psd", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot" },
|
||||
})),
|
||||
http.get("/api/models", () => HttpResponse.json({
|
||||
models: [{ provider: "zai", id: "glm-5.2", name: "GLM-5.2", reasoning: true }],
|
||||
@@ -172,12 +175,12 @@ test("footer limits model choices to the selected workspace policy", async () =>
|
||||
workspace: "psd-clinical", provider: "zai", model: "glm-5.2", thinking: "medium",
|
||||
})),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([{
|
||||
id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical",
|
||||
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" },
|
||||
id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", language: "en",
|
||||
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot" },
|
||||
}])),
|
||||
http.get("/api/workspaces/psd-clinical", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("psd-clinical"),
|
||||
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" },
|
||||
revision: { id: "psd-clinical", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot" },
|
||||
})),
|
||||
http.get("/api/models", () => HttpResponse.json({ models: [
|
||||
{ provider: "zai", id: "glm-5.2", name: "GLM-5.2", reasoning: true },
|
||||
@@ -198,15 +201,15 @@ test("switching workspaces replaces an out-of-policy model before session creati
|
||||
workspaceId: "research", provider: "deepseek", model: "deepseek-v4-pro", thinking: "medium",
|
||||
}));
|
||||
const revision = (id: string) => ({
|
||||
id, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" as const,
|
||||
id, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot",
|
||||
});
|
||||
server.use(
|
||||
http.get("/api/settings", () => HttpResponse.json({
|
||||
workspace: "research", provider: "deepseek", model: "deepseek-v4-pro", thinking: "medium",
|
||||
})),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([
|
||||
{ id: "research", name: "research", file: "research.yaml", displayName: "Research", revision: revision("research") },
|
||||
{ id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", revision: revision("psd-clinical") },
|
||||
{ id: "research", name: "research", file: "research.yaml", displayName: "Research", language: "en", revision: revision("research") },
|
||||
{ id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", language: "en", revision: revision("psd-clinical") },
|
||||
])),
|
||||
http.get("/api/workspaces/research", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("research", ["deepseek/deepseek-v4-pro"]),
|
||||
@@ -251,13 +254,13 @@ test("immediate submit waits for a switched workspace policy before creating a s
|
||||
workspaceId: "research", provider: "deepseek", model: "deepseek-v4-pro", thinking: "medium",
|
||||
}));
|
||||
const revision = (id: string) => ({
|
||||
id, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" as const,
|
||||
id, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot",
|
||||
});
|
||||
server.use(
|
||||
http.get("/api/settings", () => HttpResponse.json({ workspace: "research" })),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([
|
||||
{ id: "research", name: "research", file: "research.yaml", displayName: "Research", revision: revision("research") },
|
||||
{ id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", revision: revision("psd-clinical") },
|
||||
{ id: "research", name: "research", file: "research.yaml", displayName: "Research", language: "en", revision: revision("research") },
|
||||
{ id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", language: "en", revision: revision("psd-clinical") },
|
||||
])),
|
||||
http.get("/api/workspaces/research", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("research", ["deepseek/deepseek-v4-pro"]), revision: revision("research"),
|
||||
@@ -307,12 +310,12 @@ test("initial restored workspace waits for its delayed policy before creating a
|
||||
workspaceId: "psd-clinical", provider: "deepseek", model: "deepseek-v4-pro", thinking: "medium",
|
||||
}));
|
||||
const revision = (id: string) => ({
|
||||
id, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" as const,
|
||||
id, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot",
|
||||
});
|
||||
server.use(
|
||||
http.get("/api/settings", () => HttpResponse.json({ workspace: "psd-clinical" })),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([
|
||||
{ id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", revision: revision("psd-clinical") },
|
||||
{ id: "psd-clinical", name: "psd-clinical", file: "psd-clinical.yaml", displayName: "PSD Clinical", language: "en", revision: revision("psd-clinical") },
|
||||
])),
|
||||
http.get("/api/workspaces/psd-clinical", async () => {
|
||||
policyRequestStarted = true;
|
||||
@@ -347,49 +350,6 @@ test("initial restored workspace waits for its delayed policy before creating a
|
||||
}));
|
||||
});
|
||||
|
||||
test("initial submit rejects a migration-required workspace after summaries load", async () => {
|
||||
let body: unknown;
|
||||
let failure: string | undefined;
|
||||
let releaseSummaries!: () => void;
|
||||
let summaryRequestStarted = false;
|
||||
const summariesMayFinish = new Promise<void>((resolve) => { releaseSummaries = resolve; });
|
||||
localStorage.setItem("thothii.workspace-registry.v1.preferences", JSON.stringify({
|
||||
workspaceId: "legacy-workspace", provider: "deepseek", model: "deepseek-v4-pro", thinking: "medium",
|
||||
}));
|
||||
server.use(
|
||||
http.get("/api/settings", () => HttpResponse.json({ workspace: "legacy-workspace" })),
|
||||
http.get("/api/workspaces", async () => {
|
||||
summaryRequestStarted = true;
|
||||
await summariesMayFinish;
|
||||
return HttpResponse.json([{
|
||||
id: "legacy-workspace", name: "legacy-workspace", file: "legacy-workspace.yaml", displayName: "Legacy workspace",
|
||||
revision: { id: "legacy-workspace", commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "migration_required" },
|
||||
}]);
|
||||
}),
|
||||
http.get("/api/workspaces/legacy-workspace", () => new HttpResponse(null, { status: 409 })),
|
||||
http.get("/api/models", () => HttpResponse.json({ models: [
|
||||
{ provider: "deepseek", id: "deepseek-v4-pro", name: "DeepSeek V4 Pro", reasoning: true },
|
||||
] })),
|
||||
http.post("/api/sessions", async ({ request }) => {
|
||||
body = await request.json();
|
||||
return HttpResponse.json({ id: "s1" });
|
||||
}),
|
||||
);
|
||||
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
|
||||
render(<QueryClientProvider client={client}><ComposerFooter /><SteerInput sessionId={null} onSessionCreateFailed={(message) => { failure = message; }} /></QueryClientProvider>);
|
||||
|
||||
await waitFor(() => expect(summaryRequestStarted).toBe(true));
|
||||
await userEvent.type(screen.getByRole("textbox", { name: /new question/i }), "q");
|
||||
await userEvent.click(screen.getByRole("button", { name: /send/i }));
|
||||
|
||||
expect(body).toBeUndefined();
|
||||
expect(screen.getByRole("button", { name: /send/i })).toBeDisabled();
|
||||
releaseSummaries();
|
||||
|
||||
await waitFor(() => expect(failure).toBe("Could not load selected workspace policy. Please retry."));
|
||||
expect(body).toBeUndefined();
|
||||
});
|
||||
|
||||
test("initial submit rejects a workspace summary that omits the canonical revision", async () => {
|
||||
let body: unknown;
|
||||
let failure: string | undefined;
|
||||
@@ -399,7 +359,7 @@ test("initial submit rejects a workspace summary that omits the canonical revisi
|
||||
server.use(
|
||||
http.get("/api/settings", () => HttpResponse.json({ workspace: "broken-workspace" })),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([{
|
||||
id: "broken-workspace", name: "broken-workspace", file: "broken-workspace.yaml", displayName: "Broken workspace",
|
||||
id: "broken-workspace", name: "broken-workspace", file: "broken-workspace.yaml", displayName: "Broken workspace", language: "en",
|
||||
}])),
|
||||
http.get("/api/models", () => HttpResponse.json({ models: [
|
||||
{ provider: "zai", id: "glm-5.2", name: "GLM-5.2", reasoning: true },
|
||||
@@ -467,14 +427,14 @@ test("submit follows a rapid workspace switch instead of waiting for an abandone
|
||||
workspaceId: "research", provider: "deepseek", model: "deepseek-v4-pro", thinking: "medium",
|
||||
}));
|
||||
const revision = (id: string) => ({
|
||||
id, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot", state: "operational" as const,
|
||||
id, commit: "a".repeat(40), blob: "b".repeat(40), snapshotPath: "/snapshot",
|
||||
});
|
||||
server.use(
|
||||
http.get("/api/settings", () => HttpResponse.json({ workspace: "research" })),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([
|
||||
{ id: "research", name: "research", file: "research.yaml", displayName: "Research", revision: revision("research") },
|
||||
{ id: "workspace-b", name: "workspace-b", file: "workspace-b.yaml", displayName: "Workspace B", revision: revision("workspace-b") },
|
||||
{ id: "workspace-c", name: "workspace-c", file: "workspace-c.yaml", displayName: "Workspace C", revision: revision("workspace-c") },
|
||||
{ id: "research", name: "research", file: "research.yaml", displayName: "Research", language: "en", revision: revision("research") },
|
||||
{ id: "workspace-b", name: "workspace-b", file: "workspace-b.yaml", displayName: "Workspace B", language: "en", revision: revision("workspace-b") },
|
||||
{ id: "workspace-c", name: "workspace-c", file: "workspace-c.yaml", displayName: "Workspace C", language: "en", revision: revision("workspace-c") },
|
||||
])),
|
||||
http.get("/api/workspaces/research", () => HttpResponse.json({
|
||||
workspace: canonicalWorkspaceFixture("research", ["deepseek/deepseek-v4-pro"]), revision: revision("research"),
|
||||
|
||||
@@ -203,8 +203,6 @@ export function ComposerFooter() {
|
||||
workspacePolicyGate.rejectSummary(workspace);
|
||||
} else if (selectedWorkspace && !selectedWorkspaceHasRevision) {
|
||||
workspacePolicyGate.rejectSummary(workspace);
|
||||
} else if (selectedWorkspace?.revision?.state === "migration_required") {
|
||||
workspacePolicyGate.rejectSummary(workspace);
|
||||
} else if (selectedWorkspace?.revision) {
|
||||
workspacePolicyGate.select(workspace);
|
||||
} else {
|
||||
@@ -243,7 +241,6 @@ export function ComposerFooter() {
|
||||
if (patch.workspaceId && patch.workspaceId !== workspace) {
|
||||
const selected = workspaces.find((candidate) => candidate.id === patch.workspaceId);
|
||||
if (selected && !selected.revision) workspacePolicyGate.rejectSummary(patch.workspaceId);
|
||||
else if (selected?.revision?.state === "migration_required") workspacePolicyGate.rejectSummary(patch.workspaceId);
|
||||
else if (selected?.revision) workspacePolicyGate.select(patch.workspaceId);
|
||||
else workspacePolicyGate.allowLegacy(patch.workspaceId);
|
||||
}
|
||||
@@ -269,8 +266,8 @@ export function ComposerFooter() {
|
||||
{workspaces.length === 0 ? (
|
||||
<option value="">— workspace —</option>
|
||||
) : (
|
||||
workspaces.filter((w) => w.revision && w.revision.state !== "migration_required").map((w) => (
|
||||
<option key={w.name} value={w.name}>
|
||||
workspaces.filter((w) => w.revision).map((w) => (
|
||||
<option key={w.id} value={w.id}>
|
||||
{w.name}
|
||||
</option>
|
||||
))
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -64,11 +64,10 @@ export function WorkspaceManager({ open, onClose }: { open: boolean; onClose: ()
|
||||
const workspaces = workspacesQuery.data ?? [];
|
||||
const selectedSummary = useMemo(() => workspaces.find((workspace) => workspace.id === selectedId), [selectedId, workspaces]);
|
||||
const selectedSummaryIncomplete = Boolean(selectedSummary && !selectedSummary.revision);
|
||||
const selectedIsLegacy = selectedSummary?.revision?.state === "migration_required";
|
||||
const detailQuery = useQuery({
|
||||
queryKey: ["workspace", selectedId],
|
||||
queryFn: () => getWorkspace(selectedId!),
|
||||
enabled: Boolean(open && selectedId && !localDraft && !selectedSummaryIncomplete && !selectedIsLegacy),
|
||||
enabled: Boolean(open && selectedId && !localDraft && !selectedSummaryIncomplete),
|
||||
});
|
||||
const status = statusQuery.data;
|
||||
const record = detailQuery.data;
|
||||
@@ -317,13 +316,8 @@ export function WorkspaceManager({ open, onClose }: { open: boolean; onClose: ()
|
||||
<p className="font-semibold">Workspace summary unavailable</p>
|
||||
<p className="mt-1">This workspace summary is incomplete. Refresh the registry or choose another workspace before creating sessions or editing drafts.</p>
|
||||
</div>
|
||||
) : selectedIsLegacy ? (
|
||||
<div className="rounded-md border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm">
|
||||
<p className="font-semibold">Migration required</p>
|
||||
<p className="mt-1">This workspace uses a legacy descriptor and must be migrated to schema v3 before new sessions or publication.</p>
|
||||
</div>
|
||||
) : detailQuery.isError && selectedId && !localDraft ? <QueryError name="Workspace details failed" message="Could not load workspace details." retryLabel="Retry workspace details" onRetry={() => { void detailQuery.refetch(); }} /> : !currentDraft && !detailQuery.isLoading && <div className="grid min-h-64 place-items-center text-center"><div><h3 className="font-heading font-semibold">Select a workspace</h3><p className="mt-1 text-sm text-muted-foreground">Review an existing definition or start a browser-only draft.</p></div></div>}
|
||||
{!selectedSummaryIncomplete && !selectedIsLegacy && !detailQuery.isError && (currentDraft || detailQuery.isLoading) && (
|
||||
{!selectedSummaryIncomplete && !detailQuery.isError && (currentDraft || detailQuery.isLoading) && (
|
||||
<>
|
||||
{detailQuery.isLoading && !currentDraft ? <p className="text-sm text-muted-foreground">Loading workspace definition…</p> : currentDraft && <>
|
||||
<div className="mb-5 flex flex-wrap items-start justify-between gap-3 border-b border-border/70 pb-4">
|
||||
@@ -347,7 +341,7 @@ export function WorkspaceManager({ open, onClose }: { open: boolean; onClose: ()
|
||||
<section className="mt-6 border-t border-border/70 pt-5" aria-label="Git status and history">
|
||||
<h3 className="font-heading text-sm font-semibold">Git status & history</h3>
|
||||
<p className="mt-2 text-sm text-muted-foreground">{status?.degraded ? "Using the last valid local snapshot." : "Registry checkout is current."}</p>
|
||||
{record && <p className="mt-1 font-mono text-xs text-muted-foreground">Revision {record.revision.commit.slice(0, 12)} · {record.revision.state}</p>}
|
||||
{record && <p className="mt-1 font-mono text-xs text-muted-foreground">Revision {record.revision.commit.slice(0, 12)}</p>}
|
||||
</section>
|
||||
</>}
|
||||
</>
|
||||
|
||||
@@ -52,7 +52,7 @@ test("validates a draft and requires a separate confirmation before publishing",
|
||||
let publishCalls = 0;
|
||||
server.use(http.post("/api/workspaces/publish", () => {
|
||||
publishCalls += 1;
|
||||
return HttpResponse.json({ revision: { id: "psd-clinical", commit: "c".repeat(40), blob: "d".repeat(40), snapshotPath: "/safe", state: "operational" } });
|
||||
return HttpResponse.json({ revision: { id: "psd-clinical", commit: "c".repeat(40), blob: "d".repeat(40), snapshotPath: "/safe" } });
|
||||
}));
|
||||
render(<WorkspacePublishDialog open request={request} onOpenChange={vi.fn()} onPublished={published} onResolved={vi.fn()} onPull={vi.fn()} onReload={vi.fn()} />);
|
||||
|
||||
|
||||
@@ -23,9 +23,7 @@ test("F1: create session -> widget via SSE -> respond -> POST /response", async
|
||||
http.get("/api/settings", () => HttpResponse.json({
|
||||
workspace: "default", provider: "zai", model: "glm-5.2", thinking: "low",
|
||||
})),
|
||||
http.get("/api/workspaces", () =>
|
||||
HttpResponse.json([{ name: "default", file: "default.db" }]),
|
||||
),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([])),
|
||||
http.get("/api/models", () => HttpResponse.json({ models: [] })),
|
||||
http.post("/api/sessions/s1/response", async ({ request }) => {
|
||||
responded = await request.json();
|
||||
|
||||
Reference in New Issue
Block a user