{"record":{"id":"88755a3042651f1a","repo":"abhigyanpatwari/GitNexus","slug":"optional-icebug-engine-currently-requires-randomiz","errorCode":null,"errorMessage":"optional icebug engine currently requires randomize=false","messagePattern":"optional icebug engine currently requires randomize=false","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"gitnexus/src/core/ingestion/community-processor.ts","lineNumber":538,"sourceCode":"\nconst isIntegerPartition = (partition: ArrayLike<number>): boolean => {\n  for (let index = 0; index < partition.length; index++) {\n    if (!Number.isSafeInteger(partition[index])) return false;\n  }\n  return true;\n};\n\nconst runIcebugWorker = (\n  nodeCount: number,\n  csr: CommunityCsr,\n  options: CommunityDetectionOptions,\n): Promise<IcebugWorkerSuccess> => {\n  const threads = options.icebug?.threads ?? 1;\n  if (!Number.isSafeInteger(threads) || threads !== 1) {\n    throw new Error('optional icebug engine currently requires deterministic threads=1');\n  }\n  if (options.icebug?.randomize === true) {\n    throw new Error('optional icebug engine currently requires randomize=false');\n  }\n\n  const worker = new Worker(ICEBUG_WORKER_SOURCE, {\n    eval: true,\n    workerData: {\n      nodeCount,\n      indices: csr.indices,\n      indptr: csr.indptr,\n      threads,\n      seed: options.icebug?.seed ?? LEIDEN_SEED,\n      iterations: options.icebug?.iterations ?? 4,\n      gamma: options.icebug?.gamma ?? 1.0,\n      randomize: options.icebug?.randomize ?? false,\n    },\n  });\n\n  return new Promise((resolve, reject) => {\n    let settled = false;","sourceCodeStart":520,"sourceCodeEnd":556,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/ingestion/community-processor.ts#L520-L556","documentation":"Thrown by runIcebugWorker when options.icebug.randomize is explicitly true. The deterministic partition contract requires randomize=false (seeded Leiden). The worker even calls icebug.setSeed(seed, false) — the second arg is the 'deterministic' flag. Allowing randomize would break reproducibility of community IDs that downstream generated context depends on.","triggerScenarios":"Configuring engine: 'icebug' with icebug.randomize: true; copying an example config that set randomize for exploration.","commonSituations":"Operator experimenting with randomized Leiden for diversity; misreading the icebug API where randomize is a standard parameter; a config template that defaulted randomize to true.","solutions":["Set icebug.randomize to false (or omit it — default is false).","If you genuinely want randomized community detection, use the default Graphology engine which does not enforce this constraint, or accept the icebug engine is gated to deterministic mode.","Control reproducibility via the seed field instead of randomize."],"exampleFix":"// before — randomize true breaks determinism\nrunIcebugWorker(n, csr, { icebug: { threads: 1, randomize: true, seed: 42 } });\n\n// after — deterministic seeded run\nrunIcebugWorker(n, csr, { icebug: { threads: 1, randomize: false, seed: 42 } });","handlingStrategy":"validation","validationCode":"function isDeterministicIcebugRandomize(opts: { icebug?: { randomize?: unknown } }): boolean {\n  return opts.icebug?.randomize !== true;\n}\nif (!isDeterministicIcebugRandomize(options)) {\n  throw new Error('icebug requires randomize=false; refusing non-deterministic config');\n}","typeGuard":"function isIcebugRandomizeFalse(v: unknown): boolean {\n  return v !== true;\n}","tryCatchPattern":null,"preventionTips":["Omit icebug.randomize (default false) or set it explicitly to false.","Control reproducibility via icebug.seed, not randomize.","Switch to the default Graphology engine if randomized runs are truly required."],"tags":["icebug","community-detection","determinism","ingestion","config"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}