feat: complete catalog-driven preprocessing
Publish documentation / publish (push) Successful in 2m12s
Publish documentation / publish (push) Successful in 2m12s
This commit is contained in:
@@ -3,6 +3,7 @@ import { basename, dirname, join } from "node:path";
|
||||
import { createRequire } from "node:module";
|
||||
import { resolveRuntimeBindings } from "../backend/src/workspaces/bindings.js";
|
||||
import { renderRuntimeConfig } from "../backend/src/workspaces/runtime-renderer.js";
|
||||
import { validateWorkspaceDescriptor } from "../backend/src/workspaces/schema.js";
|
||||
|
||||
const requireFromBackend = createRequire(new URL("../backend/package.json", import.meta.url));
|
||||
const { parse } = requireFromBackend("yaml") as { parse: (value: string) => any };
|
||||
@@ -87,6 +88,9 @@ for (const name of [
|
||||
|
||||
if (workspace.workspace?.id !== "task13-smoke") throw new Error("fixture workspace id changed");
|
||||
if (workspace.workspace?.schema_version !== 4) throw new Error("fixture workspace must use schema v4");
|
||||
if (Object.hasOwn(workspace, "dwh")) {
|
||||
throw new Error("authored workspace fixture must not contain database metadata");
|
||||
}
|
||||
for (const forbidden of ["semantic_index", "llm_policy"]) {
|
||||
if (Object.hasOwn(workspace, forbidden)) {
|
||||
throw new Error(`fixture workspace must not own installation model configuration: ${forbidden}`);
|
||||
@@ -176,13 +180,29 @@ for (const [target, localVolume] of [
|
||||
const resolverEnvironment = { ...core.environment };
|
||||
const runtimePasswordSource = realpathSync(runtimePasswordSourceInput);
|
||||
resolverEnvironment.THT_WS_TASK13_SMOKE_DWH_PASSWORD_FILE = runtimePasswordSource;
|
||||
const bindings = resolveRuntimeBindings(workspace, resolverEnvironment, [dirname(runtimePasswordSource)]);
|
||||
// Production projects the current PostgreSQL Catalog row into an ephemeral runtime descriptor.
|
||||
// Keep the authored fixture database-free and reproduce that projection only for this contract check.
|
||||
const runtimeWorkspace = validateWorkspaceDescriptor({
|
||||
...workspace,
|
||||
dwh: {
|
||||
engine: "postgres",
|
||||
database: "warehouse",
|
||||
schema: "datawarehouse",
|
||||
port: 5432,
|
||||
supported_transports: ["postgres_direct"],
|
||||
},
|
||||
});
|
||||
const bindings = resolveRuntimeBindings(
|
||||
runtimeWorkspace,
|
||||
resolverEnvironment,
|
||||
[dirname(runtimePasswordSource)],
|
||||
);
|
||||
for (const [role, binding] of Object.entries(bindings)) {
|
||||
if ((binding as any).missing.length !== 0) {
|
||||
throw new Error(`workspace resolver reports missing ${role} bindings: ${(binding as any).missing.join(",")}`);
|
||||
}
|
||||
}
|
||||
const runtime = parse(renderRuntimeConfig(workspace, bindings, {
|
||||
const runtime = parse(renderRuntimeConfig(runtimeWorkspace, bindings, {
|
||||
sessions: "/data/sessions",
|
||||
artifacts: "/data/artifacts",
|
||||
indexes: "/data/indexes",
|
||||
@@ -193,11 +213,14 @@ const runtime = parse(renderRuntimeConfig(workspace, bindings, {
|
||||
}));
|
||||
if (runtime.database.host !== expected.THT_WS_TASK13_SMOKE_DWH_HOST
|
||||
|| runtime.database.user !== expected.THT_WS_TASK13_SMOKE_DWH_USER
|
||||
|| runtime.database.password_file !== runtimePasswordSource) {
|
||||
|| runtime.database.password_file !== runtimePasswordSource
|
||||
|| runtime.database.database !== "warehouse"
|
||||
|| runtime.database.schema !== "datawarehouse") {
|
||||
throw new Error("workspace resolver produced the wrong DWH runtime");
|
||||
}
|
||||
if (runtime.resources?.vector?.base_url !== "http://qdrant:6333"
|
||||
|| runtime.resources?.vector?.collection !== "task13-smoke") {
|
||||
|| runtime.resources?.vector?.collections?.reference !== "task13-smoke-reference"
|
||||
|| runtime.resources?.vector?.collections?.memory !== "task13-smoke-memory") {
|
||||
throw new Error("workspace resolver produced the wrong qdrant runtime");
|
||||
}
|
||||
if (runtime.resources?.embeddings?.base_url !== "http://embedding:11434"
|
||||
|
||||
Reference in New Issue
Block a user