test: add internal semantic smoke
This commit is contained in:
@@ -17,6 +17,25 @@ const workspace = parse(readFileSync(workspacePath, "utf8"));
|
||||
const core = config.services?.core;
|
||||
const frontend = config.services?.frontend;
|
||||
if (!core || !frontend) throw new Error("fixture render must contain core and frontend");
|
||||
const qdrant = config.services?.qdrant;
|
||||
const embedding = config.services?.embedding;
|
||||
const modelInit = config.services?.["embedding-model-init"];
|
||||
if (!qdrant || !embedding || !modelInit) {
|
||||
throw new Error("fixture render must contain the private semantic services");
|
||||
}
|
||||
|
||||
for (const [name, service, expectedExpose] of [
|
||||
["qdrant", qdrant, "6333"],
|
||||
["embedding", embedding, "11434"],
|
||||
] as const) {
|
||||
if ((service.ports || []).length !== 0) throw new Error(`${name} must not publish host ports`);
|
||||
if ((service.expose || []).join(",") !== expectedExpose) {
|
||||
throw new Error(`${name} must expose only ${expectedExpose}`);
|
||||
}
|
||||
}
|
||||
if ((modelInit.ports || []).length !== 0) {
|
||||
throw new Error("embedding-model-init must not publish host ports");
|
||||
}
|
||||
|
||||
const expected = {
|
||||
THT_WS_TASK13_SMOKE_DWH_TRANSPORT: "postgres_direct",
|
||||
@@ -34,6 +53,49 @@ for (const [name, value] of Object.entries(expected)) {
|
||||
}
|
||||
}
|
||||
|
||||
const semanticRuntime = {
|
||||
THT_INTERNAL_QDRANT_URL: "http://qdrant:6333",
|
||||
THT_INTERNAL_EMBEDDING_URL: "http://embedding:11434",
|
||||
THT_INTERNAL_EMBEDDING_MODEL: "qwen3-embedding:0.6b",
|
||||
THT_INTERNAL_EMBEDDING_DIMENSIONS: "1024",
|
||||
};
|
||||
for (const [name, value] of Object.entries(semanticRuntime)) {
|
||||
if (core.environment?.[name] !== value) {
|
||||
throw new Error(`core semantic runtime ${name} is ${JSON.stringify(core.environment?.[name])}, want ${JSON.stringify(value)}`);
|
||||
}
|
||||
if (Object.hasOwn(frontend.environment || {}, name)) {
|
||||
throw new Error(`semantic runtime escaped to frontend: ${name}`);
|
||||
}
|
||||
}
|
||||
for (const name of ["THT_VEC_REST_URL", "THT_VEC_WRITE_REST_URL", "THT_OLLAMA_URL"]) {
|
||||
if (Object.hasOwn(core.environment || {}, name) && core.environment?.[name] !== "") {
|
||||
throw new Error(`fixture render reintroduced external semantic binding ${name}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (workspace.workspace?.id !== "task13-smoke") throw new Error("fixture workspace id changed");
|
||||
if (workspace.semantic_index?.vector_store?.engine !== "qdrant") {
|
||||
throw new Error("fixture workspace must use qdrant");
|
||||
}
|
||||
if (workspace.semantic_index?.vector_store?.collection !== workspace.workspace?.id) {
|
||||
throw new Error("fixture workspace must dedicate one qdrant collection per workspace id");
|
||||
}
|
||||
if (workspace.semantic_index?.vector_store?.dimensions !== 1024) {
|
||||
throw new Error("fixture workspace qdrant dimension changed");
|
||||
}
|
||||
if (workspace.semantic_index?.vector_store?.distance !== "cosine") {
|
||||
throw new Error("fixture workspace qdrant distance changed");
|
||||
}
|
||||
if (workspace.semantic_index?.embedding?.provider !== "ollama_internal") {
|
||||
throw new Error("fixture workspace must use internal ollama embeddings");
|
||||
}
|
||||
if (workspace.semantic_index?.embedding?.model !== "qwen3-embedding:0.6b") {
|
||||
throw new Error("fixture workspace embedding model changed");
|
||||
}
|
||||
if (workspace.semantic_index?.embedding?.dimensions !== 1024) {
|
||||
throw new Error("fixture workspace embedding dimension changed");
|
||||
}
|
||||
|
||||
const bundle = config.secrets?.thothii_secrets;
|
||||
const bundleSource = bundle?.file;
|
||||
if (typeof bundleSource !== "string" || !statSync(bundleSource).isFile()) {
|
||||
|
||||
Reference in New Issue
Block a user