{"record":{"id":"76096b4f024ba6d9","repo":"ruvnet/ruflo","slug":"lambda-must-be-in-0-1","errorCode":null,"errorMessage":"lambda must be in (0, 1)","messagePattern":"lambda must be in \\(0, 1\\)","errorType":"validation","errorClass":"RangeError","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/services/flywheel-sequential-evidence.ts","lineNumber":97,"sourceCode":"  if (!Number.isInteger(testIndex) || testIndex < 1) throw new RangeError('testIndex must be a positive integer');\n  if (!(alphaTotal > 0 && alphaTotal < 1)) throw new RangeError('alphaTotal must be in (0, 1)');\n  return (alphaTotal * 6) / (Math.PI * Math.PI * testIndex * testIndex);\n}\n\n/**\n * Fold paired outcomes into an anytime-valid e-value and judge it against the\n * k-th test's allocated alpha. Deterministic; order of outcomes does not\n * change the final e-value (the product commutes).\n */\nexport function sequentialEvidenceVerdict(\n  outcomes: PairedTaskOutcome[],\n  testIndex: number,\n  config: SequentialEvidenceConfig = {},\n): SequentialEvidenceVerdict {\n  const alphaTotal = config.alphaTotal ?? DEFAULT_ALPHA_TOTAL;\n  const lambda = config.lambda ?? DEFAULT_LAMBDA;\n  const epsilon = config.epsilon ?? DEFAULT_SCORE_EPSILON;\n  if (!(lambda > 0 && lambda < 1)) throw new RangeError('lambda must be in (0, 1)');\n  const alphaAllocated = alphaForTest(testIndex, alphaTotal);\n  const threshold = 1 / alphaAllocated;\n\n  let eValue = 1;\n  let informativePairs = 0;\n  for (const o of outcomes) {\n    const delta = o.candidateScore - o.baselineScore;\n    if (Math.abs(delta) <= epsilon) continue; // concordant: no information\n    informativePairs++;\n    // Under the null a discordant pair favors either arm with probability 1/2,\n    // so E[multiplier] = 1 and the running product is a martingale.\n    eValue *= delta > 0 ? 1 + lambda : 1 - lambda;\n  }\n\n  return {\n    significant: eValue >= threshold,\n    eValue,\n    threshold,","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/services/flywheel-sequential-evidence.ts#L79-L115","documentation":"RangeError guard on lambda, the per-win betting fraction in the anytime-valid e-value product. The e-process only converges when lambda is strictly between 0 and 1, so values at or outside those bounds are rejected before any pairs are folded.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/services/flywheel-sequential-evidence.ts:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose lambda strictly between 0 and 1, e.g. 0.5"],"exampleFix":"Set lambda to a value strictly between 0 and 1 (e.g. 0.5).","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}