fix: serialize registry qdrant lifecycle
This commit is contained in:
@@ -255,6 +255,12 @@ export function renderRuntimeConfig(
|
||||
...(installation.profile === undefined ? {} : { profile: installation.profile }),
|
||||
language: descriptor.workspace.language,
|
||||
database,
|
||||
vectors: {
|
||||
type: "qdrant",
|
||||
base_url: semanticRuntime.internalQdrantUrl,
|
||||
collection: descriptor.semantic_index.vector_store.collection,
|
||||
collection_lifecycle: identity ? "require_existing" : "create_if_missing",
|
||||
},
|
||||
resources: {
|
||||
vector: {
|
||||
engine: "qdrant",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
@@ -80,6 +81,10 @@ test("renders only the schema-v3 internal Qdrant and Ollama runtime shape", () =
|
||||
ssl_ca_file: "/run/secrets/dwh-ca.pem", transport: "direct",
|
||||
},
|
||||
dwh: { type: "postgres_direct" },
|
||||
vectors: {
|
||||
type: "qdrant", base_url: "http://qdrant:6333", collection: "psd-clinical",
|
||||
collection_lifecycle: "require_existing",
|
||||
},
|
||||
resources: {
|
||||
vector: { engine: "qdrant", base_url: "http://qdrant:6333", collection: "psd-clinical" },
|
||||
embeddings: {
|
||||
@@ -94,6 +99,63 @@ test("renders only the schema-v3 internal Qdrant and Ollama runtime shape", () =
|
||||
expect(rendered).not.toHaveProperty("vector_rest");
|
||||
});
|
||||
|
||||
test("keeps create_if_missing for non-registry runtime renders", () => {
|
||||
const rendered = parse(renderRuntimeConfig(workspaceV3, directBindings, paths, undefined, {}, semanticRuntime));
|
||||
|
||||
expect(rendered.vectors).toMatchObject({
|
||||
type: "qdrant",
|
||||
collection_lifecycle: "create_if_missing",
|
||||
});
|
||||
});
|
||||
|
||||
test.each(["session", "maintenance"])(
|
||||
"renders require_existing vectors for %s acquisition",
|
||||
(mode) => {
|
||||
const rendered = parse(renderRuntimeConfig(workspaceV3, directBindings, paths, {
|
||||
workspaceId: "psd-clinical", workspaceRevision: "a".repeat(40),
|
||||
}, {}, semanticRuntime));
|
||||
|
||||
expect(rendered.vectors).toEqual({
|
||||
type: "qdrant",
|
||||
base_url: "http://qdrant:6333",
|
||||
collection: "psd-clinical",
|
||||
collection_lifecycle: "require_existing",
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
test("session and maintenance renders are byte-identical and bind identically in harness", () => {
|
||||
const context = { workspaceId: "psd-clinical", workspaceRevision: "a".repeat(40) };
|
||||
const passwordFile = evidenceSecretFile("dwh-password", "not-a-canary");
|
||||
const bindings = {
|
||||
...directBindings,
|
||||
dwh: { ...directBindings.dwh, values: {
|
||||
...directBindings.dwh.values,
|
||||
THT_WS_PSD_CLINICAL_DWH_PASSWORD_FILE: passwordFile,
|
||||
} },
|
||||
};
|
||||
const session = renderRuntimeConfig(workspaceV3, bindings, paths, context, {}, semanticRuntime);
|
||||
const maintenance = renderRuntimeConfig(workspaceV3, bindings, paths, context, {}, semanticRuntime);
|
||||
|
||||
expect(maintenance).toBe(session);
|
||||
|
||||
const script = `
|
||||
import json, sys, tempfile
|
||||
from pathlib import Path
|
||||
from tht.config import load_config
|
||||
from tht.jobs.dwh_pipeline import config_dwh_binding
|
||||
with tempfile.TemporaryDirectory() as root:
|
||||
path = Path(root) / "runtime.yaml"
|
||||
path.write_text(sys.stdin.read())
|
||||
print(json.dumps(config_dwh_binding(load_config(path)), sort_keys=True))
|
||||
`;
|
||||
const python = join(process.cwd(), "../harness/.venv/bin/python");
|
||||
const run = (yaml: string) => execFileSync(python, ["-c", script], {
|
||||
cwd: join(process.cwd(), "../harness"), input: yaml, encoding: "utf8",
|
||||
}).trim();
|
||||
expect(run(session)).toBe(run(maintenance));
|
||||
});
|
||||
|
||||
test("renders schema-v3 DWH REST without exposing secret contents", () => {
|
||||
const rendered = parse(renderRuntimeConfig(workspaceV3, {
|
||||
dwh: {
|
||||
|
||||
Reference in New Issue
Block a user