{"record":{"id":"6c74130178a67100","repo":"JuliusBrussee/caveman","slug":"caveman-build-requiredfixturepassrate-must-be-in","errorCode":null,"errorMessage":"caveman build: requiredFixturePassRate must be in (0,1]","messagePattern":"caveman build: requiredFixturePassRate must be in \\(0,1\\]","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent/src/build.ts","lineNumber":47,"sourceCode":"      \"caveman build: dataResidency is not enforced yet; refusing to ignore residency policy\",\n    );\n  }\n  const config: BuildConfig = {\n    entry: options.entry,\n    evals: options.evals,\n    efficiency: options.efficiency ?? \"max\",\n    requiredFixturePassRate: options.requiredFixturePassRate ?? 1,\n    qualityRetention: options.qualityRetention ?? 0.98,\n    maxSearchCostUsd: options.maxSearchCostUsd ?? 2,\n    lock: options.lock ?? \"strict\",\n    sandbox: options.sandbox ?? \"required\",\n    ...(options.allowedModels === undefined ? {} : { allowedModels: [...options.allowedModels] }),\n    ...(options.deniedModels === undefined ? {} : { deniedModels: [...options.deniedModels] }),\n    ...(options.maxP95LatencyMs === undefined ? {} : { maxP95LatencyMs: options.maxP95LatencyMs }),\n    ...(options.forbiddenSafetyClasses === undefined ? {} : { forbiddenSafetyClasses: [...options.forbiddenSafetyClasses] }),\n  };\n  if (!(config.requiredFixturePassRate > 0 && config.requiredFixturePassRate <= 1)) {\n    throw new Error(\"caveman build: requiredFixturePassRate must be in (0,1]\");\n  }\n  if (!(config.qualityRetention > 0 && config.qualityRetention <= 1)) {\n    throw new Error(\"caveman build: qualityRetention must be in (0,1]\");\n  }\n  if (!(config.maxSearchCostUsd > 0)) {\n    throw new Error(\"caveman build: maxSearchCostUsd must be positive\");\n  }\n  return Object.freeze(config);\n}\n\nexport interface CavePlan {\n  schema_version: 1;\n  plan_id: string;\n  model: string;\n  reasoning: \"none\" | \"minimal\" | \"low\" | \"medium\" | \"high\";\n  segment_routes: Array<{\n    segment_kind: ContextKind;\n    segment_id?: string;","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/packages/agent/src/build.ts#L29-L65","documentation":"defineBuild validates that requiredFixturePassRate is strictly greater than 0 and at most 1, since it represents a fraction of eval fixtures that must pass. Zero would make the gate meaningless and values above 1 are impossible. The throw happens synchronously at definition time so bad configs fail fast.","triggerScenarios":"Passing requiredFixturePassRate <= 0 (e.g. 0, or a negative number), > 1 (e.g. 50 instead of 0.5), or a value that is NaN (NaN comparisons are false, so !(...) triggers).","commonSituations":"Confusing percentage (50) with fraction (0.5); copy-pasting a config where the field defaulted to 0; computing the rate dynamically and dividing by zero to get NaN.","solutions":["Set requiredFixturePassRate to a fraction in (0,1], e.g. 0.95 for 95%","Convert percentage inputs with value / 100 before passing","Guard the computed value: if (!Number.isFinite(rate) || rate <= 0 || rate > 1) fix upstream","Check the config source (env/JSON) is not supplying 0 as a placeholder"],"exampleFix":"// before\ndefineBuild({ entry, evals, requiredFixturePassRate: 95 });\n// after\ndefineBuild({ entry, evals, requiredFixturePassRate: 0.95 });","handlingStrategy":"validation","validationCode":"const rate = options.requiredFixturePassRate;\nif (!(Number.isFinite(rate) && rate > 0 && rate <= 1)) {\n  throw new Error(`requiredFixturePassRate must be a fraction in (0,1], got ${rate}`);\n}","typeGuard":"function isValidPassRate(v: unknown): v is number {\n  return typeof v === \"number\" && Number.isFinite(v) && v > 0 && v <= 1;\n}","tryCatchPattern":null,"preventionTips":["Store rates as fractions, never percentages","Validate all rate-like config fields with a shared (0,1] check","Reject non-finite numbers at config load time"],"tags":["config","validation","range-check"],"backgroundTag":"value-out-of-range","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"}