diff --git a/CHANGELOG.md b/CHANGELOG.md index 9307c4b..39f5ef0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,13 @@ All notable changes follow Semantic Versioning and Keep a Changelog conventions. - Deterministic schema registry packaging and release-triggered GitHub Pages distribution. - Stable major/minor and immutable patch-version schema URL contracts with SHA-256 manifests. +## [1.1.1] - 2026-07-05 + +### Fixed + +- Restored canonical schema `$id` values and example schema artifact URIs to `https://schemas.coding-autopilot.dev/` while keeping GitHub Pages `registry/` URLs as the live distribution endpoint. +- Added regression coverage to ensure schema identity remains canonical and independent from the hosting URL. + ## [0.1.0] - 2026-06-11 ### Added diff --git a/README.md b/README.md index 0783adc..49acead 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ Producers should emit records that validate against the declared version. Consum The schemas are public APIs. Review [versioning and compatibility](docs/VERSIONING.md), [contributing](CONTRIBUTING.md), and [security](SECURITY.md) before proposing changes. Released schemas are discoverable from `https://coding-autopilot-system.github.io/cas-contracts/registry/index.json`. Use stable `registry/vMAJOR.MINOR` URLs for compatible updates or immutable `registry/releases/vMAJOR.MINOR.PATCH` URLs for reproducible builds. See [schema distribution](docs/DISTRIBUTION.md). +Authoritative schema identity remains under `https://schemas.coding-autopilot.dev/`; the GitHub Pages registry is the current live distribution endpoint. The v1 `WorkRequest` rejects dispatch unless objective, repositories, measurable criteria, constraints, risk, approval and verification policies, diff --git a/docs/DISTRIBUTION.md b/docs/DISTRIBUTION.md index d4f498f..52e276c 100644 --- a/docs/DISTRIBUTION.md +++ b/docs/DISTRIBUTION.md @@ -7,7 +7,11 @@ sub-path of the documentation site on a single GitHub Pages origin: https://coding-autopilot-system.github.io/cas-contracts/registry/ ``` -Schema `$id` values use the live GitHub Pages registry base `https://coding-autopilot-system.github.io/cas-contracts/registry/`, so every `$id` resolves directly to the schema it identifies. Identity and hosting location are the same URL; consumers can dereference an `$id` to fetch the schema. +Schema `$id` values use the reserved canonical namespace +`https://schemas.coding-autopilot.dev/`. That namespace is the stable identity +of each schema even though the current live distribution is served from GitHub +Pages. Consumers should treat `$id` as identity and use the Pages registry URLs +below as the fetch location until the canonical domain is activated. ## URL Contract @@ -53,9 +57,7 @@ Repository administrators must configure GitHub Pages to use **GitHub Actions** ## Custom domain (optional future work) -Schema `$id` values resolve on the live GitHub Pages origin today, so no DNS or -custom-domain work is required for schemas to dereference. A vanity domain (for -example `schemas.coding-autopilot.dev`) would only be a cosmetic rename of the -`$id` base and, if ever adopted, would require its own hosting origin plus a -coordinated `$id` migration across this repository and every consumer that -vendors these schemas. It is intentionally out of scope here. +When `schemas.coding-autopilot.dev` is activated, it must serve the same +versioned registry content without changing any schema `$id` values. The live +GitHub Pages registry remains the current distribution URL and should stay +stable for consumers that fetch schemas directly today. diff --git a/examples/v0.1/artifact-manifest.json b/examples/v0.1/artifact-manifest.json index c128dba..f9d3732 100644 --- a/examples/v0.1/artifact-manifest.json +++ b/examples/v0.1/artifact-manifest.json @@ -11,7 +11,7 @@ "artifacts": [ { "kind": "schema", - "uri": "https://coding-autopilot-system.github.io/cas-contracts/registry/v0.1/prompt-envelope.schema.json", + "uri": "https://schemas.coding-autopilot.dev/v0.1/prompt-envelope.schema.json", "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" } ] diff --git a/examples/v1.0/artifact-manifest.json b/examples/v1.0/artifact-manifest.json index e34e22b..a9f42af 100644 --- a/examples/v1.0/artifact-manifest.json +++ b/examples/v1.0/artifact-manifest.json @@ -11,7 +11,7 @@ "artifacts": [ { "kind": "schema", - "uri": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.0/prompt-envelope.schema.json", + "uri": "https://schemas.coding-autopilot.dev/v1.0/prompt-envelope.schema.json", "sha256": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" } ] diff --git a/schemas/v0.1/artifact-manifest.schema.json b/schemas/v0.1/artifact-manifest.schema.json index feb4869..af27f47 100644 --- a/schemas/v0.1/artifact-manifest.schema.json +++ b/schemas/v0.1/artifact-manifest.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v0.1/artifact-manifest.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v0.1/artifact-manifest.schema.json", "title": "ArtifactManifest", "type": "object", "allOf": [ diff --git a/schemas/v0.1/common.schema.json b/schemas/v0.1/common.schema.json index 410c751..0eec265 100644 --- a/schemas/v0.1/common.schema.json +++ b/schemas/v0.1/common.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v0.1/common.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v0.1/common.schema.json", "title": "CAS Common Definitions", "$defs": { "actor": { diff --git a/schemas/v0.1/evaluation-result.schema.json b/schemas/v0.1/evaluation-result.schema.json index 9e753b2..719f46a 100644 --- a/schemas/v0.1/evaluation-result.schema.json +++ b/schemas/v0.1/evaluation-result.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v0.1/evaluation-result.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v0.1/evaluation-result.schema.json", "title": "EvaluationResult", "type": "object", "allOf": [ diff --git a/schemas/v0.1/policy-decision.schema.json b/schemas/v0.1/policy-decision.schema.json index d0872aa..411482f 100644 --- a/schemas/v0.1/policy-decision.schema.json +++ b/schemas/v0.1/policy-decision.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v0.1/policy-decision.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v0.1/policy-decision.schema.json", "title": "PolicyDecision", "type": "object", "allOf": [ diff --git a/schemas/v0.1/prompt-envelope.schema.json b/schemas/v0.1/prompt-envelope.schema.json index 306d999..24a6e2d 100644 --- a/schemas/v0.1/prompt-envelope.schema.json +++ b/schemas/v0.1/prompt-envelope.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v0.1/prompt-envelope.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v0.1/prompt-envelope.schema.json", "title": "PromptEnvelope", "type": "object", "allOf": [ diff --git a/schemas/v0.1/run-event.schema.json b/schemas/v0.1/run-event.schema.json index 8ef4d11..3f89d28 100644 --- a/schemas/v0.1/run-event.schema.json +++ b/schemas/v0.1/run-event.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v0.1/run-event.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v0.1/run-event.schema.json", "title": "RunEvent", "type": "object", "allOf": [ diff --git a/schemas/v0.1/verification-result.schema.json b/schemas/v0.1/verification-result.schema.json index c0d3ef0..67719cc 100644 --- a/schemas/v0.1/verification-result.schema.json +++ b/schemas/v0.1/verification-result.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v0.1/verification-result.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v0.1/verification-result.schema.json", "title": "VerificationResult", "type": "object", "allOf": [ diff --git a/schemas/v0.1/work-request.schema.json b/schemas/v0.1/work-request.schema.json index 8aa3916..367cca8 100644 --- a/schemas/v0.1/work-request.schema.json +++ b/schemas/v0.1/work-request.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v0.1/work-request.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v0.1/work-request.schema.json", "title": "WorkRequest", "type": "object", "allOf": [ diff --git a/schemas/v1.0/artifact-manifest.schema.json b/schemas/v1.0/artifact-manifest.schema.json index 224a0cd..9473d89 100644 --- a/schemas/v1.0/artifact-manifest.schema.json +++ b/schemas/v1.0/artifact-manifest.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.0/artifact-manifest.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.0/artifact-manifest.schema.json", "title": "ArtifactManifest", "type": "object", "allOf": [ diff --git a/schemas/v1.0/common.schema.json b/schemas/v1.0/common.schema.json index 8a6a101..3563af9 100644 --- a/schemas/v1.0/common.schema.json +++ b/schemas/v1.0/common.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.0/common.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.0/common.schema.json", "title": "CAS Common Definitions", "$defs": { "actor": { diff --git a/schemas/v1.0/evaluation-result.schema.json b/schemas/v1.0/evaluation-result.schema.json index 4478e8e..fa6c93c 100644 --- a/schemas/v1.0/evaluation-result.schema.json +++ b/schemas/v1.0/evaluation-result.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.0/evaluation-result.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.0/evaluation-result.schema.json", "title": "EvaluationResult", "type": "object", "allOf": [ diff --git a/schemas/v1.0/policy-decision.schema.json b/schemas/v1.0/policy-decision.schema.json index 9c9d8ae..10c8628 100644 --- a/schemas/v1.0/policy-decision.schema.json +++ b/schemas/v1.0/policy-decision.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.0/policy-decision.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.0/policy-decision.schema.json", "title": "PolicyDecision", "type": "object", "allOf": [ diff --git a/schemas/v1.0/prompt-envelope.schema.json b/schemas/v1.0/prompt-envelope.schema.json index 064484d..576b9a2 100644 --- a/schemas/v1.0/prompt-envelope.schema.json +++ b/schemas/v1.0/prompt-envelope.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.0/prompt-envelope.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.0/prompt-envelope.schema.json", "title": "PromptEnvelope", "type": "object", "allOf": [ diff --git a/schemas/v1.0/run-event.schema.json b/schemas/v1.0/run-event.schema.json index 4c78511..ff1c7fa 100644 --- a/schemas/v1.0/run-event.schema.json +++ b/schemas/v1.0/run-event.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.0/run-event.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.0/run-event.schema.json", "title": "RunEvent", "type": "object", "allOf": [ diff --git a/schemas/v1.0/verification-result.schema.json b/schemas/v1.0/verification-result.schema.json index 06780ea..5defd72 100644 --- a/schemas/v1.0/verification-result.schema.json +++ b/schemas/v1.0/verification-result.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.0/verification-result.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.0/verification-result.schema.json", "title": "VerificationResult", "type": "object", "allOf": [ diff --git a/schemas/v1.0/work-request.schema.json b/schemas/v1.0/work-request.schema.json index a9f485d..7f72c64 100644 --- a/schemas/v1.0/work-request.schema.json +++ b/schemas/v1.0/work-request.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.0/work-request.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.0/work-request.schema.json", "title": "WorkRequest", "type": "object", "allOf": [ diff --git a/schemas/v1.1/common.schema.json b/schemas/v1.1/common.schema.json index bfc3eaf..b23a790 100644 --- a/schemas/v1.1/common.schema.json +++ b/schemas/v1.1/common.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/common.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.1/common.schema.json", "title": "CAS Common Definitions v1.1", "$defs": { "actor": { diff --git a/schemas/v1.1/phase-execution-request.schema.json b/schemas/v1.1/phase-execution-request.schema.json index 9b9f58b..e7ad5a8 100644 --- a/schemas/v1.1/phase-execution-request.schema.json +++ b/schemas/v1.1/phase-execution-request.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/phase-execution-request.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.1/phase-execution-request.schema.json", "title": "PhaseExecutionRequest", "type": "object", "allOf": [ diff --git a/schemas/v1.1/phase-execution-result.schema.json b/schemas/v1.1/phase-execution-result.schema.json index 971820b..5aa2623 100644 --- a/schemas/v1.1/phase-execution-result.schema.json +++ b/schemas/v1.1/phase-execution-result.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/phase-execution-result.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.1/phase-execution-result.schema.json", "title": "PhaseExecutionResult", "type": "object", "allOf": [ diff --git a/schemas/v1.1/phase-verification-result.schema.json b/schemas/v1.1/phase-verification-result.schema.json index 66b03f5..083d947 100644 --- a/schemas/v1.1/phase-verification-result.schema.json +++ b/schemas/v1.1/phase-verification-result.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/phase-verification-result.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.1/phase-verification-result.schema.json", "title": "PhaseVerificationResult", "type": "object", "allOf": [ diff --git a/schemas/v1.1/sdlc-lifecycle-event.schema.json b/schemas/v1.1/sdlc-lifecycle-event.schema.json index 312dfa1..b062c81 100644 --- a/schemas/v1.1/sdlc-lifecycle-event.schema.json +++ b/schemas/v1.1/sdlc-lifecycle-event.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/sdlc-lifecycle-event.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.1/sdlc-lifecycle-event.schema.json", "title": "SdlcLifecycleEvent", "type": "object", "allOf": [ diff --git a/schemas/v1.1/sdlc-profile.schema.json b/schemas/v1.1/sdlc-profile.schema.json index 9e336e7..d9dbd62 100644 --- a/schemas/v1.1/sdlc-profile.schema.json +++ b/schemas/v1.1/sdlc-profile.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/sdlc-profile.schema.json", + "$id": "https://schemas.coding-autopilot.dev/v1.1/sdlc-profile.schema.json", "title": "SdlcProfile", "type": "object", "allOf": [ diff --git a/scripts/lib.mjs b/scripts/lib.mjs index 56ecdc9..6f67776 100644 --- a/scripts/lib.mjs +++ b/scripts/lib.mjs @@ -8,6 +8,8 @@ export const schemaRoot = path.join(root, "schemas"); export const exampleRoot = path.join(root, "examples"); export const schemaDirectory = path.join(schemaRoot, "v0.1"); export const exampleDirectory = path.join(exampleRoot, "v0.1"); +export const canonicalSchemaBase = "https://schemas.coding-autopilot.dev"; +export const pagesRegistryBase = "https://coding-autopilot-system.github.io/cas-contracts/registry"; export async function readJson(filePath) { return JSON.parse(await readFile(filePath, "utf8")); @@ -40,8 +42,12 @@ export async function createValidator(directory = schemaRoot) { return ajv; } +export function schemaId(version, name) { + return `${canonicalSchemaBase}/${version}/${name}.schema.json`; +} + export function schemaIdForExample(examplePath) { const name = path.basename(examplePath, ".json"); const version = path.basename(path.dirname(examplePath)); - return `https://coding-autopilot-system.github.io/cas-contracts/registry/${version}/${name}.schema.json`; + return schemaId(version, name); } diff --git a/tests/contracts.test.mjs b/tests/contracts.test.mjs index 9ec669d..8e97583 100644 --- a/tests/contracts.test.mjs +++ b/tests/contracts.test.mjs @@ -1,6 +1,6 @@ import assert from "node:assert/strict"; import test from "node:test"; -import { createValidator, exampleRoot, jsonFilesRecursive, readJson, schemaIdForExample } from "../scripts/lib.mjs"; +import { createValidator, exampleRoot, jsonFilesRecursive, readJson, schemaId, schemaIdForExample } from "../scripts/lib.mjs"; const ajv = await createValidator(); const examplePaths = await jsonFilesRecursive(exampleRoot); @@ -32,7 +32,7 @@ test("each complete lifecycle preserves correlation and W3C trace context", () = test("contracts reject missing mandatory lifecycle metadata", () => { const invalid = structuredClone(examples.find((example) => example.kind === "PromptEnvelope" && example.schemaVersion === "0.1.0")); delete invalid.correlationId; - const validate = ajv.getSchema("https://coding-autopilot-system.github.io/cas-contracts/registry/v0.1/prompt-envelope.schema.json"); + const validate = ajv.getSchema(schemaId("v0.1", "prompt-envelope")); assert.equal(validate(invalid), false); assert.match(ajv.errorsText(validate.errors), /correlationId/); @@ -41,14 +41,14 @@ test("contracts reject missing mandatory lifecycle metadata", () => { test("contracts reject malformed W3C traceparent values", () => { const invalid = structuredClone(examples.find((example) => example.kind === "RunEvent" && example.schemaVersion === "0.1.0")); invalid.traceContext.traceparent = "not-a-traceparent"; - const validate = ajv.getSchema("https://coding-autopilot-system.github.io/cas-contracts/registry/v0.1/run-event.schema.json"); + const validate = ajv.getSchema(schemaId("v0.1", "run-event")); assert.equal(validate(invalid), false); assert.match(ajv.errorsText(validate.errors), /pattern/); }); test("v1.1 SDLC profile accepts a complete twelve-phase profile", () => { - const validate = ajv.getSchema("https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/sdlc-profile.schema.json"); + const validate = ajv.getSchema(schemaId("v1.1", "sdlc-profile")); assert.ok(validate, "v1.1 profile schema is registered"); const profile = { correlationId: "corr-1", @@ -83,7 +83,7 @@ test("v1.1 SDLC profile accepts a complete twelve-phase profile", () => { }); test("v1.1 SDLC request rejects missing profile version", () => { - const validate = ajv.getSchema("https://coding-autopilot-system.github.io/cas-contracts/registry/v1.1/phase-execution-request.schema.json"); + const validate = ajv.getSchema(schemaId("v1.1", "phase-execution-request")); assert.ok(validate, "v1.1 request schema is registered"); const request = { correlationId: "corr-1", diff --git a/tests/goal-contract.test.mjs b/tests/goal-contract.test.mjs index ba1a8c4..7cb80a2 100644 --- a/tests/goal-contract.test.mjs +++ b/tests/goal-contract.test.mjs @@ -1,16 +1,16 @@ import assert from "node:assert/strict"; import path from "node:path"; import test from "node:test"; -import { createValidator, readJson, root } from "../scripts/lib.mjs"; +import { createValidator, readJson, root, schemaId } from "../scripts/lib.mjs"; const version = "v1.0"; const schemaDirectory = path.join(root, "schemas", version); const examplePath = path.join(root, "examples", version, "work-request.json"); -const schemaId = "https://coding-autopilot-system.github.io/cas-contracts/registry/v1.0/work-request.schema.json"; +const workRequestSchemaId = schemaId(version, "work-request"); const ajv = await createValidator(schemaDirectory); const validGoal = await readJson(examplePath); -const validate = ajv.getSchema(schemaId); +const validate = ajv.getSchema(workRequestSchemaId); test("v1 goal fixture declares every bounded default", () => { assert.ok(validate); @@ -70,13 +70,13 @@ test("v1 lifecycle rejects incomplete metadata and malformed trace context", () test("v1 verification and evaluation records require evidence URIs", async () => { const verification = await readJson(path.join(root, "examples", version, "verification-result.json")); - const verificationValidator = ajv.getSchema("https://coding-autopilot-system.github.io/cas-contracts/registry/v1.0/verification-result.schema.json"); + const verificationValidator = ajv.getSchema(schemaId(version, "verification-result")); const noVerificationEvidence = structuredClone(verification); delete noVerificationEvidence.checks[0].evidenceUri; assert.equal(verificationValidator(noVerificationEvidence), false); const evaluation = await readJson(path.join(root, "examples", version, "evaluation-result.json")); - const evaluationValidator = ajv.getSchema("https://coding-autopilot-system.github.io/cas-contracts/registry/v1.0/evaluation-result.schema.json"); + const evaluationValidator = ajv.getSchema(schemaId(version, "evaluation-result")); const noEvaluationEvidence = structuredClone(evaluation); delete noEvaluationEvidence.evidence; assert.equal(evaluationValidator(noEvaluationEvidence), false); diff --git a/tests/registry.test.mjs b/tests/registry.test.mjs index 1cb4a75..7b9abb2 100644 --- a/tests/registry.test.mjs +++ b/tests/registry.test.mjs @@ -5,7 +5,7 @@ import os from "node:os"; import path from "node:path"; import test from "node:test"; import { buildAllRegistry, buildRegistry } from "../scripts/build-registry.mjs"; -import { createValidator, jsonFiles, readJson, schemaDirectory } from "../scripts/lib.mjs"; +import { createValidator, jsonFiles, readJson, schemaDirectory, schemaId } from "../scripts/lib.mjs"; import { validateRegistry } from "../scripts/validate-registry.mjs"; async function build() { @@ -41,6 +41,21 @@ test("distributed stable schemas compile and retain authoritative ids", async () } }); +test("registry keeps canonical schema identity independent from the Pages hosting URL", async () => { + const output = await build(); + const manifest = await readJson(path.join(output, "v0.1", "manifest.json")); + + for (const entry of manifest.schemas) { + assert.match(entry.id, /^https:\/\/schemas\.coding-autopilot\.dev\//); + assert.doesNotMatch(entry.id, /github\.io/); + assert.notEqual(entry.id, `https://coding-autopilot-system.github.io/cas-contracts/registry/v0.1/${entry.path}`); + } + + const promptEnvelope = manifest.schemas.find((entry) => entry.path === "prompt-envelope.schema.json"); + assert.ok(promptEnvelope, "prompt-envelope is published"); + assert.equal(promptEnvelope.id, schemaId("v0.1", "prompt-envelope")); +}); + test("registry builds are deterministic and append preserves immutable releases", async () => { const output = await build(); const first = await readFile(path.join(output, "v0.1", "manifest.json"), "utf8");