mcp-web-validator 1.3.57 → 1.3.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +18 -0
  3. package/SECURITY.md +10 -0
  4. package/dist/audit-history.js +2 -0
  5. package/dist/audit-history.js.map +1 -1
  6. package/dist/index.js +8 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/language-subtags.js +2 -0
  9. package/dist/language-subtags.js.map +1 -1
  10. package/dist/mcp-bounds.js.map +1 -1
  11. package/dist/modules/browser-ux/axe-review.js +2 -0
  12. package/dist/modules/browser-ux/axe-review.js.map +1 -1
  13. package/dist/modules/browser-ux/lighthouse-lab-probe.js +2 -0
  14. package/dist/modules/browser-ux/lighthouse-lab-probe.js.map +1 -1
  15. package/dist/modules/browser-ux/lighthouse-lab.js +2 -0
  16. package/dist/modules/browser-ux/lighthouse-lab.js.map +1 -1
  17. package/dist/modules/browser-ux/media-diagnostics.js +2 -0
  18. package/dist/modules/browser-ux/media-diagnostics.js.map +1 -1
  19. package/dist/modules/browser-ux/raw-rendered-diff.js +90 -40
  20. package/dist/modules/browser-ux/raw-rendered-diff.js.map +1 -1
  21. package/dist/modules/browser-ux/raw-rendered-probe.js +18 -0
  22. package/dist/modules/browser-ux/raw-rendered-probe.js.map +1 -1
  23. package/dist/modules/browser-ux/resource-failures-probe.js +2 -0
  24. package/dist/modules/browser-ux/resource-failures-probe.js.map +1 -1
  25. package/dist/modules/browser-ux/resource-failures.js +2 -0
  26. package/dist/modules/browser-ux/resource-failures.js.map +1 -1
  27. package/dist/modules/browser-ux/viewport-parity-probe.js +2 -0
  28. package/dist/modules/browser-ux/viewport-parity-probe.js.map +1 -1
  29. package/dist/modules/browser-ux/viewport-parity.js +2 -0
  30. package/dist/modules/browser-ux/viewport-parity.js.map +1 -1
  31. package/dist/modules/browser-ux/wcag-interactions.js +2 -0
  32. package/dist/modules/browser-ux/wcag-interactions.js.map +1 -1
  33. package/dist/modules/change-regression/availability-history-store.js +2 -0
  34. package/dist/modules/change-regression/availability-history-store.js.map +1 -1
  35. package/dist/modules/change-regression/crawler-log-correlation.js +2 -0
  36. package/dist/modules/change-regression/crawler-log-correlation.js.map +1 -1
  37. package/dist/modules/change-regression/google-common-crawler-ip.js +2 -0
  38. package/dist/modules/change-regression/google-common-crawler-ip.js.map +1 -1
  39. package/dist/modules/change-regression/historical-comparisons.js +2 -0
  40. package/dist/modules/change-regression/historical-comparisons.js.map +1 -1
  41. package/dist/modules/change-regression/production-change-comparison.js +2 -0
  42. package/dist/modules/change-regression/production-change-comparison.js.map +1 -1
  43. package/dist/modules/change-regression/regression-alerts.js.map +1 -1
  44. package/dist/modules/change-regression/strict-observation-time.js +2 -0
  45. package/dist/modules/change-regression/strict-observation-time.js.map +1 -1
  46. package/dist/modules/content-schema/citation-methodology-consistency.js +2 -0
  47. package/dist/modules/content-schema/citation-methodology-consistency.js.map +1 -1
  48. package/dist/modules/content-schema/competitor-intent-comparison.js.map +1 -1
  49. package/dist/modules/content-schema/empty-boilerplate-content.js +2 -0
  50. package/dist/modules/content-schema/empty-boilerplate-content.js.map +1 -1
  51. package/dist/modules/content-schema/extract-citation-methodology.js +2 -0
  52. package/dist/modules/content-schema/extract-citation-methodology.js.map +1 -1
  53. package/dist/modules/content-schema/extract-competitor-intent.js +2 -0
  54. package/dist/modules/content-schema/extract-competitor-intent.js.map +1 -1
  55. package/dist/modules/content-schema/extract-main-content.js +2 -0
  56. package/dist/modules/content-schema/extract-main-content.js.map +1 -1
  57. package/dist/modules/content-schema/extract-metadata-consistency.js +2 -0
  58. package/dist/modules/content-schema/extract-metadata-consistency.js.map +1 -1
  59. package/dist/modules/content-schema/extract-product-claims.js +4 -1
  60. package/dist/modules/content-schema/extract-product-claims.js.map +1 -1
  61. package/dist/modules/content-schema/extract-structured-data.js +2 -0
  62. package/dist/modules/content-schema/extract-structured-data.js.map +1 -1
  63. package/dist/modules/content-schema/metadata-consistency.js +2 -0
  64. package/dist/modules/content-schema/metadata-consistency.js.map +1 -1
  65. package/dist/modules/content-schema/product-claims.js.map +1 -1
  66. package/dist/modules/content-schema/same-language-duplicates.js.map +1 -1
  67. package/dist/modules/content-schema/structured-data-validation.js +2 -0
  68. package/dist/modules/content-schema/structured-data-validation.js.map +1 -1
  69. package/dist/modules/external-metrics/crux-field-probe.js +2 -0
  70. package/dist/modules/external-metrics/crux-field-probe.js.map +1 -1
  71. package/dist/modules/external-metrics/crux-field.js +2 -0
  72. package/dist/modules/external-metrics/crux-field.js.map +1 -1
  73. package/dist/modules/http-crawl/availability-observations.d.ts +0 -5
  74. package/dist/modules/http-crawl/availability-observations.js +8 -17
  75. package/dist/modules/http-crawl/availability-observations.js.map +1 -1
  76. package/dist/modules/http-crawl/availability-probe.js.map +1 -1
  77. package/dist/modules/http-crawl/crawler-access-probe.js +2 -0
  78. package/dist/modules/http-crawl/crawler-access-probe.js.map +1 -1
  79. package/dist/modules/http-crawl/crawler-access.js +2 -0
  80. package/dist/modules/http-crawl/crawler-access.js.map +1 -1
  81. package/dist/modules/http-crawl/http-delivery-probe.js +2 -0
  82. package/dist/modules/http-crawl/http-delivery-probe.js.map +1 -1
  83. package/dist/modules/http-crawl/http-delivery.js +4 -1
  84. package/dist/modules/http-crawl/http-delivery.js.map +1 -1
  85. package/dist/modules/http-crawl/https-security.js +2 -0
  86. package/dist/modules/http-crawl/https-security.js.map +1 -1
  87. package/dist/modules/http-crawl/non-html-directives.js +44 -14
  88. package/dist/modules/http-crawl/non-html-directives.js.map +1 -1
  89. package/dist/modules/http-crawl/redirect-canonical-chains.js +2 -0
  90. package/dist/modules/http-crawl/redirect-canonical-chains.js.map +1 -1
  91. package/dist/modules/http-crawl/redirect-canonical-probe.js +2 -0
  92. package/dist/modules/http-crawl/redirect-canonical-probe.js.map +1 -1
  93. package/dist/modules/http-crawl/sitemap-inventory-probe.js +2 -0
  94. package/dist/modules/http-crawl/sitemap-inventory-probe.js.map +1 -1
  95. package/dist/modules/http-crawl/sitemap-inventory.js +21 -2
  96. package/dist/modules/http-crawl/sitemap-inventory.js.map +1 -1
  97. package/dist/modules/http-crawl/url-variants.js +2 -0
  98. package/dist/modules/http-crawl/url-variants.js.map +1 -1
  99. package/dist/modules/site-architecture/extract-internal-links.js +38 -4
  100. package/dist/modules/site-architecture/extract-internal-links.js.map +1 -1
  101. package/dist/modules/site-architecture/extract-multilingual-page.js +2 -0
  102. package/dist/modules/site-architecture/extract-multilingual-page.js.map +1 -1
  103. package/dist/modules/site-architecture/internal-link-graph-probe.js +2 -0
  104. package/dist/modules/site-architecture/internal-link-graph-probe.js.map +1 -1
  105. package/dist/modules/site-architecture/internal-link-graph.js +2 -0
  106. package/dist/modules/site-architecture/internal-link-graph.js.map +1 -1
  107. package/dist/modules/site-architecture/internal-link-quality.js +2 -0
  108. package/dist/modules/site-architecture/internal-link-quality.js.map +1 -1
  109. package/dist/modules/site-architecture/multilingual-clusters.js +2 -0
  110. package/dist/modules/site-architecture/multilingual-clusters.js.map +1 -1
  111. package/dist/network-protocol.d.ts +3 -0
  112. package/dist/network-protocol.js +9 -0
  113. package/dist/network-protocol.js.map +1 -0
  114. package/dist/network.js +12 -0
  115. package/dist/network.js.map +1 -1
  116. package/dist/nu-ephemeral.js +2 -0
  117. package/dist/nu-ephemeral.js.map +1 -1
  118. package/dist/presentation.js +3 -1
  119. package/dist/presentation.js.map +1 -1
  120. package/dist/report.js +4 -2
  121. package/dist/report.js.map +1 -1
  122. package/dist/screenshot-proxy.js +2 -0
  123. package/dist/screenshot-proxy.js.map +1 -1
  124. package/dist/screenshot.d.ts +1 -1
  125. package/dist/screenshot.js +3 -1
  126. package/dist/screenshot.js.map +1 -1
  127. package/dist/seo-auditor.js +20 -10
  128. package/dist/seo-auditor.js.map +1 -1
  129. package/dist/stylelint-validator.js +2 -0
  130. package/dist/stylelint-validator.js.map +1 -1
  131. package/dist/version.js +2 -0
  132. package/dist/version.js.map +1 -1
  133. package/dist/visual-diff.js +9 -1
  134. package/dist/visual-diff.js.map +1 -1
  135. package/dist/w3c-validator.js +2 -0
  136. package/dist/w3c-validator.js.map +1 -1
  137. package/package.json +4 -3
  138. package/scripts/deep-audit-optional.mjs +7 -0
