{"record":{"id":"404bc31d20a92ab8","repo":"ruvnet/ruflo","slug":"alphatotal-must-be-in-0-1","errorCode":null,"errorMessage":"alphaTotal must be in (0, 1)","messagePattern":"alphaTotal 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":80,"sourceCode":"export interface SequentialEvidenceVerdict {\n  significant: boolean;\n  eValue: number;\n  threshold: number;        // 1 / alphaAllocated\n  alphaAllocated: number;   // this test's share of the family-wise budget\n  testIndex: number;        // 1-based position in the lineage's test stream\n  informativePairs: number; // discordant pairs — the only ones carrying signal\n  totalPairs: number;\n  version: typeof SEQUENTIAL_EVIDENCE_VERSION;\n}\n\n/**\n * Alpha share for the k-th test in the stream: alphaTotal * 6/(pi^2 k^2).\n * Chosen over 2^-k because it decays polynomially — test 10 still gets a\n * workable ~0.6% of a 5% budget instead of ~0.005%.\n */\nexport function alphaForTest(testIndex: number, alphaTotal = DEFAULT_ALPHA_TOTAL): number {\n  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);","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/services/flywheel-sequential-evidence.ts#L62-L98","documentation":"RangeError guard on alphaTotal, the family-wise significance budget from which each test's share is carved. It must lie strictly in (0,1) — zero would allocate no alpha to any test and 1 (or more) is not a valid significance level.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/services/flywheel-sequential-evidence.ts:80 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose alphaTotal strictly between 0 and 1, e.g. 0.05"],"exampleFix":"Set alphaTotal to a value strictly between 0 and 1 (e.g. 0.05).","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-14T05:17:10.506Z"}