refactor: make workspace descriptors schema v3 only
This commit is contained in:
@@ -4,9 +4,9 @@ import { buildInstallationContract } from "./contracts.js";
|
||||
import {
|
||||
validateWorkspaceDescriptor,
|
||||
type WorkspaceDescriptor,
|
||||
type WorkspaceV2,
|
||||
type WorkspaceV3,
|
||||
} from "./schema.js";
|
||||
import type { DeprecatedV2Descriptor } from "./deprecated-v2-descriptor.js";
|
||||
import type { ResolvedBinding, ResolvedEvidenceBinding, RuntimeBindings } from "./bindings.js";
|
||||
export type { RuntimeBindings } from "./bindings.js";
|
||||
|
||||
@@ -216,8 +216,8 @@ export function renderRuntimeConfig(
|
||||
if (!variable) throw new Error(`workspace contract is missing ${role}_${suffix}`);
|
||||
return variable.name;
|
||||
};
|
||||
if (descriptor.workspace.schema_version !== 2) {
|
||||
if (descriptor.workspace.schema_version === 1) {
|
||||
if (Number(descriptor.workspace.schema_version) !== 2) {
|
||||
if (Number(descriptor.workspace.schema_version) === 1) {
|
||||
throw new Error("Workspace descriptor requires explicit migration to schema version 2");
|
||||
}
|
||||
const canonicalV3 = descriptor as WorkspaceV3;
|
||||
@@ -290,7 +290,7 @@ export function renderRuntimeConfig(
|
||||
return stringify(renderedV3, { lineWidth: 0, sortMapEntries: false });
|
||||
}
|
||||
|
||||
const canonical = descriptor as WorkspaceV2;
|
||||
const canonical = descriptor as unknown as DeprecatedV2Descriptor;
|
||||
if ([...bindings.dwh.missing, ...bindings.vector.missing, ...bindings.embedding.missing].length > 0) {
|
||||
throw new Error("runtime configuration requires complete bindings");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user