@@ -1 +1 @@
1
- {"version":3,"file":"historical-comparisons.js","sourceRoot":"","sources":["../../../src/modules/change-regression/historical-comparisons.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAC1C,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC;AACpD,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAClD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACxC,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,mBAAmB,EAAE,SAAS,EAAE,gBAAgB,CAAU,CAAC;AAE/F,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,kBAAkB,EAAE,6BAA6B,EAAE,gBAAgB;IACnE,qBAAqB,EAAE,yBAAyB,EAAE,iBAAiB;IACnE,oBAAoB,EAAE,eAAe,EAAE,2BAA2B;IAClE,yBAAyB,EAAE,wBAAwB;CAC3C,CAAC;AA+GX,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,MAAM,GAAG,GAAG,CAAC,KAAc,EAAE,GAAG,GAAG,SAAS,EAAmB,EAAE,CAC/D,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,GAAG,CAAC;AAEzF,MAAM,UAAU,qBAAqB,CACnC,MAAkC;IAElC,OA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AAG,MAAM,CAAC,0BAA0B,KAAK,MAAM,CAAC,gBAAgB;QAC3E,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,mBAAmB,IAAI,MAAM,CAAC,0BAA0B;QAClF,SAAS,IAAI,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC;IACpF,IAAI,CAAC,MAAM,CAAC,wBAAwB;QAAE,GAAG,CAAC,CAAC,EAAE,yBAAyB,EAAE,SAAS,EAC/E,kHAAkH,CAAC,CAAC;IACtH,GAAG,CAAC,CAAC,EAAE,wBAAwB,EAAE,MAAM,EACrC,sHAAsH,CAAC,CAAC;IAC1H,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACzF,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACzD,MAAM,CAAC,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;IACxC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC;IAC7D,MAAM,CAAC,kBAAkB,GAAG,QAAQ,CAAC,MAAM,GAAG,uBAAuB,CAAC;IACtE,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * P2-01: pure offline longitudinal comparisons of already-saved or supplied\n * compact site-audit snapshots. One analyzer for both MCP runtimes.\n * No network, filesystem, storage, timers or external dependency.\n *\n * An audit's absent observation is NOT a fixed defect. Stable cohort trends\n * contain only pages completed across every supplied version.\n */\nimport { strictObservationTime } from \"./strict-observation-time.js\";\n\nexport const MAX_HISTORICAL_VERSIONS = 10;\nexport const MAX_HISTORICAL_SNAPSHOT_BYTES = 60_000;\nexport const MAX_HISTORICAL_TOTAL_BYTES = 610_000;\nexport const MAX_HISTORICAL_PAGES = 8;\nexport const MAX_HISTORICAL_GROUPS = 50;\nexport const MAX_HISTORICAL_FINDINGS = 12;\n\nexport const HISTORICAL_STATUSES = [\"comparable_sample\", \"partial\", \"not_comparable\"] as const;\nexport type HistoricalStatus = typeof HISTORICAL_STATUSES[number];\nexport const HISTORICAL_FINDING_CODES = [\n \"equal_timestamps\", \"changed_sitemap_fingerprint\", \"changed_sample\",\n \"incomplete_coverage\", \"nonoverlapping_versions\", \"regressed_pages\",\n \"mixed_page_changes\", \"coverage_lost\", \"group_changes_unavailable\",\n \"all_versions_incomplete\", \"historical_sample_only\",\n] as const;\nexport type HistoricalFindingCode = typeof HISTORICAL_FINDING_CODES[number];\n\nexport interface HistoricalPage {\n url: string;\n fetched_url?: string;\n status: \"passed\" | \"needs_attention\" | \"partial\" | \"failed\" | \"skipped\";\n page_fetched: boolean;\n html_validation_status: \"completed\" | \"timeout\" | \"unavailable\" | \"not_run\";\n html_errors: number;\n html_warnings: number;\n seo_errors: number;\n seo_warnings: number;\n schema_errors: number;\n schema_warnings: number;\n health_score?: number;\n redirects_followed?: number;\n}\nexport interface HistoricalIssueGroup {\n category: \"HTML\" | \"SEO\" | \"Schema\" | \"Accessibility\";\n severity: \"error\" | \"warning\" | \"info\";\n code?: string;\n message: string;\n affected_pages: number;\n}\nexport interface HistoricalSnapshot {\n site_url: string;\n discovery: \"sitemap\" | \"root_only\" | \"partial\";\n discovery_error?: string;\n discovery_fingerprint: string;\n pages_selected: number;\n pages_discovered: number;\n pages_partial: number;\n pages_failed: number;\n pages_skipped_robots: number;\n truncated: boolean;\n score_coverage_percent: number;\n pages: HistoricalPage[];\n issue_groups: HistoricalIssueGroup[];\n issue_groups_truncated: boolean;\n}\nexport interface HistoricalVersion {\n saved_at: string;\n snapshot: HistoricalSnapshot;\n}\nexport interface HistoricalPoint {\n version: number;\n sampled_pages: number;\n completed_pages: number;\n sample_limited: boolean;\n cohort_completed_pages: number;\n cohort_errors: number | null;\n cohort_warnings: number | null;\n cohort_mean_health_score: number | null;\n}\nexport interface HistoricalStep {\n baseline_version: number;\n current_version: number;\n status: HistoricalStatus;\n shared_pages: number;\n completely_checked_pairs: number;\n regressed_pages: number;\n improved_pages: number;\n mixed_pages: number;\n unchanged_pages: number;\n coverage_lost_pages: number;\n coverage_recovered_pages: number;\n unverified_pages: number;\n errors_delta_checked: number;\n warnings_delta_checked: number;\n changed_sample: boolean;\n sitemap_changed: boolean;\n issue_group_comparison_available: boolean;\n newly_observed_groups: number | null;\n no_longer_observed_groups: number | null;\n expanding_groups: number | null;\n shrinking_groups: number | null;\n}\nexport interface HistoricalFinding {\n version: number;\n code: HistoricalFindingCode;\n severity: \"warning\" | \"info\";\n message: string;\n}\nexport interface HistoricalReview {\n scope: \"historical_compact_audit_versions_only\";\n source: \"local_saved_ids\" | \"caller_supplied_snapshots\";\n status: HistoricalStatus;\n versions_compared: number;\n comparisons_made: number;\n comparable_transitions: number;\n partial_transitions: number;\n not_comparable_transitions: number;\n stable_cohort_pages: number;\n complete_stable_cohort_pages: number;\n cohort_metrics_available: boolean;\n time_order_ambiguous: boolean;\n total_regressed_page_transitions: number;\n total_improved_page_transitions: number;\n total_coverage_lost_transitions: number;\n historical_points: HistoricalPoint[];\n consecutive_changes: HistoricalStep[];\n first_last_change: HistoricalStep | null;\n coverage_limited: true;\n limitations: string[];\n total_findings: number;\n findings: HistoricalFinding[];\n findings_truncated: boolean;\n error?: string;\n}\n\nconst encoder = new TextEncoder();\nconst int = (value: unknown, max = 1_000_000): value is number =>\n typeof value === \"number\" && Number.isSafeInteger(value) && value >= 0 && value <= max;\n\nexport function emptyHistoricalReview(\n source: HistoricalReview[\"source\"],\n): HistoricalReview {\n return {\n scope: \"historical_compact_audit_versions_only\",\n source, status: \"not_comparable\", versions_compared: 0,\n comparisons_made: 0, comparable_transitions: 0, partial_transitions: 0,\n not_comparable_transitions: 0, stable_cohort_pages: 0,\n complete_stable_cohort_pages: 0, cohort_metrics_available: false,\n time_order_ambiguous: false, total_regressed_page_transitions: 0,\n total_improved_page_transitions: 0, total_coverage_lost_transitions: 0,\n historical_points: [], consecutive_changes: [], first_last_change: null,\n coverage_limited: true,\n limitations: [\n \"The supplied historical audit versions could not be compared within evidence and chronology limits.\",\n ],\n total_findings: 0, findings: [], findings_truncated: false,\n };\n}\n\nfunction safeUrl(value: unknown): string {\n if (typeof value !== \"string\" || value.length > 2_048 ||\n /[\\\\\\u0000-\\u001f\\u007f-\\u009f]/u.test(value)) {\n throw new Error(\"Invalid saved historical URL label\");\n }\n const result = new URL(value);\n if (![\"http:\", \"https:\"].includes(result.protocol) || !result.hostname ||\n result.username || result.password || result.port || result.search || result.hash) {\n throw new Error(\"Unsafe saved historical URL label\");\n }\n return result.href;\n}\nfunction checkDate(value: unknown): number {\n const parsed = strictObservationTime(value);\n if (parsed === undefined) throw new Error(\"History requires a real calendar date and ISO timestamp with UTC offset\");\n return parsed;\n}\nfunction complete(page: HistoricalPage): boolean {\n return page.page_fetched && page.html_validation_status === \"completed\"\n && (page.status === \"passed\" || page.status === \"needs_attention\")\n && typeof page.health_score === \"number\";\n}\nfunction errorTotal(page: HistoricalPage): number {\n return page.html_errors + page.seo_errors + page.schema_errors;\n}\nfunction warningTotal(page: HistoricalPage): number {\n return page.html_warnings + page.seo_warnings + page.schema_warnings;\n}\nfunction groupKey(group: HistoricalIssueGroup): string {\n return JSON.stringify([group.category, group.severity,\n group.code ? \"code\" : \"message\", group.code ?? group.message]);\n}\ninterface PreparedVersion {\n snapshot: HistoricalSnapshot;\n pages: Map<string, HistoricalPage>;\n completed: Set<string>;\n groups: Map<string, HistoricalIssueGroup>;\n duplicateGroups: boolean;\n sampleLimited: boolean;\n}\nfunction prepare(snapshot: HistoricalSnapshot): PreparedVersion {\n if (!snapshot || typeof snapshot !== \"object\"\n || !Array.isArray(snapshot.pages) || snapshot.pages.length > MAX_HISTORICAL_PAGES\n || !Array.isArray(snapshot.issue_groups) || snapshot.issue_groups.length > MAX_HISTORICAL_GROUPS\n || !int(snapshot.pages_selected) || !int(snapshot.pages_discovered)\n || !int(snapshot.pages_partial) || !int(snapshot.pages_failed)\n || !int(snapshot.pages_skipped_robots)\n || !int(snapshot.score_coverage_percent, 100)\n || typeof snapshot.truncated !== \"boolean\"\n || typeof snapshot.issue_groups_truncated !== \"boolean\"\n || !/^[a-f0-9]{64}$/u.test(snapshot.discovery_fingerprint)) {\n throw new Error(\"Invalid or oversized historical snapshot structure\");\n }\n if (![\"sitemap\", \"root_only\", \"partial\"].includes(snapshot.discovery)) {\n throw new Error(\"Unsupported historical discovery state\");\n }\n const origin = new URL(safeUrl(snapshot.site_url)).origin;\n const pages = new Map<string, HistoricalPage>();\n const completed = new Set<string>();\n for (const page of snapshot.pages) {\n if (!page || typeof page !== \"object\" || !page.url ||\n ![\"passed\", \"needs_attention\", \"partial\", \"failed\", \"skipped\"].includes(page.status) ||\n ![\"completed\", \"timeout\", \"unavailable\", \"not_run\"].includes(page.html_validation_status) ||\n typeof page.page_fetched !== \"boolean\" ||\n ![page.html_errors, page.html_warnings, page.seo_errors, page.seo_warnings,\n page.schema_errors, page.schema_warnings].every((value) => int(value)) ||\n (page.health_score !== undefined && (!Number.isInteger(page.health_score) ||\n page.health_score < 0 || page.health_score > 100)) ||\n (page.redirects_followed !== undefined && !int(page.redirects_followed, 3))) {\n throw new Error(\"Invalid bounded page evidence\");\n }\n const url = safeUrl(page.url);\n if (new URL(url).origin !== origin || pages.has(url)) {\n throw new Error(\"Duplicate or cross-origin historical page labels\");\n }\n if (page.fetched_url !== undefined) safeUrl(page.fetched_url);\n pages.set(url, page);\n if (complete(page)) completed.add(url);\n }\n const groups = new Map<string, HistoricalIssueGroup>();\n for (const group of snapshot.issue_groups) {\n if (!group || typeof group !== \"object\" ||\n ![\"HTML\", \"SEO\", \"Schema\", \"Accessibility\"].includes(group.category) ||\n ![\"error\", \"warning\", \"info\"].includes(group.severity) ||\n typeof group.message !== \"string\" || group.message.length > 300 ||\n (group.code !== undefined && (typeof group.code !== \"string\" || group.code.length > 120)) ||\n !int(group.affected_pages) || group.affected_pages > snapshot.pages.length) {\n throw new Error(\"Invalid bounded historical issue-group evidence\");\n }\n groups.set(groupKey(group), group);\n }\n return {\n snapshot, pages, completed, groups,\n duplicateGroups: groups.size !== snapshot.issue_groups.length,\n sampleLimited: snapshot.truncated || snapshot.pages_selected !== pages.size ||\n snapshot.pages_partial > 0 || snapshot.pages_failed > 0 ||\n snapshot.pages_skipped_robots > 0 || snapshot.discovery !== \"sitemap\" ||\n Boolean(snapshot.discovery_error) || snapshot.issue_groups_truncated ||\n completed.size !== pages.size,\n };\n}\n\nfunction comparePrepared(a: PreparedVersion, b: PreparedVersion, from: number, to: number): HistoricalStep {\n const shared = [...a.pages.keys()].filter((key) => b.pages.has(key));\n const changedSample = a.pages.size !== b.pages.size ||\n shared.length !== a.pages.size || shared.length !== b.pages.size;\n const sitemapChanged = a.snapshot.discovery_fingerprint !== b.snapshot.discovery_fingerprint;\n let checked = 0, regressed = 0, improved = 0, mixed = 0, unchanged = 0;\n let lost = 0, recovered = 0, unverified = 0;\n let errorsDelta = 0, warningsDelta = 0;\n for (const key of shared) {\n const before = a.pages.get(key)!;\n const after = b.pages.get(key)!;\n const oldDone = a.completed.has(key);\n const newDone = b.completed.has(key);\n if (oldDone && newDone) {\n checked++;\n const e = errorTotal(after) - errorTotal(before);\n const w = warningTotal(after) - warningTotal(before);\n errorsDelta += e;\n warningsDelta += w;\n const worse = e > 0 || w > 0;\n const better = e < 0 || w < 0;\n if (worse && better) mixed++;\n else if (worse) regressed++;\n else if (better) improved++;\n else unchanged++;\n } else if (oldDone && !newDone) lost++;\n else if (!oldDone && newDone) recovered++;\n else unverified++;\n }\n const sampleAligned = !changedSample && !sitemapChanged &&\n !a.sampleLimited && !b.sampleLimited &&\n checked === shared.length;\n const groupComparable = !changedSample && !sitemapChanged &&\n a.snapshot.pages_selected === a.pages.size &&\n b.snapshot.pages_selected === b.pages.size &&\n !a.snapshot.issue_groups_truncated &&\n !b.snapshot.issue_groups_truncated &&\n !a.duplicateGroups && !b.duplicateGroups &&\n checked === shared.length && shared.length > 0;\n let newGroups: number | null = null;\n let goneGroups: number | null = null;\n let expanding: number | null = null;\n let shrinking: number | null = null;\n if (groupComparable) {\n newGroups = [...b.groups.keys()].filter((key) => !a.groups.has(key)).length;\n goneGroups = [...a.groups.keys()].filter((key) => !b.groups.has(key)).length;\n expanding = [...b.groups].filter(([key, group]) =>\n a.groups.has(key) && group.affected_pages > a.groups.get(key)!.affected_pages).length;\n shrinking = [...b.groups].filter(([key, group]) =>\n a.groups.has(key) && group.affected_pages < a.groups.get(key)!.affected_pages).length;\n }\n return {\n baseline_version: from, current_version: to,\n status: shared.length === 0 ? \"not_comparable\" :\n sampleAligned ? \"comparable_sample\" : \"partial\",\n shared_pages: shared.length, completely_checked_pairs: checked,\n regressed_pages: regressed, improved_pages: improved,\n mixed_pages: mixed, unchanged_pages: unchanged,\n coverage_lost_pages: lost, coverage_recovered_pages: recovered,\n unverified_pages: unverified,\n errors_delta_checked: errorsDelta, warnings_delta_checked: warningsDelta,\n changed_sample: changedSample, sitemap_changed: sitemapChanged,\n issue_group_comparison_available: groupComparable,\n newly_observed_groups: newGroups, no_longer_observed_groups: goneGroups,\n expanding_groups: expanding, shrinking_groups: shrinking,\n };\n}\n\n/** All caller input is assumed untrusted and is validated, even for local saved versions. */\nexport function analyzeHistoricalAudits(\n versions: HistoricalVersion[], source: HistoricalReview[\"source\"],\n): HistoricalReview {\n if (![\"local_saved_ids\", \"caller_supplied_snapshots\"].includes(source) ||\n !Array.isArray(versions) || versions.length < 2 ||\n versions.length > MAX_HISTORICAL_VERSIONS) {\n throw new Error(\"Require between two and ten historical audit versions\");\n }\n let totalBytes = 0;\n let prevTime = Number.NEGATIVE_INFINITY;\n let equalTime = false;\n const prepared: PreparedVersion[] = [];\n let origin: string | undefined;\n for (const version of versions) {\n if (!version || typeof version !== \"object\" || !version.snapshot) {\n throw new Error(\"Invalid historical version\");\n }\n const time = checkDate(version.saved_at);\n if (time < prevTime) throw new Error(\"Historical versions must be ordered oldest to newest\");\n if (time === prevTime) equalTime = true;\n prevTime = time;\n const bytes = encoder.encode(JSON.stringify(version.snapshot)).byteLength;\n if (bytes > MAX_HISTORICAL_SNAPSHOT_BYTES) {\n throw new Error(\"Historical snapshot exceeds 60 KB\");\n }\n totalBytes += bytes;\n if (totalBytes > MAX_HISTORICAL_TOTAL_BYTES) {\n throw new Error(\"Total historical evidence exceeds 610 KB\");\n }\n const siteOrigin = new URL(safeUrl(version.snapshot.site_url)).origin;\n if (origin !== undefined && siteOrigin !== origin) {\n throw new Error(\"Historical versions must share one site origin\");\n }\n origin = siteOrigin;\n prepared.push(prepare(version.snapshot));\n }\n const result = emptyHistoricalReview(source);\n result.versions_compared = prepared.length;\n result.comparisons_made = prepared.length - 1;\n result.time_order_ambiguous = equalTime;\n result.limitations = [\n \"Comparison uses only saved or caller-supplied compact audit evidence; no new HTTP requests, stored-history mutation, crawling, indexing, ranking or causal analysis is performed.\",\n \"Errors and warnings are compared only for matching pages with complete checks in both snapshots; unknown or failed checks are coverage changes, never demonstrated fixes.\",\n \"Cross-version cohort trends cover only exact URLs fully checked in every supplied version; changes in sitemap sampling or discovery fingerprint limit conclusions to comparable sampled pages.\",\n \"Issue-group appearance/disappearance is counted only with identical fully checked selected pages and matching discovery fingerprints. Even then, changes are sampled evidence, not site-wide resolution.\",\n ];\n let stable = new Set(prepared[0].pages.keys());\n let completeStable = new Set(prepared[0].completed);\n for (const v of prepared.slice(1)) {\n stable = new Set([...stable].filter((key) => v.pages.has(key)));\n completeStable = new Set([...completeStable].filter((key) => v.completed.has(key)));\n }\n result.stable_cohort_pages = stable.size;\n result.complete_stable_cohort_pages = completeStable.size;\n result.cohort_metrics_available = completeStable.size > 0;\n prepared.forEach((v, i) => {\n const stablePages = [...completeStable].map((key) => v.pages.get(key)!);\n const n = stablePages.length;\n result.historical_points.push({\n version: i + 1, sampled_pages: v.pages.size,\n completed_pages: v.completed.size,\n sample_limited: v.sampleLimited,\n cohort_completed_pages: n,\n cohort_errors: n ? stablePages.reduce((acc, page) => acc + errorTotal(page), 0) : null,\n cohort_warnings: n ? stablePages.reduce((acc, page) => acc + warningTotal(page), 0) : null,\n cohort_mean_health_score: n ? Math.round(\n 100 * stablePages.reduce((acc, page) => acc + page.health_score!, 0) / n,\n ) / 100 : null,\n });\n });\n const findings: HistoricalFinding[] = [];\n const add = (version: number, code: HistoricalFindingCode,\n severity: \"warning\" | \"info\", message: string) => findings.push({\n version, code, severity, message,\n });\n if (equalTime) add(1, \"equal_timestamps\", \"info\",\n \"Two or more source versions have equal timestamps; preserve saved ordering, but their exact time order cannot be independently established.\");\n for (let i = 1; i < prepared.length; i++) {\n const step = comparePrepared(prepared[i - 1], prepared[i], i, i + 1);\n result.consecutive_changes.push(step);\n if (step.status === \"comparable_sample\") result.comparable_transitions++;\n else if (step.status === \"partial\") result.partial_transitions++;\n else result.not_comparable_transitions++;\n result.total_regressed_page_transitions += step.regressed_pages;\n result.total_improved_page_transitions += step.improved_pages;\n result.total_coverage_lost_transitions += step.coverage_lost_pages;\n if (step.status === \"not_comparable\") {\n add(i + 1, \"nonoverlapping_versions\", \"warning\",\n \"Consecutive versions share no exact audited page labels; a regression or improvement cannot be established.\");\n }\n if (step.changed_sample) add(i + 1, \"changed_sample\", \"info\",\n \"The selected page sample changed; absent pages are not proven repaired or broken.\");\n if (step.sitemap_changed) add(i + 1, \"changed_sitemap_fingerprint\", \"info\",\n \"Discovery fingerprints changed; historical issue and coverage trends may reflect different selections.\");\n if (step.status === \"partial\") add(i + 1, \"incomplete_coverage\", \"info\",\n \"An incomplete check, discovery constraint or differing sample limits this version-pair comparison.\");\n if (step.regressed_pages) add(i + 1, \"regressed_pages\", \"warning\",\n \"At least one matched, fully checked page has more observed errors or warnings than in the prior version.\");\n if (step.mixed_pages) add(i + 1, \"mixed_page_changes\", \"info\",\n \"Some matched pages show opposing error and warning changes; they are not simple improvements.\");\n if (step.coverage_lost_pages) add(i + 1, \"coverage_lost\", \"warning\",\n \"A previously completed page lacked a comparable completed check in the later version; this is not a demonstrated defect regression.\");\n if (!step.issue_group_comparison_available) add(i + 1, \"group_changes_unavailable\", \"info\",\n \"Issue-group appearance and disappearance cannot be safely compared for this version pair.\");\n }\n result.first_last_change = comparePrepared(prepared[0], prepared.at(-1)!, 1, prepared.length);\n result.status = result.not_comparable_transitions === result.comparisons_made\n ? \"not_comparable\" : result.partial_transitions || result.not_comparable_transitions ||\n equalTime || !result.cohort_metrics_available ? \"partial\" : \"comparable_sample\";\n if (!result.cohort_metrics_available) add(1, \"all_versions_incomplete\", \"warning\",\n \"No page was completely audited in every supplied version; longitudinal error and warning trends are unavailable.\");\n add(1, \"historical_sample_only\", \"info\",\n \"Historical changes describe only the exact selected audit samples, never full-site health or Google Search outcomes.\");\n findings.sort((a, b) => (a.severity === b.severity ? 0 : a.severity === \"warning\" ? -1 : 1) ||\n a.version - b.version || a.code.localeCompare(b.code));\n result.total_findings = findings.length;\n result.findings = findings.slice(0, MAX_HISTORICAL_FINDINGS);\n result.findings_truncated = findings.length > MAX_HISTORICAL_FINDINGS;\n return result;\n}\n"]}
1
+ {"version":3,"file":"historical-comparisons.js","sourceRoot":"","sources":["../../../src/modules/change-regression/historical-comparisons.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,+BAA+B;AAC/B;;;;;;;GAOG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAC1C,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC;AACpD,MAAM,CAAC,MAAM,0BAA0B,GAAG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,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACzF,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACzD,MAAM,CAAC,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC;IACxC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,uBAAuB,CAAC,CAAC;IAC7D,MAAM,CAAC,kBAAkB,GAAG,QAAQ,CAAC,MAAM,GAAG,uBAAuB,CAAC;IACtE,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) 2026 AKzar1el and Web Validator contributors\n// SPDX-License-Identifier: MIT\n/**\n * P2-01: pure offline longitudinal comparisons of already-saved or supplied\n * compact site-audit snapshots. One analyzer for both MCP runtimes.\n * No network, filesystem, storage, timers or external dependency.\n *\n * An audit's absent observation is NOT a fixed defect. Stable cohort trends\n * contain only pages completed across every supplied version.\n */\nimport { strictObservationTime } from \"./strict-observation-time.js\";\n\nexport const MAX_HISTORICAL_VERSIONS = 10;\nexport const MAX_HISTORICAL_SNAPSHOT_BYTES = 60_000;\nexport const MAX_HISTORICAL_TOTAL_BYTES = 610_000;\nexport const MAX_HISTORICAL_PAGES = 8;\nexport const MAX_HISTORICAL_GROUPS = 50;\nexport const MAX_HISTORICAL_FINDINGS = 12;\n\nexport const HISTORICAL_STATUSES = [\"comparable_sample\", \"partial\", \"not_comparable\"] as const;\nexport type HistoricalStatus = typeof HISTORICAL_STATUSES[number];\nexport const HISTORICAL_FINDING_CODES = [\n \"equal_timestamps\", \"changed_sitemap_fingerprint\", \"changed_sample\",\n \"incomplete_coverage\", \"nonoverlapping_versions\", \"regressed_pages\",\n \"mixed_page_changes\", \"coverage_lost\", \"group_changes_unavailable\",\n \"all_versions_incomplete\", \"historical_sample_only\",\n] as const;\nexport type HistoricalFindingCode = typeof HISTORICAL_FINDING_CODES[number];\n\nexport interface HistoricalPage {\n url: string;\n fetched_url?: string;\n status: \"passed\" | \"needs_attention\" | \"partial\" | \"failed\" | \"skipped\";\n page_fetched: boolean;\n html_validation_status: \"completed\" | \"timeout\" | \"unavailable\" | \"not_run\";\n html_errors: number;\n html_warnings: number;\n seo_errors: number;\n seo_warnings: number;\n schema_errors: number;\n schema_warnings: number;\n health_score?: number;\n redirects_followed?: number;\n}\nexport interface HistoricalIssueGroup {\n category: \"HTML\" | \"SEO\" | \"Schema\" | \"Accessibility\";\n severity: \"error\" | \"warning\" | \"info\";\n code?: string;\n message: string;\n affected_pages: number;\n}\nexport interface HistoricalSnapshot {\n site_url: string;\n discovery: \"sitemap\" | \"root_only\" | \"partial\";\n discovery_error?: string;\n discovery_fingerprint: string;\n pages_selected: number;\n pages_discovered: number;\n pages_partial: number;\n pages_failed: number;\n pages_skipped_robots: number;\n truncated: boolean;\n score_coverage_percent: number;\n pages: HistoricalPage[];\n issue_groups: HistoricalIssueGroup[];\n issue_groups_truncated: boolean;\n}\nexport interface HistoricalVersion {\n saved_at: string;\n snapshot: HistoricalSnapshot;\n}\nexport interface HistoricalPoint {\n version: number;\n sampled_pages: number;\n completed_pages: number;\n sample_limited: boolean;\n cohort_completed_pages: number;\n cohort_errors: number | null;\n cohort_warnings: number | null;\n cohort_mean_health_score: number | null;\n}\nexport interface HistoricalStep {\n baseline_version: number;\n current_version: number;\n status: HistoricalStatus;\n shared_pages: number;\n completely_checked_pairs: number;\n regressed_pages: number;\n improved_pages: number;\n mixed_pages: number;\n unchanged_pages: number;\n coverage_lost_pages: number;\n coverage_recovered_pages: number;\n unverified_pages: number;\n errors_delta_checked: number;\n warnings_delta_checked: number;\n changed_sample: boolean;\n sitemap_changed: boolean;\n issue_group_comparison_available: boolean;\n newly_observed_groups: number | null;\n no_longer_observed_groups: number | null;\n expanding_groups: number | null;\n shrinking_groups: number | null;\n}\nexport interface HistoricalFinding {\n version: number;\n code: HistoricalFindingCode;\n severity: \"warning\" | \"info\";\n message: string;\n}\nexport interface HistoricalReview {\n scope: \"historical_compact_audit_versions_only\";\n source: \"local_saved_ids\" | \"caller_supplied_snapshots\";\n status: HistoricalStatus;\n versions_compared: number;\n comparisons_made: number;\n comparable_transitions: number;\n partial_transitions: number;\n not_comparable_transitions: number;\n stable_cohort_pages: number;\n complete_stable_cohort_pages: number;\n cohort_metrics_available: boolean;\n time_order_ambiguous: boolean;\n total_regressed_page_transitions: number;\n total_improved_page_transitions: number;\n total_coverage_lost_transitions: number;\n historical_points: HistoricalPoint[];\n consecutive_changes: HistoricalStep[];\n first_last_change: HistoricalStep | null;\n coverage_limited: true;\n limitations: string[];\n total_findings: number;\n findings: HistoricalFinding[];\n findings_truncated: boolean;\n error?: string;\n}\n\nconst encoder = new TextEncoder();\nconst int = (value: unknown, max = 1_000_000): value is number =>\n typeof value === \"number\" && Number.isSafeInteger(value) && value >= 0 && value <= max;\n\nexport function emptyHistoricalReview(\n source: HistoricalReview[\"source\"],\n): HistoricalReview {\n return {\n scope: \"historical_compact_audit_versions_only\",\n source, status: \"not_comparable\", versions_compared: 0,\n comparisons_made: 0, comparable_transitions: 0, partial_transitions: 0,\n not_comparable_transitions: 0, stable_cohort_pages: 0,\n complete_stable_cohort_pages: 0, cohort_metrics_available: false,\n time_order_ambiguous: false, total_regressed_page_transitions: 0,\n total_improved_page_transitions: 0, total_coverage_lost_transitions: 0,\n historical_points: [], consecutive_changes: [], first_last_change: null,\n coverage_limited: true,\n limitations: [\n \"The supplied historical audit versions could not be compared within evidence and chronology limits.\",\n ],\n total_findings: 0, findings: [], findings_truncated: false,\n };\n}\n\nfunction safeUrl(value: unknown): string {\n if (typeof value !== \"string\" || value.length > 2_048 ||\n /[\\\\\\u0000-\\u001f\\u007f-\\u009f]/u.test(value)) {\n throw new Error(\"Invalid saved historical URL label\");\n }\n const result = new URL(value);\n if (![\"http:\", \"https:\"].includes(result.protocol) || !result.hostname ||\n result.username || result.password || result.port || result.search || result.hash) {\n throw new Error(\"Unsafe saved historical URL label\");\n }\n return result.href;\n}\nfunction checkDate(value: unknown): number {\n const parsed = strictObservationTime(value);\n if (parsed === undefined) throw new Error(\"History requires a real calendar date and ISO timestamp with UTC offset\");\n return parsed;\n}\nfunction complete(page: HistoricalPage): boolean {\n return page.page_fetched && page.html_validation_status === \"completed\"\n && (page.status === \"passed\" || page.status === \"needs_attention\")\n && typeof page.health_score === \"number\";\n}\nfunction errorTotal(page: HistoricalPage): number {\n return page.html_errors + page.seo_errors + page.schema_errors;\n}\nfunction warningTotal(page: HistoricalPage): number {\n return page.html_warnings + page.seo_warnings + page.schema_warnings;\n}\nfunction groupKey(group: HistoricalIssueGroup): string {\n return JSON.stringify([group.category, group.severity,\n group.code ? \"code\" : \"message\", group.code ?? group.message]);\n}\ninterface PreparedVersion {\n snapshot: HistoricalSnapshot;\n pages: Map<string, HistoricalPage>;\n completed: Set<string>;\n groups: Map<string, HistoricalIssueGroup>;\n duplicateGroups: boolean;\n sampleLimited: boolean;\n}\nfunction prepare(snapshot: HistoricalSnapshot): PreparedVersion {\n if (!snapshot || typeof snapshot !== \"object\"\n || !Array.isArray(snapshot.pages) || snapshot.pages.length > MAX_HISTORICAL_PAGES\n || !Array.isArray(snapshot.issue_groups) || snapshot.issue_groups.length > MAX_HISTORICAL_GROUPS\n || !int(snapshot.pages_selected) || !int(snapshot.pages_discovered)\n || !int(snapshot.pages_partial) || !int(snapshot.pages_failed)\n || !int(snapshot.pages_skipped_robots)\n || !int(snapshot.score_coverage_percent, 100)\n || typeof snapshot.truncated !== \"boolean\"\n || typeof snapshot.issue_groups_truncated !== \"boolean\"\n || !/^[a-f0-9]{64}$/u.test(snapshot.discovery_fingerprint)) {\n throw new Error(\"Invalid or oversized historical snapshot structure\");\n }\n if (![\"sitemap\", \"root_only\", \"partial\"].includes(snapshot.discovery)) {\n throw new Error(\"Unsupported historical discovery state\");\n }\n const origin = new URL(safeUrl(snapshot.site_url)).origin;\n const pages = new Map<string, HistoricalPage>();\n const completed = new Set<string>();\n for (const page of snapshot.pages) {\n if (!page || typeof page !== \"object\" || !page.url ||\n ![\"passed\", \"needs_attention\", \"partial\", \"failed\", \"skipped\"].includes(page.status) ||\n ![\"completed\", \"timeout\", \"unavailable\", \"not_run\"].includes(page.html_validation_status) ||\n typeof page.page_fetched !== \"boolean\" ||\n ![page.html_errors, page.html_warnings, page.seo_errors, page.seo_warnings,\n page.schema_errors, page.schema_warnings].every((value) => int(value)) ||\n (page.health_score !== undefined && (!Number.isInteger(page.health_score) ||\n page.health_score < 0 || page.health_score > 100)) ||\n (page.redirects_followed !== undefined && !int(page.redirects_followed, 3))) {\n throw new Error(\"Invalid bounded page evidence\");\n }\n const url = safeUrl(page.url);\n if (new URL(url).origin !== origin || pages.has(url)) {\n throw new Error(\"Duplicate or cross-origin historical page labels\");\n }\n if (page.fetched_url !== undefined) safeUrl(page.fetched_url);\n pages.set(url, page);\n if (complete(page)) completed.add(url);\n }\n const groups = new Map<string, HistoricalIssueGroup>();\n for (const group of snapshot.issue_groups) {\n if (!group || typeof group !== \"object\" ||\n ![\"HTML\", \"SEO\", \"Schema\", \"Accessibility\"].includes(group.category) ||\n ![\"error\", \"warning\", \"info\"].includes(group.severity) ||\n typeof group.message !== \"string\" || group.message.length > 300 ||\n (group.code !== undefined && (typeof group.code !== \"string\" || group.code.length > 120)) ||\n !int(group.affected_pages) || group.affected_pages > snapshot.pages.length) {\n throw new Error(\"Invalid bounded historical issue-group evidence\");\n }\n groups.set(groupKey(group), group);\n }\n return {\n snapshot, pages, completed, groups,\n duplicateGroups: groups.size !== snapshot.issue_groups.length,\n sampleLimited: snapshot.truncated || snapshot.pages_selected !== pages.size ||\n snapshot.pages_partial > 0 || snapshot.pages_failed > 0 ||\n snapshot.pages_skipped_robots > 0 || snapshot.discovery !== \"sitemap\" ||\n Boolean(snapshot.discovery_error) || snapshot.issue_groups_truncated ||\n completed.size !== pages.size,\n };\n}\n\nfunction comparePrepared(a: PreparedVersion, b: PreparedVersion, from: number, to: number): HistoricalStep {\n const shared = [...a.pages.keys()].filter((key) => b.pages.has(key));\n const changedSample = a.pages.size !== b.pages.size ||\n shared.length !== a.pages.size || shared.length !== b.pages.size;\n const sitemapChanged = a.snapshot.discovery_fingerprint !== b.snapshot.discovery_fingerprint;\n let checked = 0, regressed = 0, improved = 0, mixed = 0, unchanged = 0;\n let lost = 0, recovered = 0, unverified = 0;\n let errorsDelta = 0, warningsDelta = 0;\n for (const key of shared) {\n const before = a.pages.get(key)!;\n const after = b.pages.get(key)!;\n const oldDone = a.completed.has(key);\n const newDone = b.completed.has(key);\n if (oldDone && newDone) {\n checked++;\n const e = errorTotal(after) - errorTotal(before);\n const w = warningTotal(after) - warningTotal(before);\n errorsDelta += e;\n warningsDelta += w;\n const worse = e > 0 || w > 0;\n const better = e < 0 || w < 0;\n if (worse && better) mixed++;\n else if (worse) regressed++;\n else if (better) improved++;\n else unchanged++;\n } else if (oldDone && !newDone) lost++;\n else if (!oldDone && newDone) recovered++;\n else unverified++;\n }\n const sampleAligned = !changedSample && !sitemapChanged &&\n !a.sampleLimited && !b.sampleLimited &&\n checked === shared.length;\n const groupComparable = !changedSample && !sitemapChanged &&\n a.snapshot.pages_selected === a.pages.size &&\n b.snapshot.pages_selected === b.pages.size &&\n !a.snapshot.issue_groups_truncated &&\n !b.snapshot.issue_groups_truncated &&\n !a.duplicateGroups && !b.duplicateGroups &&\n checked === shared.length && shared.length > 0;\n let newGroups: number | null = null;\n let goneGroups: number | null = null;\n let expanding: number | null = null;\n let shrinking: number | null = null;\n if (groupComparable) {\n newGroups = [...b.groups.keys()].filter((key) => !a.groups.has(key)).length;\n goneGroups = [...a.groups.keys()].filter((key) => !b.groups.has(key)).length;\n expanding = [...b.groups].filter(([key, group]) =>\n a.groups.has(key) && group.affected_pages > a.groups.get(key)!.affected_pages).length;\n shrinking = [...b.groups].filter(([key, group]) =>\n a.groups.has(key) && group.affected_pages < a.groups.get(key)!.affected_pages).length;\n }\n return {\n baseline_version: from, current_version: to,\n status: shared.length === 0 ? \"not_comparable\" :\n sampleAligned ? \"comparable_sample\" : \"partial\",\n shared_pages: shared.length, completely_checked_pairs: checked,\n regressed_pages: regressed, improved_pages: improved,\n mixed_pages: mixed, unchanged_pages: unchanged,\n coverage_lost_pages: lost, coverage_recovered_pages: recovered,\n unverified_pages: unverified,\n errors_delta_checked: errorsDelta, warnings_delta_checked: warningsDelta,\n changed_sample: changedSample, sitemap_changed: sitemapChanged,\n issue_group_comparison_available: groupComparable,\n newly_observed_groups: newGroups, no_longer_observed_groups: goneGroups,\n expanding_groups: expanding, shrinking_groups: shrinking,\n };\n}\n\n/** All caller input is assumed untrusted and is validated, even for local saved versions. */\nexport function analyzeHistoricalAudits(\n versions: HistoricalVersion[], source: HistoricalReview[\"source\"],\n): HistoricalReview {\n if (![\"local_saved_ids\", \"caller_supplied_snapshots\"].includes(source) ||\n !Array.isArray(versions) || versions.length < 2 ||\n versions.length > MAX_HISTORICAL_VERSIONS) {\n throw new Error(\"Require between two and ten historical audit versions\");\n }\n let totalBytes = 0;\n let prevTime = Number.NEGATIVE_INFINITY;\n let equalTime = false;\n const prepared: PreparedVersion[] = [];\n let origin: string | undefined;\n for (const version of versions) {\n if (!version || typeof version !== \"object\" || !version.snapshot) {\n throw new Error(\"Invalid historical version\");\n }\n const time = checkDate(version.saved_at);\n if (time < prevTime) throw new Error(\"Historical versions must be ordered oldest to newest\");\n if (time === prevTime) equalTime = true;\n prevTime = time;\n const bytes = encoder.encode(JSON.stringify(version.snapshot)).byteLength;\n if (bytes > MAX_HISTORICAL_SNAPSHOT_BYTES) {\n throw new Error(\"Historical snapshot exceeds 60 KB\");\n }\n totalBytes += bytes;\n if (totalBytes > MAX_HISTORICAL_TOTAL_BYTES) {\n throw new Error(\"Total historical evidence exceeds 610 KB\");\n }\n const siteOrigin = new URL(safeUrl(version.snapshot.site_url)).origin;\n if (origin !== undefined && siteOrigin !== origin) {\n throw new Error(\"Historical versions must share one site origin\");\n }\n origin = siteOrigin;\n prepared.push(prepare(version.snapshot));\n }\n const result = emptyHistoricalReview(source);\n result.versions_compared = prepared.length;\n result.comparisons_made = prepared.length - 1;\n result.time_order_ambiguous = equalTime;\n result.limitations = [\n \"Comparison uses only saved or caller-supplied compact audit evidence; no new HTTP requests, stored-history mutation, crawling, indexing, ranking or causal analysis is performed.\",\n \"Errors and warnings are compared only for matching pages with complete checks in both snapshots; unknown or failed checks are coverage changes, never demonstrated fixes.\",\n \"Cross-version cohort trends cover only exact URLs fully checked in every supplied version; changes in sitemap sampling or discovery fingerprint limit conclusions to comparable sampled pages.\",\n \"Issue-group appearance/disappearance is counted only with identical fully checked selected pages and matching discovery fingerprints. Even then, changes are sampled evidence, not site-wide resolution.\",\n ];\n let stable = new Set(prepared[0].pages.keys());\n let completeStable = new Set(prepared[0].completed);\n for (const v of prepared.slice(1)) {\n stable = new Set([...stable].filter((key) => v.pages.has(key)));\n completeStable = new Set([...completeStable].filter((key) => v.completed.has(key)));\n }\n result.stable_cohort_pages = stable.size;\n result.complete_stable_cohort_pages = completeStable.size;\n result.cohort_metrics_available = completeStable.size > 0;\n prepared.forEach((v, i) => {\n const stablePages = [...completeStable].map((key) => v.pages.get(key)!);\n const n = stablePages.length;\n result.historical_points.push({\n version: i + 1, sampled_pages: v.pages.size,\n completed_pages: v.completed.size,\n sample_limited: v.sampleLimited,\n cohort_completed_pages: n,\n cohort_errors: n ? stablePages.reduce((acc, page) => acc + errorTotal(page), 0) : null,\n cohort_warnings: n ? stablePages.reduce((acc, page) => acc + warningTotal(page), 0) : null,\n cohort_mean_health_score: n ? Math.round(\n 100 * stablePages.reduce((acc, page) => acc + page.health_score!, 0) / n,\n ) / 100 : null,\n });\n });\n const findings: HistoricalFinding[] = [];\n const add = (version: number, code: HistoricalFindingCode,\n severity: \"warning\" | \"info\", message: string) => findings.push({\n version, code, severity, message,\n });\n if (equalTime) add(1, \"equal_timestamps\", \"info\",\n \"Two or more source versions have equal timestamps; preserve saved ordering, but their exact time order cannot be independently established.\");\n for (let i = 1; i < prepared.length; i++) {\n const step = comparePrepared(prepared[i - 1], prepared[i], i, i + 1);\n result.consecutive_changes.push(step);\n if (step.status === \"comparable_sample\") result.comparable_transitions++;\n else if (step.status === \"partial\") result.partial_transitions++;\n else result.not_comparable_transitions++;\n result.total_regressed_page_transitions += step.regressed_pages;\n result.total_improved_page_transitions += step.improved_pages;\n result.total_coverage_lost_transitions += step.coverage_lost_pages;\n if (step.status === \"not_comparable\") {\n add(i + 1, \"nonoverlapping_versions\", \"warning\",\n \"Consecutive versions share no exact audited page labels; a regression or improvement cannot be established.\");\n }\n if (step.changed_sample) add(i + 1, \"changed_sample\", \"info\",\n \"The selected page sample changed; absent pages are not proven repaired or broken.\");\n if (step.sitemap_changed) add(i + 1, \"changed_sitemap_fingerprint\", \"info\",\n \"Discovery fingerprints changed; historical issue and coverage trends may reflect different selections.\");\n if (step.status === \"partial\") add(i + 1, \"incomplete_coverage\", \"info\",\n \"An incomplete check, discovery constraint or differing sample limits this version-pair comparison.\");\n if (step.regressed_pages) add(i + 1, \"regressed_pages\", \"warning\",\n \"At least one matched, fully checked page has more observed errors or warnings than in the prior version.\");\n if (step.mixed_pages) add(i + 1, \"mixed_page_changes\", \"info\",\n \"Some matched pages show opposing error and warning changes; they are not simple improvements.\");\n if (step.coverage_lost_pages) add(i + 1, \"coverage_lost\", \"warning\",\n \"A previously completed page lacked a comparable completed check in the later version; this is not a demonstrated defect regression.\");\n if (!step.issue_group_comparison_available) add(i + 1, \"group_changes_unavailable\", \"info\",\n \"Issue-group appearance and disappearance cannot be safely compared for this version pair.\");\n }\n result.first_last_change = comparePrepared(prepared[0], prepared.at(-1)!, 1, prepared.length);\n result.status = result.not_comparable_transitions === result.comparisons_made\n ? \"not_comparable\" : result.partial_transitions || result.not_comparable_transitions ||\n equalTime || !result.cohort_metrics_available ? \"partial\" : \"comparable_sample\";\n if (!result.cohort_metrics_available) add(1, \"all_versions_incomplete\", \"warning\",\n \"No page was completely audited in every supplied version; longitudinal error and warning trends are unavailable.\");\n add(1, \"historical_sample_only\", \"info\",\n \"Historical changes describe only the exact selected audit samples, never full-site health or Google Search outcomes.\");\n findings.sort((a, b) => (a.severity === b.severity ? 0 : a.severity === \"warning\" ? -1 : 1) ||\n a.version - b.version || a.code.localeCompare(b.code));\n result.total_findings = findings.length;\n result.findings = findings.slice(0, MAX_HISTORICAL_FINDINGS);\n result.findings_truncated = findings.length > MAX_HISTORICAL_FINDINGS;\n return result;\n}\n"]}
@@ -1,3 +1,5 @@
1
+ // Copyright (c) 2026 AKzar1el and Web Validator contributors
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * V10: offline production HTML baseline comparison.
3
5
  * Reuses V07's audited structural parser; never fetches, renders, stores or
