refactor: remove workspace revision state
This commit is contained in:
@@ -114,7 +114,6 @@ const revision: WorkspaceRevision = {
|
||||
commit: "a".repeat(40),
|
||||
blob: "b".repeat(40),
|
||||
snapshotPath: "/registry/snapshots/psd-clinical.yaml",
|
||||
state: "operational",
|
||||
};
|
||||
|
||||
type RegistryFake = Pick<WorkspaceRegistry, "bootstrap" | "pull" | "list" | "read" | "publish">;
|
||||
@@ -237,6 +236,8 @@ test("lists compatible workspace summaries and reads a validated workspace", asy
|
||||
})]);
|
||||
expect(detail.statusCode).toBe(200);
|
||||
expect(detail.json()).toMatchObject({ workspace, revision });
|
||||
expect(list.json()[0].revision).not.toHaveProperty("state");
|
||||
expect(detail.json().revision).not.toHaveProperty("state");
|
||||
});
|
||||
|
||||
test("validates a canonical workspace and runs the injected installation diagnostic", async () => {
|
||||
@@ -278,36 +279,6 @@ test.each([
|
||||
expect(registry.publish).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("rejects a migration-required v2 workspace before resolving semantic diagnostics", async () => {
|
||||
const diagnose = vi.fn(async () => ({
|
||||
activatable: false,
|
||||
diagnostics: [{ level: "error" as const, code: "binding_missing" as const, field: "THT_WS_PSD_CLINICAL_VECTOR_BASE_URL", message: "Installation binding is missing or invalid." }],
|
||||
}));
|
||||
const registry = registryFake({
|
||||
read: vi.fn(async () => ({ workspace: workspaceV2, revision: { ...revision, state: "migration_required" as const } })),
|
||||
});
|
||||
const app = appFor(registry, diagnose);
|
||||
|
||||
const originalEnv = { ...process.env };
|
||||
process.env.THT_WS_PSD_CLINICAL_DWH_TRANSPORT = "rest_api";
|
||||
process.env.THT_WS_PSD_CLINICAL_DWH_BASE_URL = "https://dwh.example.test";
|
||||
process.env.THT_WS_PSD_CLINICAL_VECTOR_TRANSPORT = "rest_api";
|
||||
process.env.THT_WS_PSD_CLINICAL_VECTOR_BASE_URL = "https://vector.example.test";
|
||||
process.env.THT_WS_PSD_CLINICAL_EMBEDDING_BASE_URL = "https://embedding.example.test";
|
||||
try {
|
||||
const testResult = await app.inject({ method: "POST", url: "/workspaces/psd-clinical/test", payload: {} });
|
||||
|
||||
expect(testResult.statusCode).toBe(400);
|
||||
expect(testResult.json()).toEqual({
|
||||
code: "workspace_not_activatable",
|
||||
message: "Workspace cannot be activated on this installation.",
|
||||
});
|
||||
expect(diagnose).not.toHaveBeenCalled();
|
||||
} finally {
|
||||
process.env = originalEnv;
|
||||
}
|
||||
});
|
||||
|
||||
test("runs diagnostics for a schema v3 workspace without external semantic bindings", async () => {
|
||||
const diagnose = vi.fn(async () => ({ activatable: true, diagnostics: [] }));
|
||||
const app = appFor(registryFake(), diagnose);
|
||||
|
||||
Reference in New Issue
Block a user