{"record":{"id":"2e3174b28c44e622","repo":"santifer/career-ops","slug":"removed-stale-reservation-sentinel-name","errorCode":null,"errorMessage":"Removed stale reservation sentinel: ${name}","messagePattern":"Removed stale reservation sentinel: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"verify-pipeline.mjs","lineNumber":251,"sourceCode":"if (boldScores === 0) ok('No bold in scores');\n\n// --- Check 8: Stale report-number sentinels (GC) ---\n// reserve-report-num.mjs drops NNN-RESERVED.md files in reports/ when a\n// number is claimed.  If the process crashed before writing the real report\n// and deleting the sentinel it will linger.  Sentinels older than 4 h are\n// stale; remove them here so they don't skew the next slot allocation.\nconst SENTINEL_MAX_AGE_MS = 4 * 60 * 60 * 1000;\nlet staleSentinels = 0;\nif (existsSync(REPORTS_DIR)) {\n  const now = Date.now();\n  for (const name of readdirSync(REPORTS_DIR)) {\n    if (!name.endsWith('-RESERVED.md')) continue;\n    const full = join(REPORTS_DIR, name);\n    try {\n      const { mtimeMs } = statSync(full);\n      if (now - mtimeMs > SENTINEL_MAX_AGE_MS) {\n        unlinkSync(full);\n        warn(`Removed stale reservation sentinel: ${name}`);\n        staleSentinels++;\n      }\n    } catch {\n      // Already gone between readdir and stat — fine.\n    }\n  }\n}\nif (staleSentinels === 0) ok('No stale reservation sentinels');\n\n// --- Check 9: Duplicate reports for the same company+role (#1425) ---\n// Two concurrent evaluators can each write a report for the same role.\n// merge-tracker dedups the TRACKER, but nothing watched reports/ itself.\n// Warning-level, not error: duplicates can be legitimate (re-evaluation\n// after a JD change).\nconst REPORT_FILE_RE = /^(\\d+)-(.+)-\\d{4}-\\d{2}-\\d{2}\\.md$/;\n// Shares normalizeTextKey with Check 2 so the two checks fold text the same\n// way (#2393). That is where the guarantee ends: this check keys off the\n// FILENAME slug, already ASCII by the time a report is written, while Check 2","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/santifer/career-ops/blob/e7abd431fce9348a95261acac9e0c14779c35df8/verify-pipeline.mjs#L233-L269","documentation":"A warning from verify-pipeline.mjs (Check 8, sentinel GC) that a `{NNN}-...-RESERVED.md` file in reports/ — created by reserve-report-num.mjs to claim report slots during parallel fan-outs — is older than SENTINEL_MAX_AGE_MS (~4h) and has been deleted. This implements the documented rule that stale sentinels are garbage-collected after 4h; the reservation it represented is dead and the slot is free again.","triggerScenarios":"Running `node verify-pipeline.mjs` when reports/ contains a -RESERVED.md whose mtime exceeds the max age — a reservation from a batch run that crashed after reserving (e.g. #749-race protection) and never wrote the real report or called `reserve-report-num.mjs --release`.","commonSituations":"A parallel fan-out worker died before writing its report; an operator reserved a range then abandoned the run; long-running evaluation exceeded 4h so its live reservation got collected; machine reboot orphaned sentinels from a previous session.","solutions":["Nothing to fix — the removal is the intended GC; verify the corresponding run's reports were or weren't produced.","If a fan-out is still in flight, re-reserve before continuing: `node reserve-report-num.mjs --count N` (do this right before spawning).","If the worker died, inspect batch/ outputs, fix the failure, and re-run the affected evaluations with fresh reservations.","Use `node reserve-report-num.mjs --release <range>` on abandonment instead of letting sentinels age out."],"exampleFix":"// before: abandoned reservation\nnode reserve-report-num.mjs --count 8   # worker crashed here\n// after: release when the fan-out is cancelled\nnode reserve-report-num.mjs --release 042-049","handlingStrategy":"retry","validationCode":"const ageMs = Date.now() - statSync(sentinelPath).mtimeMs;\nif (ageMs > 4 * 3600e3) { unlinkSync(sentinelPath); reReserveBeforeFanout(); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reserve report numbers immediately before spawning fan-outs, never hours ahead.","Always `--release` a reservation when cancelling a fan-out.","Treat long-running (>4h) evaluations as needing re-reservation on completion."],"tags":["garbage-collection","stale-file","concurrency","reports"],"backgroundTag":"stale-reservation-cleanup","analyzedSha":"e7abd431fce9348a95261acac9e0c14779c35df8","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}