@@ -1 +1 @@
1
- {"version":3,"file":"production-change-comparison.js","sourceRoot":"","sources":["../../../src/modules/change-regression/production-change-comparison.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAC7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAC9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACtC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,qBAAqB,EAAE,SAAS,EAAE,gBAAgB,CAAU,CAAC;AAC7F,MAA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a;QAAE,GAAG,CAAC,eAAe,EAAE,MAAM,EACzE,kDAAkD,CAAC,CAAC;IACtD,IAAI,MAAM,CAAC,qBAAqB;QAAE,GAAG,CAAC,gBAAgB,EAAE,MAAM,EAC5D,kFAAkF,CAAC,CAAC;IACtF,IAAI,MAAM,CAAC,wBAAwB,IAAI,MAAM,CAAC,6BAA6B,KAAK,KAAK;QACjF,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,MAAM,CAAC,mBAAmB,IAAI,CAAC,MAAM,CAAC,UAAU;QAC1E,CAAC,MAAM,CAAC,iBAAiB,IAAI,CAAC,MAAM,CAAC,cAAc;QACnD,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAClF,GAAG,CAAC,mBAAmB,EAAE,MAAM,EAC7B,2FAA2F,CAAC,CAAC;IACjG,CAAC;IACD,MAAM,CAAC,kBAAkB,GAAG,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC3E,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * V10: offline production HTML baseline comparison.\n * Reuses V07's audited structural parser; never fetches, renders, stores or\n * returns input text, metadata values or URLs.\n */\nimport { load } from \"cheerio\";\nimport { analyzeRawRendered } from \"../browser-ux/raw-rendered-diff.js\";\nimport { safeMetadataLabel } from \"../content-schema/metadata-consistency.js\";\nimport { strictObservationTime } from \"./strict-observation-time.js\";\n\nexport const MAX_CHANGE_HTML_BYTES = 180_000;\nexport const MAX_CHANGE_TOTAL_BYTES = 360_000;\nexport const MAX_CHANGE_FINDINGS = 14;\nexport const CHANGE_STATUSES = [\"comparable_snapshot\", \"partial\", \"not_comparable\"] as const;\nexport const CHANGE_FINDING_CODES = [\n \"status_changed\", \"delivery_not_comparable\", \"delivery_unverified\",\n \"time_ambiguous\", \"extraction_limited\", \"noindex_added\", \"noindex_removed\",\n \"canonical_changed\", \"title_changed\", \"description_changed\", \"h1_changed\",\n \"robots_changed\", \"main_content_changed\", \"links_changed\", \"jsonld_changed\",\n \"html_only_changed\",\n] as const;\n\ntype FindingCode = typeof CHANGE_FINDING_CODES[number];\ntype ReviewStatus = typeof CHANGE_STATUSES[number];\nexport interface ChangeVersion {\n observed_at: string;\n html: string;\n http_status?: number;\n}\nexport interface ProductionChangeInput {\n page_url: string;\n baseline: ChangeVersion;\n current: ChangeVersion;\n}\nexport interface PageFingerprint {\n http_status: number | null;\n html_bytes: number;\n html_sha256: string | null;\n main_text_sha256: string | null;\n main_words: number | null;\n same_origin_link_targets: number | null;\n title_present: boolean | null;\n description_present: boolean | null;\n h1_count: number | null;\n canonical_state: \"missing\" | \"self\" | \"different\" | \"ambiguous\" | null;\n noindex_declared: boolean | null;\n jsonld_blocks: number | null;\n sample_truncated: boolean;\n}\nexport interface ChangeFinding {\n code: FindingCode;\n severity: \"warning\" | \"info\";\n message: string;\n}\nexport interface ProductionChangeReview {\n scope: \"two_caller_supplied_html_observations\";\n status: ReviewStatus;\n time_order_ambiguous: boolean;\n baseline: PageFingerprint;\n current: PageFingerprint;\n http_status_changed: boolean | null;\n html_fingerprint_changed: boolean | null;\n main_text_fingerprint_changed: boolean | null;\n title_changed: boolean | null;\n description_changed: boolean | null;\n h1_changed: boolean | null;\n canonical_changed: boolean | null;\n robots_changed: boolean | null;\n noindex_added: boolean | null;\n noindex_removed: boolean | null;\n main_words_added: number | null;\n main_words_removed: number | null;\n links_added: number | null;\n links_removed: number | null;\n jsonld_blocks_changed: boolean | null;\n coverage_limited: true;\n limitations: string[];\n total_findings: number;\n findings: ChangeFinding[];\n findings_truncated: boolean;\n error?: string;\n}\nconst limitations = [\n \"Only two explicitly supplied HTML observations are compared; timestamps and HTTP statuses are caller claims, not independently verified production events.\",\n \"No live fetches, deployments, browser execution, history writes, search-console evidence, ranking or traffic-causality conclusions.\",\n \"Hashes describe supplied exact HTML bytes and normalized sampled main text; a fingerprint difference is not proof of deployment causality or indexing impact.\",\n \"Content, links, metadata values, timestamps and page URLs are redacted. Static HTML cannot establish CSS/JS-rendered visibility or full-site coverage.\",\n];\nfunction blank(): PageFingerprint {\n return {\n http_status: null, html_bytes: 0, html_sha256: null,\n main_text_sha256: null, main_words: null,\n same_origin_link_targets: null, title_present: null,\n description_present: null, h1_count: null,\n canonical_state: null, noindex_declared: null,\n jsonld_blocks: null, sample_truncated: false,\n };\n}\nexport function emptyProductionChangeReview(): ProductionChangeReview {\n return {\n scope: \"two_caller_supplied_html_observations\", status: \"not_comparable\",\n time_order_ambiguous: false, baseline: blank(), current: blank(),\n http_status_changed: null, html_fingerprint_changed: null,\n main_text_fingerprint_changed: null, title_changed: null,\n description_changed: null, h1_changed: null, canonical_changed: null,\n robots_changed: null, noindex_added: null, noindex_removed: null,\n main_words_added: null, main_words_removed: null,\n links_added: null, links_removed: null, jsonld_blocks_changed: null,\n coverage_limited: true, limitations, total_findings: 0,\n findings: [], findings_truncated: false,\n };\n}\nconst encoder = new TextEncoder();\nconst byteLength = (value: string): number => encoder.encode(value).byteLength;\nasync function digest(value: string): Promise<string> {\n const bytes = new Uint8Array(await crypto.subtle.digest(\"SHA-256\", encoder.encode(value)));\n return Array.from(bytes, (item) => item.toString(16).padStart(2, \"0\")).join(\"\");\n}\nfunction timeValue(value: string): number {\n const parsed = strictObservationTime(value);\n if (parsed === undefined) throw new Error(\"Invalid offset-aware ISO observation time or calendar date\");\n return parsed;\n}\nfunction validateVersion(value: ChangeVersion): void {\n if (!value || typeof value.html !== \"string\" ||\n byteLength(value.html) > MAX_CHANGE_HTML_BYTES ||\n (value.http_status !== undefined &&\n (!Number.isInteger(value.http_status) || value.http_status < 200 || value.http_status > 599)) ||\n (value.http_status === 200 && !value.html.trim())) {\n throw new Error(\"Invalid bounded production HTML observation\");\n }\n}\nfunction normalized(value: string): string {\n return value.normalize(\"NFKC\").replace(/\\s+/gu, \" \").trim();\n}\nfunction extractExtra(html: string) {\n const $ = load(html);\n const head = $(\"head\");\n const desc = normalized(head.find('meta[name=\"description\" i]').first().attr(\"content\") ?? \"\");\n const robots = head.find(\"meta[name][content]\").toArray()\n .filter((el) => [\"robots\", \"googlebot\"].includes(($(el).attr(\"name\") ?? \"\").toLowerCase()))\n .flatMap((el) => ($(el).attr(\"content\") ?? \"\").toLowerCase().split(/[\\s,;]+/u))\n .filter(Boolean).sort().join(\",\");\n const main = $(\"main,[role='main'],article\").first();\n const content = (main.length ? main.clone() : $(\"body\").first().clone());\n content.find(\"script,style,noscript,template,svg,nav,header,footer,aside\").remove();\n const source = content.text();\n const tooLong = source.length > 100_000;\n return {\n desc, robots,\n normalizedMain: tooLong ? null : normalized(source).toLocaleLowerCase(\"en\"),\n tooLong,\n };\n}\nexport async function analyzeProductionChange(\n input: ProductionChangeInput,\n): Promise<ProductionChangeReview> {\n if (!input || !safeMetadataLabel(input.page_url) || !input.baseline || !input.current) {\n throw new Error(\"Expected one safe query-free page URL and two observations\");\n }\n validateVersion(input.baseline);\n validateVersion(input.current);\n if (byteLength(input.baseline.html) + byteLength(input.current.html) > MAX_CHANGE_TOTAL_BYTES) {\n throw new Error(\"Combined observations exceed HTML size limit\");\n }\n const older = timeValue(input.baseline.observed_at);\n const newer = timeValue(input.current.observed_at);\n if (newer < older) throw new Error(\"Observation times must be oldest first\");\n const report = emptyProductionChangeReview();\n report.time_order_ambiguous = newer === older;\n const a = input.baseline, b = input.current;\n report.baseline.http_status = a.http_status ?? null;\n report.current.http_status = b.http_status ?? null;\n report.http_status_changed = a.http_status === undefined || b.http_status === undefined\n ? null : a.http_status !== b.http_status;\n report.baseline.html_bytes = byteLength(a.html);\n report.current.html_bytes = byteLength(b.html);\n report.baseline.html_sha256 = a.html ? await digest(a.html) : null;\n report.current.html_sha256 = b.html ? await digest(b.html) : null;\n report.html_fingerprint_changed = report.baseline.html_sha256 && report.current.html_sha256\n ? report.baseline.html_sha256 !== report.current.html_sha256 : null;\n const add = (code: FindingCode, severity: ChangeFinding[\"severity\"], message: string) => {\n report.total_findings++;\n if (report.findings.length < MAX_CHANGE_FINDINGS) report.findings.push({ code, severity, message });\n };\n if (report.http_status_changed) add(\"status_changed\", \"warning\",\n \"Supplied HTTP status codes differ; check delivery and challenge behavior before interpreting content changes.\");\n if (report.time_order_ambiguous) add(\"time_ambiguous\", \"info\",\n \"Observations share the same claimed instant, so chronological order cannot be independently resolved.\");\n if (a.http_status === undefined || b.http_status === undefined) add(\"delivery_unverified\", \"info\",\n \"A supplied HTTP status is missing; HTML differences cannot verify production availability.\");\n if ((a.http_status !== undefined && a.http_status !== 200) ||\n (b.http_status !== undefined && b.http_status !== 200) || !a.html.trim() || !b.html.trim()) {\n report.status = \"not_comparable\";\n add(\"delivery_not_comparable\", \"warning\",\n \"At least one observation has no confirmed successful HTML delivery; content and metadata changes are suppressed, not counted as repairs.\");\n report.findings_truncated = report.total_findings > report.findings.length;\n return report;\n }\n const core = analyzeRawRendered({\n page_url: input.page_url, raw_html: a.html, rendered_html: b.html,\n });\n const [before, after] = [extractExtra(a.html), extractExtra(b.html)];\n report.baseline.main_words = core.raw.main_words;\n report.current.main_words = core.rendered.main_words;\n report.baseline.same_origin_link_targets = core.raw.same_origin_link_targets;\n report.current.same_origin_link_targets = core.rendered.same_origin_link_targets;\n report.baseline.title_present = core.raw.title_present;\n report.current.title_present = core.rendered.title_present;\n report.baseline.description_present = core.raw.description_present;\n report.current.description_present = core.rendered.description_present;\n report.baseline.h1_count = core.raw.h1_count;\n report.current.h1_count = core.rendered.h1_count;\n report.baseline.canonical_state = core.raw.canonicals;\n report.current.canonical_state = core.rendered.canonicals;\n report.baseline.noindex_declared = core.raw.noindex_declared;\n report.current.noindex_declared = core.rendered.noindex_declared;\n report.baseline.jsonld_blocks = core.raw.jsonld_blocks;\n report.current.jsonld_blocks = core.rendered.jsonld_blocks;\n report.baseline.sample_truncated = core.raw.sample_truncated || before.tooLong;\n report.current.sample_truncated = core.rendered.sample_truncated || after.tooLong;\n report.baseline.main_text_sha256 = before.normalizedMain === null ? null : await digest(before.normalizedMain);\n report.current.main_text_sha256 = after.normalizedMain === null ? null : await digest(after.normalizedMain);\n report.main_text_fingerprint_changed =\n report.baseline.main_text_sha256 && report.current.main_text_sha256\n ? report.baseline.main_text_sha256 !== report.current.main_text_sha256 : null;\n report.title_changed = core.title_changed;\n report.description_changed = before.desc !== after.desc;\n report.h1_changed = core.h1_changed;\n report.canonical_changed = core.canonical_changed;\n report.robots_changed = before.robots !== after.robots;\n report.noindex_added = !core.raw.noindex_declared && core.rendered.noindex_declared;\n report.noindex_removed = core.raw.noindex_declared && !core.rendered.noindex_declared;\n // V07 exposes a bounded vocabulary and link sample; do not present an\n // incomplete sample as an exact before/after removal count.\n const sampleIncomplete = report.baseline.sample_truncated || report.current.sample_truncated;\n report.main_words_added = sampleIncomplete ? null : core.main_words_added;\n report.main_words_removed = sampleIncomplete ? null : core.main_words_removed;\n report.links_added = sampleIncomplete ? null : core.link_targets_added;\n report.links_removed = sampleIncomplete ? null : core.link_targets_removed;\n report.jsonld_blocks_changed = core.raw.jsonld_blocks !== core.rendered.jsonld_blocks;\n const limited = sampleIncomplete;\n report.status = report.time_order_ambiguous || limited ||\n a.http_status === undefined || b.http_status === undefined ? \"partial\" : \"comparable_snapshot\";\n if (limited) add(\"extraction_limited\", \"warning\",\n \"Main text or link sampling was truncated; absence and count differences are incomplete evidence.\");\n if (report.noindex_added) add(\"noindex_added\", \"warning\",\n \"A noindex directive appears in the later supplied HTML.\");\n if (report.noindex_removed) add(\"noindex_removed\", \"info\",\n \"A noindex directive is absent in the later supplied HTML; search-engine indexing remains unverified.\");\n if (report.canonical_changed) add(\"canonical_changed\", \"warning\",\n \"Canonical declaration differs between observations; selection by search engines is not verified.\");\n if (report.title_changed) add(\"title_changed\", \"info\", \"The supplied page title changed.\");\n if (report.description_changed) add(\"description_changed\", \"info\",\n \"The supplied meta description changed.\");\n if (report.h1_changed) add(\"h1_changed\", \"info\",\n \"The supplied first H1 heading changed.\");\n if (report.robots_changed) add(\"robots_changed\", \"warning\",\n \"The supplied robots or Googlebot meta directives changed.\");\n if (report.main_text_fingerprint_changed) add(\"main_content_changed\", \"info\",\n \"Normalized sampled main content changed; inspect authorized source versions for significance.\");\n if (report.links_added || report.links_removed) add(\"links_changed\", \"info\",\n \"The bounded same-origin link target set changed.\");\n if (report.jsonld_blocks_changed) add(\"jsonld_changed\", \"info\",\n \"The number of JSON-LD script blocks changed; schema validity is not established.\");\n if (report.html_fingerprint_changed && report.main_text_fingerprint_changed === false &&\n !report.title_changed && !report.description_changed && !report.h1_changed &&\n !report.canonical_changed && !report.robots_changed &&\n !report.links_added && !report.links_removed && !report.jsonld_blocks_changed) {\n add(\"html_only_changed\", \"info\",\n \"Exact HTML bytes changed while the selected content and metadata signals remained stable.\");\n }\n report.findings_truncated = report.total_findings > report.findings.length;\n return report;\n}\n"]}
1
+ {"version":3,"file":"production-change-comparison.js","sourceRoot":"","sources":["../../../src/modules/change-regression/production-change-comparison.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,+BAA+B;AAC/B;;;;GAIG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAC7C,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAC9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AACtC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,qBAAqB,EAAE,SAAS,EAAE,gBAAgB,CAAU,CAAC;AAC7F,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,gBAAgB,EAAE,yBAAyB,EAAE,qBAAqB;IAClE,gBAAgB,EAAE,oBAAoB,EAAE,eAA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AAC,gBAAgB,EAAE,MAAM,EAC5D,kFAAkF,CAAC,CAAC;IACtF,IAAI,MAAM,CAAC,wBAAwB,IAAI,MAAM,CAAC,6BAA6B,KAAK,KAAK;QACjF,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,MAAM,CAAC,mBAAmB,IAAI,CAAC,MAAM,CAAC,UAAU;QAC1E,CAAC,MAAM,CAAC,iBAAiB,IAAI,CAAC,MAAM,CAAC,cAAc;QACnD,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAClF,GAAG,CAAC,mBAAmB,EAAE,MAAM,EAC7B,2FAA2F,CAAC,CAAC;IACjG,CAAC;IACD,MAAM,CAAC,kBAAkB,GAAG,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IAC3E,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) 2026 AKzar1el and Web Validator contributors\n// SPDX-License-Identifier: MIT\n/**\n * V10: offline production HTML baseline comparison.\n * Reuses V07's audited structural parser; never fetches, renders, stores or\n * returns input text, metadata values or URLs.\n */\nimport { load } from \"cheerio\";\nimport { analyzeRawRendered } from \"../browser-ux/raw-rendered-diff.js\";\nimport { safeMetadataLabel } from \"../content-schema/metadata-consistency.js\";\nimport { strictObservationTime } from \"./strict-observation-time.js\";\n\nexport const MAX_CHANGE_HTML_BYTES = 180_000;\nexport const MAX_CHANGE_TOTAL_BYTES = 360_000;\nexport const MAX_CHANGE_FINDINGS = 14;\nexport const CHANGE_STATUSES = [\"comparable_snapshot\", \"partial\", \"not_comparable\"] as const;\nexport const CHANGE_FINDING_CODES = [\n \"status_changed\", \"delivery_not_comparable\", \"delivery_unverified\",\n \"time_ambiguous\", \"extraction_limited\", \"noindex_added\", \"noindex_removed\",\n \"canonical_changed\", \"title_changed\", \"description_changed\", \"h1_changed\",\n \"robots_changed\", \"main_content_changed\", \"links_changed\", \"jsonld_changed\",\n \"html_only_changed\",\n] as const;\n\ntype FindingCode = typeof CHANGE_FINDING_CODES[number];\ntype ReviewStatus = typeof CHANGE_STATUSES[number];\nexport interface ChangeVersion {\n observed_at: string;\n html: string;\n http_status?: number;\n}\nexport interface ProductionChangeInput {\n page_url: string;\n baseline: ChangeVersion;\n current: ChangeVersion;\n}\nexport interface PageFingerprint {\n http_status: number | null;\n html_bytes: number;\n html_sha256: string | null;\n main_text_sha256: string | null;\n main_words: number | null;\n same_origin_link_targets: number | null;\n title_present: boolean | null;\n description_present: boolean | null;\n h1_count: number | null;\n canonical_state: \"missing\" | \"self\" | \"different\" | \"ambiguous\" | null;\n noindex_declared: boolean | null;\n jsonld_blocks: number | null;\n sample_truncated: boolean;\n}\nexport interface ChangeFinding {\n code: FindingCode;\n severity: \"warning\" | \"info\";\n message: string;\n}\nexport interface ProductionChangeReview {\n scope: \"two_caller_supplied_html_observations\";\n status: ReviewStatus;\n time_order_ambiguous: boolean;\n baseline: PageFingerprint;\n current: PageFingerprint;\n http_status_changed: boolean | null;\n html_fingerprint_changed: boolean | null;\n main_text_fingerprint_changed: boolean | null;\n title_changed: boolean | null;\n description_changed: boolean | null;\n h1_changed: boolean | null;\n canonical_changed: boolean | null;\n robots_changed: boolean | null;\n noindex_added: boolean | null;\n noindex_removed: boolean | null;\n main_words_added: number | null;\n main_words_removed: number | null;\n links_added: number | null;\n links_removed: number | null;\n jsonld_blocks_changed: boolean | null;\n coverage_limited: true;\n limitations: string[];\n total_findings: number;\n findings: ChangeFinding[];\n findings_truncated: boolean;\n error?: string;\n}\nconst limitations = [\n \"Only two explicitly supplied HTML observations are compared; timestamps and HTTP statuses are caller claims, not independently verified production events.\",\n \"No live fetches, deployments, browser execution, history writes, search-console evidence, ranking or traffic-causality conclusions.\",\n \"Hashes describe supplied exact HTML bytes and normalized sampled main text; a fingerprint difference is not proof of deployment causality or indexing impact.\",\n \"Content, links, metadata values, timestamps and page URLs are redacted. Static HTML cannot establish CSS/JS-rendered visibility or full-site coverage.\",\n];\nfunction blank(): PageFingerprint {\n return {\n http_status: null, html_bytes: 0, html_sha256: null,\n main_text_sha256: null, main_words: null,\n same_origin_link_targets: null, title_present: null,\n description_present: null, h1_count: null,\n canonical_state: null, noindex_declared: null,\n jsonld_blocks: null, sample_truncated: false,\n };\n}\nexport function emptyProductionChangeReview(): ProductionChangeReview {\n return {\n scope: \"two_caller_supplied_html_observations\", status: \"not_comparable\",\n time_order_ambiguous: false, baseline: blank(), current: blank(),\n http_status_changed: null, html_fingerprint_changed: null,\n main_text_fingerprint_changed: null, title_changed: null,\n description_changed: null, h1_changed: null, canonical_changed: null,\n robots_changed: null, noindex_added: null, noindex_removed: null,\n main_words_added: null, main_words_removed: null,\n links_added: null, links_removed: null, jsonld_blocks_changed: null,\n coverage_limited: true, limitations, total_findings: 0,\n findings: [], findings_truncated: false,\n };\n}\nconst encoder = new TextEncoder();\nconst byteLength = (value: string): number => encoder.encode(value).byteLength;\nasync function digest(value: string): Promise<string> {\n const bytes = new Uint8Array(await crypto.subtle.digest(\"SHA-256\", encoder.encode(value)));\n return Array.from(bytes, (item) => item.toString(16).padStart(2, \"0\")).join(\"\");\n}\nfunction timeValue(value: string): number {\n const parsed = strictObservationTime(value);\n if (parsed === undefined) throw new Error(\"Invalid offset-aware ISO observation time or calendar date\");\n return parsed;\n}\nfunction validateVersion(value: ChangeVersion): void {\n if (!value || typeof value.html !== \"string\" ||\n byteLength(value.html) > MAX_CHANGE_HTML_BYTES ||\n (value.http_status !== undefined &&\n (!Number.isInteger(value.http_status) || value.http_status < 200 || value.http_status > 599)) ||\n (value.http_status === 200 && !value.html.trim())) {\n throw new Error(\"Invalid bounded production HTML observation\");\n }\n}\nfunction normalized(value: string): string {\n return value.normalize(\"NFKC\").replace(/\\s+/gu, \" \").trim();\n}\nfunction extractExtra(html: string) {\n const $ = load(html);\n const head = $(\"head\");\n const desc = normalized(head.find('meta[name=\"description\" i]').first().attr(\"content\") ?? \"\");\n const robots = head.find(\"meta[name][content]\").toArray()\n .filter((el) => [\"robots\", \"googlebot\"].includes(($(el).attr(\"name\") ?? \"\").toLowerCase()))\n .flatMap((el) => ($(el).attr(\"content\") ?? \"\").toLowerCase().split(/[\\s,;]+/u))\n .filter(Boolean).sort().join(\",\");\n const main = $(\"main,[role='main'],article\").first();\n const content = (main.length ? main.clone() : $(\"body\").first().clone());\n content.find(\"script,style,noscript,template,svg,nav,header,footer,aside\").remove();\n const source = content.text();\n const tooLong = source.length > 100_000;\n return {\n desc, robots,\n normalizedMain: tooLong ? null : normalized(source).toLocaleLowerCase(\"en\"),\n tooLong,\n };\n}\nexport async function analyzeProductionChange(\n input: ProductionChangeInput,\n): Promise<ProductionChangeReview> {\n if (!input || !safeMetadataLabel(input.page_url) || !input.baseline || !input.current) {\n throw new Error(\"Expected one safe query-free page URL and two observations\");\n }\n validateVersion(input.baseline);\n validateVersion(input.current);\n if (byteLength(input.baseline.html) + byteLength(input.current.html) > MAX_CHANGE_TOTAL_BYTES) {\n throw new Error(\"Combined observations exceed HTML size limit\");\n }\n const older = timeValue(input.baseline.observed_at);\n const newer = timeValue(input.current.observed_at);\n if (newer < older) throw new Error(\"Observation times must be oldest first\");\n const report = emptyProductionChangeReview();\n report.time_order_ambiguous = newer === older;\n const a = input.baseline, b = input.current;\n report.baseline.http_status = a.http_status ?? null;\n report.current.http_status = b.http_status ?? null;\n report.http_status_changed = a.http_status === undefined || b.http_status === undefined\n ? null : a.http_status !== b.http_status;\n report.baseline.html_bytes = byteLength(a.html);\n report.current.html_bytes = byteLength(b.html);\n report.baseline.html_sha256 = a.html ? await digest(a.html) : null;\n report.current.html_sha256 = b.html ? await digest(b.html) : null;\n report.html_fingerprint_changed = report.baseline.html_sha256 && report.current.html_sha256\n ? report.baseline.html_sha256 !== report.current.html_sha256 : null;\n const add = (code: FindingCode, severity: ChangeFinding[\"severity\"], message: string) => {\n report.total_findings++;\n if (report.findings.length < MAX_CHANGE_FINDINGS) report.findings.push({ code, severity, message });\n };\n if (report.http_status_changed) add(\"status_changed\", \"warning\",\n \"Supplied HTTP status codes differ; check delivery and challenge behavior before interpreting content changes.\");\n if (report.time_order_ambiguous) add(\"time_ambiguous\", \"info\",\n \"Observations share the same claimed instant, so chronological order cannot be independently resolved.\");\n if (a.http_status === undefined || b.http_status === undefined) add(\"delivery_unverified\", \"info\",\n \"A supplied HTTP status is missing; HTML differences cannot verify production availability.\");\n if ((a.http_status !== undefined && a.http_status !== 200) ||\n (b.http_status !== undefined && b.http_status !== 200) || !a.html.trim() || !b.html.trim()) {\n report.status = \"not_comparable\";\n add(\"delivery_not_comparable\", \"warning\",\n \"At least one observation has no confirmed successful HTML delivery; content and metadata changes are suppressed, not counted as repairs.\");\n report.findings_truncated = report.total_findings > report.findings.length;\n return report;\n }\n const core = analyzeRawRendered({\n page_url: input.page_url, raw_html: a.html, rendered_html: b.html,\n });\n const [before, after] = [extractExtra(a.html), extractExtra(b.html)];\n report.baseline.main_words = core.raw.main_words;\n report.current.main_words = core.rendered.main_words;\n report.baseline.same_origin_link_targets = core.raw.same_origin_link_targets;\n report.current.same_origin_link_targets = core.rendered.same_origin_link_targets;\n report.baseline.title_present = core.raw.title_present;\n report.current.title_present = core.rendered.title_present;\n report.baseline.description_present = core.raw.description_present;\n report.current.description_present = core.rendered.description_present;\n report.baseline.h1_count = core.raw.h1_count;\n report.current.h1_count = core.rendered.h1_count;\n report.baseline.canonical_state = core.raw.canonicals;\n report.current.canonical_state = core.rendered.canonicals;\n report.baseline.noindex_declared = core.raw.noindex_declared;\n report.current.noindex_declared = core.rendered.noindex_declared;\n report.baseline.jsonld_blocks = core.raw.jsonld_blocks;\n report.current.jsonld_blocks = core.rendered.jsonld_blocks;\n report.baseline.sample_truncated = core.raw.sample_truncated || before.tooLong;\n report.current.sample_truncated = core.rendered.sample_truncated || after.tooLong;\n report.baseline.main_text_sha256 = before.normalizedMain === null ? null : await digest(before.normalizedMain);\n report.current.main_text_sha256 = after.normalizedMain === null ? null : await digest(after.normalizedMain);\n report.main_text_fingerprint_changed =\n report.baseline.main_text_sha256 && report.current.main_text_sha256\n ? report.baseline.main_text_sha256 !== report.current.main_text_sha256 : null;\n report.title_changed = core.title_changed;\n report.description_changed = before.desc !== after.desc;\n report.h1_changed = core.h1_changed;\n report.canonical_changed = core.canonical_changed;\n report.robots_changed = before.robots !== after.robots;\n report.noindex_added = !core.raw.noindex_declared && core.rendered.noindex_declared;\n report.noindex_removed = core.raw.noindex_declared && !core.rendered.noindex_declared;\n // V07 exposes a bounded vocabulary and link sample; do not present an\n // incomplete sample as an exact before/after removal count.\n const sampleIncomplete = report.baseline.sample_truncated || report.current.sample_truncated;\n report.main_words_added = sampleIncomplete ? null : core.main_words_added;\n report.main_words_removed = sampleIncomplete ? null : core.main_words_removed;\n report.links_added = sampleIncomplete ? null : core.link_targets_added;\n report.links_removed = sampleIncomplete ? null : core.link_targets_removed;\n report.jsonld_blocks_changed = core.raw.jsonld_blocks !== core.rendered.jsonld_blocks;\n const limited = sampleIncomplete;\n report.status = report.time_order_ambiguous || limited ||\n a.http_status === undefined || b.http_status === undefined ? \"partial\" : \"comparable_snapshot\";\n if (limited) add(\"extraction_limited\", \"warning\",\n \"Main text or link sampling was truncated; absence and count differences are incomplete evidence.\");\n if (report.noindex_added) add(\"noindex_added\", \"warning\",\n \"A noindex directive appears in the later supplied HTML.\");\n if (report.noindex_removed) add(\"noindex_removed\", \"info\",\n \"A noindex directive is absent in the later supplied HTML; search-engine indexing remains unverified.\");\n if (report.canonical_changed) add(\"canonical_changed\", \"warning\",\n \"Canonical declaration differs between observations; selection by search engines is not verified.\");\n if (report.title_changed) add(\"title_changed\", \"info\", \"The supplied page title changed.\");\n if (report.description_changed) add(\"description_changed\", \"info\",\n \"The supplied meta description changed.\");\n if (report.h1_changed) add(\"h1_changed\", \"info\",\n \"The supplied first H1 heading changed.\");\n if (report.robots_changed) add(\"robots_changed\", \"warning\",\n \"The supplied robots or Googlebot meta directives changed.\");\n if (report.main_text_fingerprint_changed) add(\"main_content_changed\", \"info\",\n \"Normalized sampled main content changed; inspect authorized source versions for significance.\");\n if (report.links_added || report.links_removed) add(\"links_changed\", \"info\",\n \"The bounded same-origin link target set changed.\");\n if (report.jsonld_blocks_changed) add(\"jsonld_changed\", \"info\",\n \"The number of JSON-LD script blocks changed; schema validity is not established.\");\n if (report.html_fingerprint_changed && report.main_text_fingerprint_changed === false &&\n !report.title_changed && !report.description_changed && !report.h1_changed &&\n !report.canonical_changed && !report.robots_changed &&\n !report.links_added && !report.links_removed && !report.jsonld_blocks_changed) {\n add(\"html_only_changed\", \"info\",\n \"Exact HTML bytes changed while the selected content and metadata signals remained stable.\");\n }\n report.findings_truncated = report.total_findings > report.findings.length;\n return report;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"regression-alerts.js","sourceRoot":"","sources":["../../../src/modules/change-regression/regression-alerts.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,iBAAiB,EAAE,oBAAoB,EAAE,sBAAsB;IAC/D,eAAe,EAAE,eAAe;CACxB,CAAC;AAEX,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,mBAAmB,EAAE,aAAa,EAAE,YAAY;IAChD,iBAAiB,EAAE,UAAU;CACrB,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,uBAAuB;CAC/D,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,eAAe,EAAE,mBAAmB,EAAE,eAAe;IACrD,wBAAwB,EAAE,yBAAyB;IACnD,6BAA6B,EAAE,2BAA2B;IAC1D,kCAAkC,EAAE,wBAAwB;IAC5D,iCAAiC;CACzB,CAAC;AAqBX,MAAM,CAAC,MAAM,sBAAsB,GAA4B,MAAM,CAAC,MAAM,CAAC;IAC3E,mBAAmB,EAAE,CAAC;IACtB,sBAAsB,EAAE,CAAC;IACzB,wBAAwB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M,CAAC;IACzF,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QAC5D,MAAM,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;YAC5C,CAAC,cAAc,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,cAAc,CAAC;IAC/D,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * P2-02 manual-only dry-run regression monitoring and optional alert PREVIEWS.\n *\n * The caller obtains a validated historical audit review via P2-01 first.\n * This pure evaluator has no browser/network/storage/scheduler/notification API.\n * A candidate is advice to review a comparable sampled-page observation;\n * it is NEVER delivered or interpreted as a site-wide/Google metric signal.\n */\nimport type { HistoricalReview, HistoricalStep } from \"./historical-comparisons.js\";\n\nexport const MONITOR_RULES = [\n \"regressed_pages\", \"net_error_increase\", \"net_warning_increase\",\n \"coverage_loss\", \"sitemap_drift\",\n] as const;\nexport type MonitorRule = typeof MONITOR_RULES[number];\nexport const MONITOR_DECISIONS = [\n \"preview_candidate\", \"review_only\", \"suppressed\",\n \"below_threshold\", \"disabled\",\n] as const;\nexport type MonitorDecision = typeof MONITOR_DECISIONS[number];\nexport const MONITOR_STATUSES = [\n \"preview_ready\", \"review_only\", \"no_candidate\", \"insufficient_evidence\",\n] as const;\nexport type MonitorStatus = typeof MONITOR_STATUSES[number];\nexport const MONITOR_REASON_CODES = [\n \"threshold_met\", \"threshold_not_met\", \"rule_disabled\",\n \"incomplete_latest_pair\", \"ambiguous_version_order\",\n \"insufficient_streak_history\", \"regression_streak_not_met\",\n \"observed_validator_coverage_loss\", \"observed_sitemap_drift\",\n \"not_enough_observed_comparisons\",\n] as const;\nexport type MonitorReasonCode = typeof MONITOR_REASON_CODES[number];\n\nexport interface MonitorPolicyInput {\n min_regressed_pages?: number;\n min_net_error_increase?: number;\n min_net_warning_increase?: number;\n min_coverage_lost_pages?: number;\n consecutive_regressing_steps?: number;\n review_coverage_loss?: boolean;\n review_sitemap_drift?: boolean;\n}\nexport interface MonitorPolicy {\n min_regressed_pages: number;\n min_net_error_increase: number;\n min_net_warning_increase: number;\n min_coverage_lost_pages: number;\n consecutive_regressing_steps: number;\n review_coverage_loss: boolean;\n review_sitemap_drift: boolean;\n}\nexport const DEFAULT_MONITOR_POLICY: Readonly<MonitorPolicy> = Object.freeze({\n min_regressed_pages: 1,\n min_net_error_increase: 1,\n min_net_warning_increase: 1,\n min_coverage_lost_pages: 1,\n consecutive_regressing_steps: 1,\n review_coverage_loss: true,\n review_sitemap_drift: true,\n});\n\nexport interface MonitorRuleResult {\n rule: MonitorRule;\n decision: MonitorDecision;\n reason_code: MonitorReasonCode;\n latest_observed_value: number;\n threshold: number;\n review_required: boolean;\n message: string;\n}\nexport interface MonitorPreview {\n scope: \"manual_sampled_regression_alert_preview_only\";\n source: \"local_saved_ids\" | \"caller_supplied_snapshots\";\n status: MonitorStatus;\n dry_run: true;\n manually_invoked: true;\n scheduler_enabled: false;\n delivery_enabled: false;\n notifications_sent: 0;\n external_integrations_used: false;\n latest_baseline_version: number;\n latest_current_version: number;\n latest_comparability: \"comparable_sample\" | \"partial\" | \"not_comparable\";\n latest_compared_pages: number;\n latest_completed_pairs: number;\n candidate_count: number;\n review_only_count: number;\n suppressed_count: number;\n coverage_limited: true;\n policy: MonitorPolicy;\n rules: MonitorRuleResult[];\n limitations: string[];\n error?: string;\n}\n\nfunction intRange(value: unknown, min: number, max: number): boolean {\n return typeof value === \"number\" && Number.isSafeInteger(value) && value >= min && value <= max;\n}\n\n/** Enforce a small, explicit policy with no arbitrary scripts, URLs or destinations. */\nexport function normalizeMonitorPolicy(input?: MonitorPolicyInput): MonitorPolicy {\n if (input !== undefined && (input === null || typeof input !== \"object\" ||\n Array.isArray(input))) {\n throw new Error(\"Monitoring policy must be a bounded object\");\n }\n const provided = input ?? {};\n const allowed: ReadonlySet<string> = new Set(Object.keys(DEFAULT_MONITOR_POLICY));\n if (Object.keys(provided).some((key) => !allowed.has(key))) {\n throw new Error(\"Monitoring policy contains unsupported options\");\n }\n const merged: MonitorPolicy = { ...DEFAULT_MONITOR_POLICY, ...provided };\n if (!intRange(merged.min_regressed_pages, 1, 8) ||\n !intRange(merged.min_net_error_increase, 1, 10_000) ||\n !intRange(merged.min_net_warning_increase, 1, 10_000) ||\n !intRange(merged.min_coverage_lost_pages, 1, 8) ||\n !intRange(merged.consecutive_regressing_steps, 1, 4) ||\n typeof merged.review_coverage_loss !== \"boolean\" ||\n typeof merged.review_sitemap_drift !== \"boolean\") {\n throw new Error(\"Monitoring thresholds or review toggles out of allowed range\");\n }\n return merged;\n}\n\nexport function emptyMonitorPreview(\n source: MonitorPreview[\"source\"],\n policy: MonitorPolicy = { ...DEFAULT_MONITOR_POLICY },\n): MonitorPreview {\n return {\n scope: \"manual_sampled_regression_alert_preview_only\",\n source, status: \"insufficient_evidence\",\n dry_run: true, manually_invoked: true,\n scheduler_enabled: false, delivery_enabled: false,\n notifications_sent: 0, external_integrations_used: false,\n latest_baseline_version: 0, latest_current_version: 0,\n latest_comparability: \"not_comparable\",\n latest_compared_pages: 0, latest_completed_pairs: 0,\n candidate_count: 0, review_only_count: 0, suppressed_count: 0,\n coverage_limited: true, policy, rules: [],\n limitations: [\"No alerts or schedules were started; bounded historical source evidence was not sufficient for a monitoring preview.\"],\n };\n}\n\nfunction validateHistoricalReview(review: HistoricalReview): HistoricalStep {\n if (!review || review.scope !== \"historical_compact_audit_versions_only\" ||\n ![\"local_saved_ids\", \"caller_supplied_snapshots\"].includes(review.source) ||\n !Number.isSafeInteger(review.versions_compared) ||\n review.versions_compared < 2 || review.versions_compared > 10 ||\n !Array.isArray(review.consecutive_changes) ||\n review.consecutive_changes.length !== review.versions_compared - 1) {\n throw new Error(\"Requires a bounded, validated P2-01 historical review\");\n }\n const latest = review.consecutive_changes.at(-1)!;\n if (!latest || latest.baseline_version !== review.versions_compared - 1 ||\n latest.current_version !== review.versions_compared ||\n ![\"comparable_sample\", \"partial\", \"not_comparable\"].includes(latest.status) ||\n ![latest.shared_pages, latest.completely_checked_pairs, latest.regressed_pages,\n latest.coverage_lost_pages, latest.errors_delta_checked,\n latest.warnings_delta_checked].every((n) => Number.isSafeInteger(n))) {\n throw new Error(\"Historical latest transition lacks validated evidence\");\n }\n return latest;\n}\n\nconst TEXTS: Record<MonitorRule, string> = {\n regressed_pages: \"The latest comparable selected-page sample has enough pages with increased observed errors or warnings to preview a regression review.\",\n net_error_increase: \"The latest fully checked matched-page sample has a positive net increase in observed error counts above the configured threshold.\",\n net_warning_increase: \"The latest fully checked matched-page sample has a positive net increase in observed warning counts above the configured threshold.\",\n coverage_loss: \"A formerly completed validator observation is now incomplete; review check availability separately from actual page quality.\",\n sitemap_drift: \"The sampled site discovery fingerprint changed; verify selection and crawl coverage before interpreting historical trends.\",\n};\nconst BLOCKED =\n \"Preview suppressed because the latest sample is incomplete/noncomparable or the source version order is ambiguous.\";\nconst DISABLED = \"This review rule is disabled for this manual evaluation only.\";\nconst CLEAR = \"The observed value did not meet this rule's configured preview threshold.\";\nconst STREAK = \"The configured number of consecutive comparable regression transitions was not established.\";\n\nexport function previewRegressionAlerts(\n review: HistoricalReview, input?: MonitorPolicyInput,\n): MonitorPreview {\n const policy = normalizeMonitorPolicy(input);\n const step = validateHistoricalReview(review);\n const completeLatest = step.status === \"comparable_sample\" &&\n step.shared_pages > 0 &&\n step.completely_checked_pairs === step.shared_pages &&\n !review.time_order_ambiguous;\n const result = emptyMonitorPreview(review.source, policy);\n result.latest_baseline_version = step.baseline_version;\n result.latest_current_version = step.current_version;\n result.latest_comparability = step.status;\n result.latest_compared_pages = step.shared_pages;\n result.latest_completed_pairs = step.completely_checked_pairs;\n result.limitations = [\n \"Manual dry-run only: no scheduled jobs, live website checks, email/webhook delivery, external data integrations or notifications of any kind.\",\n \"Defect alert candidates are emitted only for the latest fully comparable selected-page pair with unambiguous timestamp order, never the full site or Google ranking/traffic behavior.\",\n \"A coverage-loss or changed-sitemap rule produces a review-only observation, not a validated SEO defect or notification.\",\n \"A threshold or regression streak concerns only already-observed completed checks; source snapshots and message content are never returned.\",\n ];\n const add = (rule: MonitorRule, observed: number, threshold: number,\n decision: MonitorDecision, reason: MonitorReasonCode, message: string) => {\n result.rules.push({\n rule, decision, reason_code: reason,\n latest_observed_value: observed,\n threshold, review_required: decision === \"preview_candidate\" || decision === \"review_only\",\n message,\n });\n };\n\n const thresholdRules = [\n { rule: \"regressed_pages\" as const, observed: step.regressed_pages, threshold: policy.min_regressed_pages },\n { rule: \"net_error_increase\" as const, observed: step.errors_delta_checked, threshold: policy.min_net_error_increase },\n { rule: \"net_warning_increase\" as const, observed: step.warnings_delta_checked, threshold: policy.min_net_warning_increase },\n ];\n for (const rule of thresholdRules) {\n if (!completeLatest) {\n add(rule.rule, rule.observed, rule.threshold, \"suppressed\",\n review.time_order_ambiguous ? \"ambiguous_version_order\" : \"incomplete_latest_pair\",\n BLOCKED);\n } else if (rule.observed < rule.threshold) {\n add(rule.rule, rule.observed, rule.threshold, \"below_threshold\", \"threshold_not_met\", CLEAR);\n } else if (rule.rule === \"regressed_pages\" &&\n policy.consecutive_regressing_steps > 1) {\n const required = policy.consecutive_regressing_steps;\n const recent = review.consecutive_changes.slice(-required);\n const tooShort = recent.length < required;\n const validStreak = !tooShort && recent.every((s) =>\n s.status === \"comparable_sample\" &&\n s.regressed_pages >= policy.min_regressed_pages);\n if (validStreak) {\n add(rule.rule, rule.observed, rule.threshold, \"preview_candidate\", \"threshold_met\", TEXTS[rule.rule]);\n } else {\n add(rule.rule, rule.observed, rule.threshold, \"suppressed\",\n tooShort ? \"insufficient_streak_history\" : \"regression_streak_not_met\",\n STREAK);\n }\n } else {\n add(rule.rule, rule.observed, rule.threshold, \"preview_candidate\", \"threshold_met\", TEXTS[rule.rule]);\n }\n }\n if (!policy.review_coverage_loss) {\n add(\"coverage_loss\", step.coverage_lost_pages, policy.min_coverage_lost_pages,\n \"disabled\", \"rule_disabled\", DISABLED);\n } else if (step.coverage_lost_pages >= policy.min_coverage_lost_pages) {\n add(\"coverage_loss\", step.coverage_lost_pages, policy.min_coverage_lost_pages,\n \"review_only\", \"observed_validator_coverage_loss\", TEXTS.coverage_loss);\n } else {\n add(\"coverage_loss\", step.coverage_lost_pages, policy.min_coverage_lost_pages,\n \"below_threshold\", \"threshold_not_met\", CLEAR);\n }\n if (!policy.review_sitemap_drift) {\n add(\"sitemap_drift\", step.sitemap_changed ? 1 : 0, 1,\n \"disabled\", \"rule_disabled\", DISABLED);\n } else if (step.sitemap_changed) {\n add(\"sitemap_drift\", 1, 1, \"review_only\", \"observed_sitemap_drift\", TEXTS.sitemap_drift);\n } else {\n add(\"sitemap_drift\", 0, 1, \"below_threshold\", \"threshold_not_met\", CLEAR);\n }\n result.candidate_count = result.rules.filter((r) => r.decision === \"preview_candidate\").length;\n result.review_only_count = result.rules.filter((r) => r.decision === \"review_only\").length;\n result.suppressed_count = result.rules.filter((r) => r.decision === \"suppressed\").length;\n result.status = result.candidate_count > 0 ? \"preview_ready\" :\n result.review_only_count > 0 ? \"review_only\" :\n !completeLatest ? \"insufficient_evidence\" : \"no_candidate\";\n return result;\n}\n"]}
1
+ {"version":3,"file":"regression-alerts.js","sourceRoot":"","sources":["../../../src/modules/change-regression/regression-alerts.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,iBAAiB,EAAE,oBAAoB,EAAE,sBAAsB;IAC/D,eAAe,EAAE,eAAe;CACxB,CAAC;AAEX,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,mBAAmB,EAAE,aAAa,EAAE,YAAY;IAChD,iBAAiB,EAAE,UAAU;CACrB,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,uBAAuB;CAC/D,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,eAAe,EAAE,mBAAmB,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AC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAC,MAAM,CAAC;IAC3F,MAAM,CAAC,gBAAgB,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,MAAM,CAAC;IACzF,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;QAC5D,MAAM,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;YAC5C,CAAC,cAAc,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,cAAc,CAAC;IAC/D,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) 2026 AKzar1el and Web Validator contributors\n// SPDX-License-Identifier: MIT\n/**\n * P2-02 manual-only dry-run regression monitoring and optional alert PREVIEWS.\n *\n * The caller obtains a validated historical audit review via P2-01 first.\n * This pure evaluator has no browser/network/storage/scheduler/notification API.\n * A candidate is advice to review a comparable sampled-page observation;\n * it is NEVER delivered or interpreted as a site-wide/Google metric signal.\n */\nimport type { HistoricalReview, HistoricalStep } from \"./historical-comparisons.js\";\n\nexport const MONITOR_RULES = [\n \"regressed_pages\", \"net_error_increase\", \"net_warning_increase\",\n \"coverage_loss\", \"sitemap_drift\",\n] as const;\nexport type MonitorRule = typeof MONITOR_RULES[number];\nexport const MONITOR_DECISIONS = [\n \"preview_candidate\", \"review_only\", \"suppressed\",\n \"below_threshold\", \"disabled\",\n] as const;\nexport type MonitorDecision = typeof MONITOR_DECISIONS[number];\nexport const MONITOR_STATUSES = [\n \"preview_ready\", \"review_only\", \"no_candidate\", \"insufficient_evidence\",\n] as const;\nexport type MonitorStatus = typeof MONITOR_STATUSES[number];\nexport const MONITOR_REASON_CODES = [\n \"threshold_met\", \"threshold_not_met\", \"rule_disabled\",\n \"incomplete_latest_pair\", \"ambiguous_version_order\",\n \"insufficient_streak_history\", \"regression_streak_not_met\",\n \"observed_validator_coverage_loss\", \"observed_sitemap_drift\",\n \"not_enough_observed_comparisons\",\n] as const;\nexport type MonitorReasonCode = typeof MONITOR_REASON_CODES[number];\n\nexport interface MonitorPolicyInput {\n min_regressed_pages?: number;\n min_net_error_increase?: number;\n min_net_warning_increase?: number;\n min_coverage_lost_pages?: number;\n consecutive_regressing_steps?: number;\n review_coverage_loss?: boolean;\n review_sitemap_drift?: boolean;\n}\nexport interface MonitorPolicy {\n min_regressed_pages: number;\n min_net_error_increase: number;\n min_net_warning_increase: number;\n min_coverage_lost_pages: number;\n consecutive_regressing_steps: number;\n review_coverage_loss: boolean;\n review_sitemap_drift: boolean;\n}\nexport const DEFAULT_MONITOR_POLICY: Readonly<MonitorPolicy> = Object.freeze({\n min_regressed_pages: 1,\n min_net_error_increase: 1,\n min_net_warning_increase: 1,\n min_coverage_lost_pages: 1,\n consecutive_regressing_steps: 1,\n review_coverage_loss: true,\n review_sitemap_drift: true,\n});\n\nexport interface MonitorRuleResult {\n rule: MonitorRule;\n decision: MonitorDecision;\n reason_code: MonitorReasonCode;\n latest_observed_value: number;\n threshold: number;\n review_required: boolean;\n message: string;\n}\nexport interface MonitorPreview {\n scope: \"manual_sampled_regression_alert_preview_only\";\n source: \"local_saved_ids\" | \"caller_supplied_snapshots\";\n status: MonitorStatus;\n dry_run: true;\n manually_invoked: true;\n scheduler_enabled: false;\n delivery_enabled: false;\n notifications_sent: 0;\n external_integrations_used: false;\n latest_baseline_version: number;\n latest_current_version: number;\n latest_comparability: \"comparable_sample\" | \"partial\" | \"not_comparable\";\n latest_compared_pages: number;\n latest_completed_pairs: number;\n candidate_count: number;\n review_only_count: number;\n suppressed_count: number;\n coverage_limited: true;\n policy: MonitorPolicy;\n rules: MonitorRuleResult[];\n limitations: string[];\n error?: string;\n}\n\nfunction intRange(value: unknown, min: number, max: number): boolean {\n return typeof value === \"number\" && Number.isSafeInteger(value) && value >= min && value <= max;\n}\n\n/** Enforce a small, explicit policy with no arbitrary scripts, URLs or destinations. */\nexport function normalizeMonitorPolicy(input?: MonitorPolicyInput): MonitorPolicy {\n if (input !== undefined && (input === null || typeof input !== \"object\" ||\n Array.isArray(input))) {\n throw new Error(\"Monitoring policy must be a bounded object\");\n }\n const provided = input ?? {};\n const allowed: ReadonlySet<string> = new Set(Object.keys(DEFAULT_MONITOR_POLICY));\n if (Object.keys(provided).some((key) => !allowed.has(key))) {\n throw new Error(\"Monitoring policy contains unsupported options\");\n }\n const merged: MonitorPolicy = { ...DEFAULT_MONITOR_POLICY, ...provided };\n if (!intRange(merged.min_regressed_pages, 1, 8) ||\n !intRange(merged.min_net_error_increase, 1, 10_000) ||\n !intRange(merged.min_net_warning_increase, 1, 10_000) ||\n !intRange(merged.min_coverage_lost_pages, 1, 8) ||\n !intRange(merged.consecutive_regressing_steps, 1, 4) ||\n typeof merged.review_coverage_loss !== \"boolean\" ||\n typeof merged.review_sitemap_drift !== \"boolean\") {\n throw new Error(\"Monitoring thresholds or review toggles out of allowed range\");\n }\n return merged;\n}\n\nexport function emptyMonitorPreview(\n source: MonitorPreview[\"source\"],\n policy: MonitorPolicy = { ...DEFAULT_MONITOR_POLICY },\n): MonitorPreview {\n return {\n scope: \"manual_sampled_regression_alert_preview_only\",\n source, status: \"insufficient_evidence\",\n dry_run: true, manually_invoked: true,\n scheduler_enabled: false, delivery_enabled: false,\n notifications_sent: 0, external_integrations_used: false,\n latest_baseline_version: 0, latest_current_version: 0,\n latest_comparability: \"not_comparable\",\n latest_compared_pages: 0, latest_completed_pairs: 0,\n candidate_count: 0, review_only_count: 0, suppressed_count: 0,\n coverage_limited: true, policy, rules: [],\n limitations: [\"No alerts or schedules were started; bounded historical source evidence was not sufficient for a monitoring preview.\"],\n };\n}\n\nfunction validateHistoricalReview(review: HistoricalReview): HistoricalStep {\n if (!review || review.scope !== \"historical_compact_audit_versions_only\" ||\n ![\"local_saved_ids\", \"caller_supplied_snapshots\"].includes(review.source) ||\n !Number.isSafeInteger(review.versions_compared) ||\n review.versions_compared < 2 || review.versions_compared > 10 ||\n !Array.isArray(review.consecutive_changes) ||\n review.consecutive_changes.length !== review.versions_compared - 1) {\n throw new Error(\"Requires a bounded, validated P2-01 historical review\");\n }\n const latest = review.consecutive_changes.at(-1)!;\n if (!latest || latest.baseline_version !== review.versions_compared - 1 ||\n latest.current_version !== review.versions_compared ||\n ![\"comparable_sample\", \"partial\", \"not_comparable\"].includes(latest.status) ||\n ![latest.shared_pages, latest.completely_checked_pairs, latest.regressed_pages,\n latest.coverage_lost_pages, latest.errors_delta_checked,\n latest.warnings_delta_checked].every((n) => Number.isSafeInteger(n))) {\n throw new Error(\"Historical latest transition lacks validated evidence\");\n }\n return latest;\n}\n\nconst TEXTS: Record<MonitorRule, string> = {\n regressed_pages: \"The latest comparable selected-page sample has enough pages with increased observed errors or warnings to preview a regression review.\",\n net_error_increase: \"The latest fully checked matched-page sample has a positive net increase in observed error counts above the configured threshold.\",\n net_warning_increase: \"The latest fully checked matched-page sample has a positive net increase in observed warning counts above the configured threshold.\",\n coverage_loss: \"A formerly completed validator observation is now incomplete; review check availability separately from actual page quality.\",\n sitemap_drift: \"The sampled site discovery fingerprint changed; verify selection and crawl coverage before interpreting historical trends.\",\n};\nconst BLOCKED =\n \"Preview suppressed because the latest sample is incomplete/noncomparable or the source version order is ambiguous.\";\nconst DISABLED = \"This review rule is disabled for this manual evaluation only.\";\nconst CLEAR = \"The observed value did not meet this rule's configured preview threshold.\";\nconst STREAK = \"The configured number of consecutive comparable regression transitions was not established.\";\n\nexport function previewRegressionAlerts(\n review: HistoricalReview, input?: MonitorPolicyInput,\n): MonitorPreview {\n const policy = normalizeMonitorPolicy(input);\n const step = validateHistoricalReview(review);\n const completeLatest = step.status === \"comparable_sample\" &&\n step.shared_pages > 0 &&\n step.completely_checked_pairs === step.shared_pages &&\n !review.time_order_ambiguous;\n const result = emptyMonitorPreview(review.source, policy);\n result.latest_baseline_version = step.baseline_version;\n result.latest_current_version = step.current_version;\n result.latest_comparability = step.status;\n result.latest_compared_pages = step.shared_pages;\n result.latest_completed_pairs = step.completely_checked_pairs;\n result.limitations = [\n \"Manual dry-run only: no scheduled jobs, live website checks, email/webhook delivery, external data integrations or notifications of any kind.\",\n \"Defect alert candidates are emitted only for the latest fully comparable selected-page pair with unambiguous timestamp order, never the full site or Google ranking/traffic behavior.\",\n \"A coverage-loss or changed-sitemap rule produces a review-only observation, not a validated SEO defect or notification.\",\n \"A threshold or regression streak concerns only already-observed completed checks; source snapshots and message content are never returned.\",\n ];\n const add = (rule: MonitorRule, observed: number, threshold: number,\n decision: MonitorDecision, reason: MonitorReasonCode, message: string) => {\n result.rules.push({\n rule, decision, reason_code: reason,\n latest_observed_value: observed,\n threshold, review_required: decision === \"preview_candidate\" || decision === \"review_only\",\n message,\n });\n };\n\n const thresholdRules = [\n { rule: \"regressed_pages\" as const, observed: step.regressed_pages, threshold: policy.min_regressed_pages },\n { rule: \"net_error_increase\" as const, observed: step.errors_delta_checked, threshold: policy.min_net_error_increase },\n { rule: \"net_warning_increase\" as const, observed: step.warnings_delta_checked, threshold: policy.min_net_warning_increase },\n ];\n for (const rule of thresholdRules) {\n if (!completeLatest) {\n add(rule.rule, rule.observed, rule.threshold, \"suppressed\",\n review.time_order_ambiguous ? \"ambiguous_version_order\" : \"incomplete_latest_pair\",\n BLOCKED);\n } else if (rule.observed < rule.threshold) {\n add(rule.rule, rule.observed, rule.threshold, \"below_threshold\", \"threshold_not_met\", CLEAR);\n } else if (rule.rule === \"regressed_pages\" &&\n policy.consecutive_regressing_steps > 1) {\n const required = policy.consecutive_regressing_steps;\n const recent = review.consecutive_changes.slice(-required);\n const tooShort = recent.length < required;\n const validStreak = !tooShort && recent.every((s) =>\n s.status === \"comparable_sample\" &&\n s.regressed_pages >= policy.min_regressed_pages);\n if (validStreak) {\n add(rule.rule, rule.observed, rule.threshold, \"preview_candidate\", \"threshold_met\", TEXTS[rule.rule]);\n } else {\n add(rule.rule, rule.observed, rule.threshold, \"suppressed\",\n tooShort ? \"insufficient_streak_history\" : \"regression_streak_not_met\",\n STREAK);\n }\n } else {\n add(rule.rule, rule.observed, rule.threshold, \"preview_candidate\", \"threshold_met\", TEXTS[rule.rule]);\n }\n }\n if (!policy.review_coverage_loss) {\n add(\"coverage_loss\", step.coverage_lost_pages, policy.min_coverage_lost_pages,\n \"disabled\", \"rule_disabled\", DISABLED);\n } else if (step.coverage_lost_pages >= policy.min_coverage_lost_pages) {\n add(\"coverage_loss\", step.coverage_lost_pages, policy.min_coverage_lost_pages,\n \"review_only\", \"observed_validator_coverage_loss\", TEXTS.coverage_loss);\n } else {\n add(\"coverage_loss\", step.coverage_lost_pages, policy.min_coverage_lost_pages,\n \"below_threshold\", \"threshold_not_met\", CLEAR);\n }\n if (!policy.review_sitemap_drift) {\n add(\"sitemap_drift\", step.sitemap_changed ? 1 : 0, 1,\n \"disabled\", \"rule_disabled\", DISABLED);\n } else if (step.sitemap_changed) {\n add(\"sitemap_drift\", 1, 1, \"review_only\", \"observed_sitemap_drift\", TEXTS.sitemap_drift);\n } else {\n add(\"sitemap_drift\", 0, 1, \"below_threshold\", \"threshold_not_met\", CLEAR);\n }\n result.candidate_count = result.rules.filter((r) => r.decision === \"preview_candidate\").length;\n result.review_only_count = result.rules.filter((r) => r.decision === \"review_only\").length;\n result.suppressed_count = result.rules.filter((r) => r.decision === \"suppressed\").length;\n result.status = result.candidate_count > 0 ? \"preview_ready\" :\n result.review_only_count > 0 ? \"review_only\" :\n !completeLatest ? \"insufficient_evidence\" : \"no_candidate\";\n return result;\n}\n"]}
@@ -1,3 +1,5 @@
1
+ // Copyright (c) 2026 AKzar1el and Web Validator contributors
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * Validate caller-supplied, timezone-qualified timestamps before Date.parse.
3
5
  * Date.parse normalizes impossible calendar dates (e.g. February 30), which
