{"record":{"id":"fbadb8df858edcf2","repo":"stablyai/orca","slug":"sync-runtime-graph-ts-no-longer-defines-the-update","errorCode":null,"errorMessage":"sync-runtime-graph.ts no longer defines the updatedAt bucket; re-sync this benchmark.","messagePattern":"sync-runtime-graph\\.ts no longer defines the updatedAt bucket; re-sync this benchmark\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/mobile-agent-status-projection-benchmark.mjs","lineNumber":28,"sourceCode":"//\n// The fix memoizes each row's JSON by entry identity, mirroring the\n// cachedTabsProjection pattern already in the same file, so a ping re-serializes\n// only the agent that actually changed.\n//\n// The bucket width is re-read from the real module so a drifted constant fails\n// loudly here instead of quietly changing what this benchmark measures.\nimport { readFileSync } from 'node:fs'\nimport { performance } from 'node:perf_hooks'\nimport { fileURLToPath } from 'node:url'\n\nconst GRAPH_SOURCE = readFileSync(\n  fileURLToPath(new URL('../../src/renderer/src/runtime/sync-runtime-graph.ts', import.meta.url)),\n  'utf8'\n)\n\nconst bucketMatch = GRAPH_SOURCE.match(/AGENT_STATUS_SYNC_UPDATED_AT_BUCKET_MS = ([0-9_]+)/)\nif (!bucketMatch) {\n  throw new Error(\n    'sync-runtime-graph.ts no longer defines the updatedAt bucket; re-sync this benchmark.'\n  )\n}\nconst BUCKET_MS = Number(bucketMatch[1].replaceAll('_', ''))\n\nconst ITERATIONS = Number.parseInt(process.env.ORCA_AGENT_PROJECTION_BENCH_ITERATIONS ?? '400', 10)\nconst WARMUP = Number.parseInt(process.env.ORCA_AGENT_PROJECTION_BENCH_WARMUP ?? '60', 10)\n\nfor (const [name, value] of [\n  ['ORCA_AGENT_PROJECTION_BENCH_ITERATIONS', ITERATIONS],\n  ['ORCA_AGENT_PROJECTION_BENCH_WARMUP', WARMUP]\n]) {\n  if (!Number.isInteger(value) || value <= 0) {\n    throw new Error(`${name} must be a positive integer, received ${value}`)\n  }\n}\n\nfunction toRow(paneKey, entry) {","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/mobile-agent-status-projection-benchmark.mjs#L10-L46","documentation":"Drift-detection guard. The benchmark reads src/renderer/src/runtime/sync-runtime-graph.ts as text and regex-extracts AGENT_STATUS_SYNC_UPDATED_AT_BUCKET_MS = <number>. If the constant is renamed, removed, reformatted (e.g. switched to a BigInt literal, moved to a separate file, or changed to a computed expression), the regex fails and the benchmark refuses to run rather than silently measuring against a wrong bucket size.","triggerScenarios":"Someone renames AGENT_STATUS_SYNC_UPDATED_AT_BUCKET_MS, moves it to another module, changes it from a numeric literal to an expression, or deletes it entirely from sync-runtime-graph.ts.","commonSituations":"Refactoring the runtime graph module; consolidating constants into a shared config file; converting the constant to a function parameter. The guard is designed to fire exactly then.","solutions":["Open sync-runtime-graph.ts and find the new shape of the bucket constant","Update the GRAPH_SOURCE regex in the benchmark to match the new definition location/format","If the constant moved to another file, point new URL(...) at the new file and adjust the regex","Re-run the benchmark to confirm BUCKET_MS is parsed correctly before trusting timings"],"exampleFix":"// before (sync-runtime-graph.ts moved the constant to a separate file)\nconst GRAPH_SOURCE = readFileSync(new URL('../../src/renderer/src/runtime/sync-runtime-graph.ts', import.meta.url), 'utf8')\n\n// after\nconst GRAPH_SOURCE = readFileSync(new URL('../../src/renderer/src/runtime/agent-status-constants.ts', import.meta.url), 'utf8')","handlingStrategy":"validation","validationCode":"const bucketMatch = GRAPH_SOURCE.match(/AGENT_STATUS_SYNC_UPDATED_AT_BUCKET_MS\\s*=\\s*([0-9_]+)/)\nif (!bucketMatch) {\n  throw new Error('sync-runtime-graph.ts drift: update the benchmark regex to match the new constant shape')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When refactoring sync-runtime-graph.ts, grep this benchmark for AGENT_STATUS_SYNC_UPDATED_AT_BUCKET_MS","Keep the constant as a plain numeric literal to preserve the regex match","Run the benchmark once after any runtime-graph change to catch drift early"],"tags":["drift-detection","benchmark","refactoring","source-coupling"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}