{"record":{"id":"706211637964f1e2","repo":"koala73/worldmonitor","slug":"crawlable-corpus-captured-dated-country-developments-for","errorCode":null,"errorMessage":"crawlable corpus captured dated country developments for ${developmentsPageCount} of ${indexedCountryPageCount} indexed country pages; expected at least ${floor}${ratioOverride != null ? ` (operator override ${ratioOverride})` : countryIndexAttempted ? ' for an index-era capture' : ''}. A snapshot that carries developments should cover far more than this — check the ${countryIndexAttempted ? 'per-country index top-up (coverage.developmentsCountryIndex) and the digest match ' : 'digest match and the freeze service key '}before republishing, or publish a measured-but-lower week with ${DEVELOPMENTS_COVERAGE_RATIO_ENV}.","messagePattern":"crawlable corpus captured dated country developments for (.+?) of (.+?) indexed country pages; expected at least (.+?)(.+?)\\)` : countryIndexAttempted \\? ' for an index-era capture' : ''\\}\\. A snapshot that carries developments should cover far more than this — check the (.+?)before republishing, or publish a measured-but-lower week with (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/build-crawlable-corpus.mjs","lineNumber":3667,"sourceCode":"\n// Pipeline tripwire decision (#7615, retuned in #7620 follow-up), exported for\n// tests: the per-page guard proves frozen items render; this proves the capture\n// did not collapse. `countryIndexAttempted` is the snapshot's own declaration\n// (it carries coverage.developmentsCountryIndex), so a snapshot frozen before\n// the index existed keeps the collapse floor.\nexport function assertDevelopmentsCoverage({\n  carriesDevelopments,\n  developmentsPageCount,\n  indexedCountryPageCount,\n  countryIndexAttempted = false,\n  ratioOverride = null,\n}) {\n  if (!carriesDevelopments) return;\n  const ratio = ratioOverride\n    ?? (countryIndexAttempted ? MIN_DEVELOPMENTS_COVERAGE_RATIO_WITH_COUNTRY_INDEX : MIN_DEVELOPMENTS_COVERAGE_RATIO);\n  const floor = Math.max(1, Math.ceil(indexedCountryPageCount * ratio));\n  if (developmentsPageCount < floor) {\n    throw new Error(\n      `crawlable corpus captured dated country developments for ${developmentsPageCount} `\n      + `of ${indexedCountryPageCount} indexed country pages; expected at least ${floor}`\n      + (ratioOverride != null ? ` (operator override ${ratioOverride})` : countryIndexAttempted ? ' for an index-era capture' : '')\n      + '. A snapshot that carries developments should cover far more than this — check the '\n      + (countryIndexAttempted\n        ? 'per-country index top-up (coverage.developmentsCountryIndex) and the digest match '\n        : 'digest match and the freeze service key ')\n      + `before republishing, or publish a measured-but-lower week with ${DEVELOPMENTS_COVERAGE_RATIO_ENV}.`,\n    );\n  }\n}\n\n/** Whether a frozen snapshot's freeze attempted the per-country article index top-up (#7748), whatever it answered. */\nexport function snapshotAttemptedCountryIndex(livePulse) {\n  const record = livePulse?.coverage?.developmentsCountryIndex;\n  return Boolean(record) && typeof record === 'object' && typeof record.state === 'string';\n}\n","sourceCodeStart":3649,"sourceCodeEnd":3685,"githubUrl":"https://github.com/koala73/worldmonitor/blob/7d06c8633d256c18e38133030bc3613976a96ec9/scripts/build-crawlable-corpus.mjs#L3649-L3685","documentation":"Tripwire enforcing that a corpus snapshot which includes dated country developments covers at least a minimum share (MIN_DEVELOPMENTS_COVERAGE_RATIO, or a higher floor when the per-country index top-up ran; overridable via CRAWLABLE_DEVELOPMENTS_COVERAGE_RATIO) of indexed country pages, with a floor of at least 1 page. Falling below the ceil(count * ratio) floor throws, blocking republish of an under-covered snapshot.","triggerScenarios":"Running the crawlable-corpus build with carriesDevelopments=true when developmentsPageCount is below Math.max(1, ceil(indexedCountryPageCount * ratio)) — e.g. the freeze service returned few items, the digest changed so few pages matched, or the per-country index top-up failed silently.","commonSituations":"Upstream news/freeze service outage during capture; stale digest causing the index top-up to miss; a genuinely slow news week with no override configured; coverage ratio defaults raised in a recent release.","solutions":["Inspect coverage.developmentsCountryIndex and verify the per-country index top-up ran and matched the digest.","Check the freeze service key / upstream developments feed for outages or empty responses.","If the capture is legitimately lower (slow week), set CRAWLABLE_DEVELOPMENTS_COVERAGE_RATIO to a measured, valid ratio and re-run.","Re-capture the snapshot after fixing the upstream source and republish."],"exampleFix":"// before (block republish, no override)\nnpm run build:crawlable-corpus\n// after (legitimately low week, measured override)\nCRAWLABLE_DEVELOPMENTS_COVERAGE_RATIO=0.35 npm run build:crawlable-corpus","handlingStrategy":"validation","validationCode":"const floor = Math.max(1, Math.ceil(indexed * ratio));\nif (developments < floor) throw new Error(`developments coverage ${developments}/${indexed} below floor ${floor}`);","typeGuard":null,"tryCatchPattern":"try { assertDevelopmentsCoverage({...}); } catch (e) { console.error(e.message); /* inspect coverage.developmentsCountryIndex / freeze service before overriding */ }","preventionTips":["Monitor the developments freeze service and index top-up health before capture.","Only use CRAWLABLE_DEVELOPMENTS_COVERAGE_RATIO with a measured, justified value.","Alert on coverage.developmentsCountryIndex drops in build telemetry."],"tags":["build","coverage","data-quality"],"backgroundTag":"schema-validation-failed","analyzedSha":"7d06c8633d256c18e38133030bc3613976a96ec9","analyzedAt":"2026-09-15T16:44:39.439Z","contentChangedAt":"2026-09-15T16:44:39.439Z","schemaVersion":2},"datasetVersion":"2026-09-15T18:17:12.389Z"}