{"record":{"id":"290a6dcb9fc8f858","repo":"JuliusBrussee/caveman","slug":"no-theme-relationship-reached-the-shared-analysis","errorCode":null,"errorMessage":"no theme relationship reached the shared-analysis-unit threshold in any fixture","messagePattern":"no theme relationship reached the shared-analysis-unit threshold in any fixture","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/shared/contracts/scripts/validate-continuous-improvement.mjs","lineNumber":338,"sourceCode":"      throw new Error(`${where} guard_respected grader ${perturbed ? \"missing for\" : \"declared without\"} perturbed dataset cases`);\n    }\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":320,"sourceCodeEnd":341,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/shared/contracts/scripts/validate-continuous-improvement.mjs#L320-L341","documentation":"After validating all fixtures, this script counts theme relationships that meet the shared-analysis-unit threshold across all improvement report fixtures. If the total is zero, nothing meaningful was exercised, so the script throws rather than passing silently. This guards the continuous-improvement contract against fixtures that validate structurally but never reach the analysis threshold.","triggerScenarios":"Running scripts/validate-continuous-improvement.mjs when the fixture reports contain no theme relationship whose shared analysis-unit count meets or exceeds the configured threshold (relationshipCount === 0).","commonSituations":"Fixture reports regenerated from inputs too small/degenerate to share analysis units; the threshold constant was raised without updating fixtures; relationships were removed or renamed in fixtures during a refactor.","solutions":["Inspect how relationshipCount is accumulated and the threshold constant used in the script","Update or regenerate report fixtures so at least one theme relationship shares enough analysis units to pass the threshold","Lower the threshold only if it genuinely over-constrains realistic fixtures","Add at least one minimal synthetic fixture pair that provably crosses the threshold as a regression guard"],"exampleFix":"// before (fixture report)\n{ \"themes\": [\"latency\"], \"relationships\": [] }\n// after\n{ \"themes\": [\"latency\", \"retries\"], \"relationships\": [{ \"from\": \"latency\", \"to\": \"retries\", \"sharedAnalysisUnits\": 3 }] }","handlingStrategy":"validation","validationCode":"const crossing = reports.flatMap(r => r.relationships ?? []).filter(rel => rel.sharedAnalysisUnits >= THRESHOLD);\nif (crossing.length === 0) throw new Error('fixtures must include at least one relationship above threshold');","typeGuard":null,"tryCatchPattern":"try { assertThresholdCoverage(reports); } catch (e) { console.error('Fixture data too weak:', e.message); process.exitCode = 1; }","preventionTips":["Include at least one synthetic fixture pair guaranteed to cross the threshold","Re-check threshold constants whenever regenerating fixtures","Assert threshold coverage in the generator's self-test"],"tags":["validation","fixtures","threshold"],"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"}