{"record":{"id":"441e1d339bae537f","repo":"stablyai/orca","slug":"advertised-url-watcher-ts-no-longer-contains-m","errorCode":null,"errorMessage":"advertised-url-watcher.ts no longer contains \\`${marker}\\`","messagePattern":"advertised-url-watcher\\.ts no longer contains \\\\`(.+?)\\\\`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"config/scripts/advertised-url-watcher-benchmark.mjs","lineNumber":40,"sourceCode":"      if (existsSync(fileURLToPath(candidate))) {\n        return { url: candidate.href, shortCircuit: true }\n      }\n    }\n    return nextResolve(specifier, context)\n  }\n})\n\nconst source = readFileSync(\n  new URL('../../src/main/ports/advertised-url-watcher.ts', import.meta.url),\n  'utf8'\n)\nfor (const marker of [\n  \"return mayContainHttpUrl(finalized) ? stripTerminalControls(finalized) : ''\",\n  'if (chunk.length >= PER_PTY_BUFFER_LIMIT)',\n  'this.raw.length + chunk.length > PER_PTY_BUFFER_LIMIT'\n]) {\n  if (!source.includes(marker)) {\n    throw new Error(`advertised-url-watcher.ts no longer contains \\`${marker}\\``)\n  }\n}\n\nconst { AdvertisedUrlWatcher, extractUrlCandidates, stripTerminalControls } = await import(\n  new URL('../../src/main/ports/advertised-url-watcher.ts', import.meta.url).href\n)\n\nconst BUFFER_LIMIT = 4096\nconst ITERATIONS = Number(process.env.ORCA_ADVERTISED_URL_BENCH_ITERATIONS ?? '10000')\nconst ROUNDS = Number(process.env.ORCA_ADVERTISED_URL_BENCH_ROUNDS ?? '12')\nconst WARMUP = Number(process.env.ORCA_ADVERTISED_URL_BENCH_WARMUP ?? '1000')\n\nfor (const [name, value] of [\n  ['ORCA_ADVERTISED_URL_BENCH_ITERATIONS', ITERATIONS],\n  ['ORCA_ADVERTISED_URL_BENCH_ROUNDS', ROUNDS],\n  ['ORCA_ADVERTISED_URL_BENCH_WARMUP', WARMUP]\n]) {\n  if (!Number.isSafeInteger(value) || value <= 0) {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/advertised-url-watcher-benchmark.mjs#L22-L58","documentation":"Thrown by the advertised-url-watcher benchmark as a drift guard: it asserts three exact source-string markers still exist in src/main/ports/advertised-url-watcher.ts before timing. The benchmark mirrors that file's hot-path logic (PER_PTY_BUFFER_LIMIT comparisons, mayContainHttpUrl/stripTerminalControls calls); if the production source changed shape, the benchmark's model is stale and would report misleading numbers.","triggerScenarios":"A refactor of advertised-url-watcher.ts renamed a method, changed a comparison operator, or restructured the early-return conditional; the buffer limit constant was renamed; the function was split or its body rewritten.","commonSituations":"Performance work or a bug fix touched the watcher's ingest path; someone extracted stripTerminalControls into a helper; the PER_PTY_BUFFER_LIMIT guard was reworded (>= vs >) — each of these legitimately changes the marker text.","solutions":["Re-read src/main/ports/advertised-url-watcher.ts and update the three marker strings in config/scripts/advertised-url-watcher-benchmark.mjs to match the current source.","Confirm the benchmark's mirrored BeforePtyBuffer / BeforeWatcher classes still model the pre-fix behavior you intend to measure against the new source.","If the marker changed because of a real behavior change, re-baseline expected results so the comparison stays honest.","Add a one-line comment near each production marker reminding editors to update the benchmark."],"exampleFix":"// before — production source changed '>= PER_PTY_BUFFER_LIMIT' to '> PER_PTY_BUFFER_LIMIT'\n// throw new Error('advertised-url-watcher.ts no longer contains `if (chunk.length >= PER_PTY_BUFFER_LIMIT)`')\n\n// after — update the marker to match current source\n// for (const marker of [\n//   'if (chunk.length > PER_PTY_BUFFER_LIMIT)',\n//   ...\n// ])","handlingStrategy":"validation","validationCode":"const { readFileSync } = require('node:fs')\n\nfunction assertWatcherMarkersPresent(markers) {\n  const src = readFileSync(new URL('../../src/main/ports/advertised-url-watcher.ts', import.meta.url), 'utf8')\n  const missing = markers.filter((m) => !src.includes(m))\n  if (missing.length) {\n    throw new Error(`Benchmark out of sync — update markers: ${missing.join(' | ')}`)\n  }\n}\n// assertWatcherMarkersPresent([...MARKERS]) at benchmark start","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When refactoring advertised-url-watcher.ts, grep the repo for its benchmark markers and update them in the same PR.","Add a comment block at the top of the source file listing the benchmark that mirrors its hot path, so editors know to update the benchmark.","Treat a benchmark drift-guard failure as a CI blocker, not a flake."],"tags":["benchmark","drift-guard","advertised-url","pty","maintenance"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}