fix: fail safe on missing workspace revisions
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { expect, test } from "vitest";
|
||||
import * as workspaceSchema from "../src/workspaces/schema.js";
|
||||
import {
|
||||
@@ -95,6 +97,28 @@ test("accepts only the schema v3 internal qdrant semantic shape", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("committed example descriptors parse as exact schema v3 workspaces", () => {
|
||||
const example = readFileSync(resolve(process.cwd(), "../deploy/workspaces/example.yaml"), "utf8");
|
||||
const psdExample = readFileSync(resolve(process.cwd(), "../deploy/workspaces/psd.yaml.example"), "utf8");
|
||||
|
||||
expect(() => parseWorkspaceYaml(example)).not.toThrow();
|
||||
expect(() => parseWorkspaceYaml(psdExample)).not.toThrow();
|
||||
expect(parseWorkspaceYaml(example)).toMatchObject({
|
||||
workspace: { schema_version: 3 },
|
||||
semantic_index: {
|
||||
vector_store: { engine: "qdrant", distance: "cosine", dimensions: 1024 },
|
||||
embedding: { provider: "ollama_internal", model: "qwen3-embedding:0.6b", dimensions: 1024 },
|
||||
},
|
||||
});
|
||||
expect(parseWorkspaceYaml(psdExample)).toMatchObject({
|
||||
workspace: { schema_version: 3 },
|
||||
semantic_index: {
|
||||
vector_store: { engine: "qdrant", distance: "cosine", dimensions: 1024 },
|
||||
embedding: { provider: "ollama_internal", model: "qwen3-embedding:0.6b", dimensions: 1024 },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("rejects pgvector semantic stores in schema v3", () => {
|
||||
expect(() => parseWorkspaceYaml(validYaml.replace("engine: qdrant", "engine: pgvector")))
|
||||
.toThrow(/qdrant|pgvector/i);
|
||||
|
||||
Reference in New Issue
Block a user