/*
candidate contract — Zod schemas for certification candidate build configuration.
- Do not build candidates — this module defines the contract only.
- RFC-1097: sweep — werkstatt-engine clean
Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics.
*/
import { z } from "zod";
import {
digestSchema,
candidateIdSchema,
utcTimestampSchema,
gateChannelSchema,
environmentSchema,
safeSemanticPathSchema,
humanReadableIdSchema,
} from "./identifiers.ts";
export const buildConfigV1Schema = z
.object({
schema: z.literal("werkstatt/build-config@1"),
buildConfigHash: digestSchema,
toolchainId: humanReadableIdSchema,
sourceRef: safeSemanticPathSchema,
contentHash: digestSchema,
})
.strict();
export type BuildConfigV1 = z.infer;
export const deploymentPlanV1Schema = z
.object({
schema: z.literal("werkstatt/deployment-plan@1"),
deploymentPlanHash: digestSchema,
channel: gateChannelSchema,
target: humanReadableIdSchema,
environmentRefs: z.array(humanReadableIdSchema).max(100),
})
.strict();
export type DeploymentPlanV1 = z.infer;
export const observedEnvironmentV1Schema = z
.object({
schema: z.literal("werkstatt/observed-environment@1"),
environment: environmentSchema,
environmentIdentityHash: digestSchema,
observedAt: utcTimestampSchema,
providerRef: z.string().min(1).max(256).optional(),
providerVersion: z.string().min(1).max(128).optional(),
})
.strict();
export type ObservedEnvironmentV1 = z.infer;
export const releaseCandidateV1Schema = z
.object({
schema: z.literal("werkstatt/release-candidate@1"),
candidateId: candidateIdSchema,
systemId: humanReadableIdSchema,
releaseVersion: z.string().min(1).max(128),
sourceHash: digestSchema,
contentHash: digestSchema,
artifactHash: digestSchema,
buildConfig: buildConfigV1Schema,
deploymentPlan: deploymentPlanV1Schema,
policyBundleRoot: digestSchema,
toolchainId: humanReadableIdSchema,
observedEnvironment: observedEnvironmentV1Schema,
observedAt: utcTimestampSchema,
})
.strict();
export type ReleaseCandidateV1 = z.infer;