{"record":{"id":"525d80f0a8dfe3c7","repo":"JuliusBrussee/caveman","slug":"adapter-conformance-schema-failed-to-compile","errorCode":null,"errorMessage":"adapter conformance schema failed to compile","messagePattern":"adapter conformance schema failed to compile","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/contracts/scripts/validate-schemas.mjs","lineNumber":51,"sourceCode":"}\n\nconst agentFixtureRoot = path.join(packageRoot, \"fixtures\", \"agent\");\nconst fixtureFiles = (await readdir(agentFixtureRoot))\n  .filter((name) => name.endsWith(\".json\"))\n  .sort();\n\nif (fixtureFiles.length !== 2) {\n  throw new Error(`expected exactly 2 agent conformance fixtures, found ${fixtureFiles.length}`);\n}\n\nconst fixtures = await Promise.all(\n  fixtureFiles.map(async (file) => JSON.parse(await readFile(path.join(agentFixtureRoot, file), \"utf8\"))),\n);\nconst validateAdapterConformance = ajv.getSchema(\n  \"https://caveman.so/schemas/adapter-conformance.schema.json\",\n);\nif (!validateAdapterConformance) {\n  throw new Error(\"adapter conformance schema failed to compile\");\n}\nfor (const [index, fixture] of fixtures.entries()) {\n  if (!validateAdapterConformance(fixture)) {\n    throw new Error(\n      `${fixtureFiles[index]}: ${ajv.errorsText(validateAdapterConformance.errors)}`,\n    );\n  }\n}\nconst [claude, pi] = fixtures;\nif (claude.harness !== \"claude\" || pi.harness !== \"pi\") {\n  throw new Error(\"agent conformance fixtures must cover claude and pi\");\n}\n\nfor (const key of [\n  \"normalized_context_digest\",\n  \"plan_sha256\",\n  \"ordered_transform_ids\",\n  \"provider_visible_digest\",","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/shared/contracts/scripts/validate-schemas.mjs#L33-L69","documentation":"The script explicitly resolves the adapter-conformance schema by its canonical $id to validate the harness fixtures. If Ajv has no compiled validator under https://caveman.so/schemas/adapter-conformance.schema.json, that schema either was not among the loaded files, failed strict compilation, or its $id drifted — so the script throws. This separates 'schema missing/broken' from 'fixture invalid'.","triggerScenarios":"Running scripts/validate-schemas.mjs when the file adapter-conformance.schema.json is absent from schemas/, its $id no longer matches the canonical URI, or it failed Ajv strict compilation during addSchema.","commonSituations":"Renaming the schema file or changing its $id during a refactor; strict-mode compile failure in that schema; committing new fixtures without the schema that describes them.","solutions":["Confirm schemas/adapter-conformance.schema.json exists and its $id is exactly https://caveman.so/schemas/adapter-conformance.schema.json","Fix any strict-mode compile error in that schema (see the compile failure details Ajv emits)","Restore the schema file from git history if deleted","Grep for the canonical URI to catch accidental edits to the $id or the lookup string in the script"],"exampleFix":"// before\n\"$id\": \"https://caveman.so/schemas/adapter-conformance-v2.schema.json\"\n// after\n\"$id\": \"https://caveman.so/schemas/adapter-conformance.schema.json\"","handlingStrategy":"try-catch","validationCode":"const CANONICAL = 'https://caveman.so/schemas/adapter-conformance.schema.json';\nconst schemaFiles = schemas.map(s => s.$id);\nif (!schemaFiles.includes(CANONICAL)) throw new Error(`missing schema with $id ${CANONICAL}`);","typeGuard":null,"tryCatchPattern":"try { getConformanceValidator(); } catch (e) { if (e.message.includes('adapter conformance schema failed to compile')) { console.error('Check $id and strict compile of adapter-conformance schema:', e.message); process.exitCode = 1; } else throw e; }","preventionTips":["Never edit the canonical $id without updating the lookup string","Compile the schema standalone with Ajv before committing","Keep adapter-conformance.schema.json and its fixtures versioned together"],"tags":["ajv","json-schema","schemas"],"backgroundTag":"schema-validation-failed","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}