{"record":{"id":"3198ea5ffc3f7cd4","repo":"JuliusBrussee/caveman","slug":"no-workflow-motif-recurred-across-two-variants-of","errorCode":null,"errorMessage":"no workflow motif recurred across two variants of one task family in any fixture","messagePattern":"no workflow motif recurred across two variants of one task family in any fixture","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/contracts/scripts/validate-continuous-improvement.mjs","lineNumber":339,"sourceCode":"    }\n    for (const proof of item.replay.trial_proofs) {\n      if (!datasetCaseIDs.has(proof.dataset_case_id)) throw new Error(`${where} replay trial ${proof.id} replays a case outside the composed dataset`);\n      for (const arm of [proof.baseline, proof.candidate]) {\n        const graders = arm.grader_results.map((grader) => grader.grader).sort();\n        const required = [...item.eval_pack.graders].sort();\n        if (graders.join(\",\") !== required.join(\",\")) {\n          throw new Error(`${where} replay trial ${proof.id} graded ${graders.join(\",\")}, want exactly ${required.join(\",\")}`);\n        }\n      }\n    }\n  }\n}\nif (!Array.isArray(spans) || spans.length === 0) throw new Error(\"canonical span fixture is empty\");\nfor (const [index, span] of spans.entries()) {\n  if (!validateSpan(span)) throw new Error(`canonical span ${index}: ${ajv.errorsText(validateSpan.errors)}`);\n}\nif (relationshipCount === 0) throw new Error(\"no theme relationship reached the shared-analysis-unit threshold in any fixture\");\nif (motifCount === 0) throw new Error(\"no workflow motif recurred across two variants of one task family in any fixture\");\nconsole.log(`validated ${reports.length} generated improvement report(s), ${relationshipCount} theme relationship(s), ${motifCount} workflow motif(s) and ${spans.length} canonical spans`);\n","sourceCodeStart":321,"sourceCodeEnd":341,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/shared/contracts/scripts/validate-continuous-improvement.mjs#L321-L341","documentation":"The script requires that at least one workflow motif recurs across two variants of the same task family in the fixture set. If motifCount is zero, the fixtures never demonstrate motif recurrence, which is a core behavior this contract is supposed to cover, so the script throws. This prevents vacuously-passing validation.","triggerScenarios":"Running scripts/validate-continuous-improvement.mjs when no fixture pair of task-family variants shares a recurring workflow motif (motifCount === 0).","commonSituations":"Fixtures regenerated from unrelated task families; motif detection output changed shape (e.g. motif ids renamed) so matching fails; fixture variants were edited independently and lost their shared motif.","solutions":["Check the motif extraction/matching logic in the script to see how motifCount is computed","Regenerate fixtures from two variants of the same task family so a motif recurs in both","Align motif identifiers/shapes between generator output and the script's matcher if a rename broke matching","Add an explicit motif fixture pair that documents the expected recurrence"],"exampleFix":"// before (two variants, no shared motif)\nvariantA: { \"taskFamily\": \"deploy\", \"steps\": [\"build\"] }\nvariantB: { \"taskFamily\": \"release\", \"steps\": [\"tag\"] }\n// after\nvariantA: { \"taskFamily\": \"deploy\", \"steps\": [\"build\", \"test\", \"deploy\"], \"motifs\": [\"build-test\"] }\nvariantB: { \"taskFamily\": \"deploy\", \"steps\": [\"build\", \"test\", \"deploy-canary\"], \"motifs\": [\"build-test\"] }","handlingStrategy":"validation","validationCode":"const families = new Map();\nfor (const f of fixtures) families.set(f.taskFamily, [...(families.get(f.taskFamily) ?? []), f]);\nconst recurring = [...families.values()].some(vs => new Set(vs.flatMap(v => v.motifs ?? [])).size && vs.length >= 2);\nif (!recurring) throw new Error('no recurring motif across task-family variants');","typeGuard":null,"tryCatchPattern":"try { assertMotifRecurrence(fixtures); } catch (e) { console.error('Motif coverage missing:', e.message); process.exitCode = 1; }","preventionTips":["Always add fixtures as variant pairs of one task family","Keep motif ids stable across generator versions","Add a motif-recurrence smoke check to the fixture generator"],"tags":["validation","fixtures","motifs"],"backgroundTag":"empty-result-set","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"}