@@ -1 +1 @@
1
- {"version":3,"file":"strict-observation-time.js","sourceRoot":"","sources":["../../../src/modules/change-regression/strict-observation-time.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,SAAS,CAAC;IACrE,MAAM,KAAK,GACT,2FAA2F,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1G,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC;IAC3G,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,UAAU,GAAG,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC3E,MAAM,YAAY,GAAG,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACjF,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,KAAK,CAAC,IAAI,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC;IACtE,MAAM,OAAO,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7E,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;QAChE,IAAI,GAAG,EAAE,IAAI,MAAM,GAAG,EAAE,IAAI,MAAM,GAAG,EAAE,IAAI,UAAU,GAAG,EAAE,IAAI,YAAY,GAAG,EAAE,EAAE,CAAC;QAClF,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC","sourcesContent":["/**\n * Validate caller-supplied, timezone-qualified timestamps before Date.parse.\n * Date.parse normalizes impossible calendar dates (e.g. February 30), which\n * must not be allowed to define the chronology of audit evidence.\n * Shared by local and hosted comparison modules; no I/O or dependencies.\n */\nexport function strictObservationTime(value: unknown): number | undefined {\n if (typeof value !== \"string\" || value.length > 40) return undefined;\n const match =\n /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d{1,3})?(?:Z|[+-](\\d{2}):(\\d{2}))$/u.exec(value);\n if (!match) return undefined;\n const [, yearRaw, monthRaw, dayRaw, hourRaw, minuteRaw, secondRaw, offsetHourRaw, offsetMinuteRaw] = match;\n const year = Number(yearRaw);\n const month = Number(monthRaw);\n const day = Number(dayRaw);\n const hour = Number(hourRaw);\n const minute = Number(minuteRaw);\n const second = Number(secondRaw);\n const offsetHour = offsetHourRaw === undefined ? 0 : Number(offsetHourRaw);\n const offsetMinute = offsetMinuteRaw === undefined ? 0 : Number(offsetMinuteRaw);\n const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n const maxDays = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n if (month < 1 || month > 12 || day < 1 || day > maxDays[month - 1] ||\n hour > 23 || minute > 59 || second > 59 || offsetHour > 23 || offsetMinute > 59) {\n return undefined;\n }\n const time = Date.parse(value);\n return Number.isFinite(time) ? time : undefined;\n}\n"]}
1
+ {"version":3,"file":"strict-observation-time.js","sourceRoot":"","sources":["../../../src/modules/change-regression/strict-observation-time.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,+BAA+B;AAC/B;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE;QAAE,OAAO,SAAS,CAAC;IACrE,MAAM,KAAK,GACT,2FAA2F,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1G,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC;IAC3G,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,UAAU,GAAG,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC3E,MAAM,YAAY,GAAG,eAAe,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IACjF,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,KAAK,CAAC,IAAI,IAAI,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC;IACtE,MAAM,OAAO,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7E,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;QAChE,IAAI,GAAG,EAAE,IAAI,MAAM,GAAG,EAAE,IAAI,MAAM,GAAG,EAAE,IAAI,UAAU,GAAG,EAAE,IAAI,YAAY,GAAG,EAAE,EAAE,CAAC;QAClF,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC","sourcesContent":["// Copyright (c) 2026 AKzar1el and Web Validator contributors\n// SPDX-License-Identifier: MIT\n/**\n * Validate caller-supplied, timezone-qualified timestamps before Date.parse.\n * Date.parse normalizes impossible calendar dates (e.g. February 30), which\n * must not be allowed to define the chronology of audit evidence.\n * Shared by local and hosted comparison modules; no I/O or dependencies.\n */\nexport function strictObservationTime(value: unknown): number | undefined {\n if (typeof value !== \"string\" || value.length > 40) return undefined;\n const match =\n /^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d{1,3})?(?:Z|[+-](\\d{2}):(\\d{2}))$/u.exec(value);\n if (!match) return undefined;\n const [, yearRaw, monthRaw, dayRaw, hourRaw, minuteRaw, secondRaw, offsetHourRaw, offsetMinuteRaw] = match;\n const year = Number(yearRaw);\n const month = Number(monthRaw);\n const day = Number(dayRaw);\n const hour = Number(hourRaw);\n const minute = Number(minuteRaw);\n const second = Number(secondRaw);\n const offsetHour = offsetHourRaw === undefined ? 0 : Number(offsetHourRaw);\n const offsetMinute = offsetMinuteRaw === undefined ? 0 : Number(offsetMinuteRaw);\n const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n const maxDays = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n if (month < 1 || month > 12 || day < 1 || day > maxDays[month - 1] ||\n hour > 23 || minute > 59 || second > 59 || offsetHour > 23 || offsetMinute > 59) {\n return undefined;\n }\n const time = Date.parse(value);\n return Number.isFinite(time) ? time : undefined;\n}\n"]}
@@ -1,3 +1,5 @@
1
+ // Copyright (c) 2026 AKzar1el and Web Validator contributors
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * P1-05 citation / dataset / freshness / methodology consistency.
3
5
  *