mcp-web-validator 1.3.50 → 1.3.53

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 (175) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +66 -4
  3. package/dist/audit-history.d.ts +9 -0
  4. package/dist/audit-history.js +27 -0
  5. package/dist/audit-history.js.map +1 -1
  6. package/dist/index.js +2535 -30
  7. package/dist/index.js.map +1 -1
  8. package/dist/mcp-bounds.d.ts +11 -0
  9. package/dist/mcp-bounds.js +68 -0
  10. package/dist/mcp-bounds.js.map +1 -0
  11. package/dist/modules/browser-ux/lighthouse-lab-probe.d.ts +21 -0
  12. package/dist/modules/browser-ux/lighthouse-lab-probe.js +190 -0
  13. package/dist/modules/browser-ux/lighthouse-lab-probe.js.map +1 -0
  14. package/dist/modules/browser-ux/lighthouse-lab.d.ts +61 -0
  15. package/dist/modules/browser-ux/lighthouse-lab.js +98 -0
  16. package/dist/modules/browser-ux/lighthouse-lab.js.map +1 -0
  17. package/dist/modules/browser-ux/media-diagnostics.d.ts +41 -0
  18. package/dist/modules/browser-ux/media-diagnostics.js +183 -0
  19. package/dist/modules/browser-ux/media-diagnostics.js.map +1 -0
  20. package/dist/modules/browser-ux/raw-rendered-diff.d.ts +70 -0
  21. package/dist/modules/browser-ux/raw-rendered-diff.js +262 -0
  22. package/dist/modules/browser-ux/raw-rendered-diff.js.map +1 -0
  23. package/dist/modules/browser-ux/raw-rendered-probe.d.ts +17 -0
  24. package/dist/modules/browser-ux/raw-rendered-probe.js +163 -0
  25. package/dist/modules/browser-ux/raw-rendered-probe.js.map +1 -0
  26. package/dist/modules/browser-ux/resource-failures-probe.d.ts +11 -0
  27. package/dist/modules/browser-ux/resource-failures-probe.js +231 -0
  28. package/dist/modules/browser-ux/resource-failures-probe.js.map +1 -0
  29. package/dist/modules/browser-ux/resource-failures.d.ts +79 -0
  30. package/dist/modules/browser-ux/resource-failures.js +178 -0
  31. package/dist/modules/browser-ux/resource-failures.js.map +1 -0
  32. package/dist/modules/browser-ux/viewport-parity-probe.d.ts +5 -0
  33. package/dist/modules/browser-ux/viewport-parity-probe.js +307 -0
  34. package/dist/modules/browser-ux/viewport-parity-probe.js.map +1 -0
  35. package/dist/modules/browser-ux/viewport-parity.d.ts +112 -0
  36. package/dist/modules/browser-ux/viewport-parity.js +224 -0
  37. package/dist/modules/browser-ux/viewport-parity.js.map +1 -0
  38. package/dist/modules/browser-ux/wcag-interactions.d.ts +95 -0
  39. package/dist/modules/browser-ux/wcag-interactions.js +360 -0
  40. package/dist/modules/browser-ux/wcag-interactions.js.map +1 -0
  41. package/dist/modules/change-regression/availability-history-store.d.ts +18 -0
  42. package/dist/modules/change-regression/availability-history-store.js +168 -0
  43. package/dist/modules/change-regression/availability-history-store.js.map +1 -0
  44. package/dist/modules/change-regression/crawler-log-correlation.d.ts +111 -0
  45. package/dist/modules/change-regression/crawler-log-correlation.js +374 -0
  46. package/dist/modules/change-regression/crawler-log-correlation.js.map +1 -0
  47. package/dist/modules/change-regression/google-common-crawler-ip.d.ts +15 -0
  48. package/dist/modules/change-regression/google-common-crawler-ip.js +129 -0
  49. package/dist/modules/change-regression/google-common-crawler-ip.js.map +1 -0
  50. package/dist/modules/change-regression/historical-comparisons.d.ts +120 -0
  51. package/dist/modules/change-regression/historical-comparisons.js +330 -0
  52. package/dist/modules/change-regression/historical-comparisons.js.map +1 -0
  53. package/dist/modules/change-regression/production-change-comparison.d.ts +68 -0
  54. package/dist/modules/change-regression/production-change-comparison.js +214 -0
  55. package/dist/modules/change-regression/production-change-comparison.js.map +1 -0
  56. package/dist/modules/change-regression/regression-alerts.d.ts +73 -0
  57. package/dist/modules/change-regression/regression-alerts.js +183 -0
  58. package/dist/modules/change-regression/regression-alerts.js.map +1 -0
  59. package/dist/modules/change-regression/strict-observation-time.d.ts +7 -0
  60. package/dist/modules/change-regression/strict-observation-time.js +31 -0
  61. package/dist/modules/change-regression/strict-observation-time.js.map +1 -0
  62. package/dist/modules/content-schema/citation-methodology-consistency.d.ts +108 -0
  63. package/dist/modules/content-schema/citation-methodology-consistency.js +360 -0
  64. package/dist/modules/content-schema/citation-methodology-consistency.js.map +1 -0
  65. package/dist/modules/content-schema/competitor-intent-comparison.d.ts +74 -0
  66. package/dist/modules/content-schema/competitor-intent-comparison.js +185 -0
  67. package/dist/modules/content-schema/competitor-intent-comparison.js.map +1 -0
  68. package/dist/modules/content-schema/empty-boilerplate-content.d.ts +36 -0
  69. package/dist/modules/content-schema/empty-boilerplate-content.js +225 -0
  70. package/dist/modules/content-schema/empty-boilerplate-content.js.map +1 -0
  71. package/dist/modules/content-schema/extract-citation-methodology.d.ts +6 -0
  72. package/dist/modules/content-schema/extract-citation-methodology.js +201 -0
  73. package/dist/modules/content-schema/extract-citation-methodology.js.map +1 -0
  74. package/dist/modules/content-schema/extract-competitor-intent.d.ts +2 -0
  75. package/dist/modules/content-schema/extract-competitor-intent.js +140 -0
  76. package/dist/modules/content-schema/extract-competitor-intent.js.map +1 -0
  77. package/dist/modules/content-schema/extract-main-content.d.ts +6 -0
  78. package/dist/modules/content-schema/extract-main-content.js +33 -0
  79. package/dist/modules/content-schema/extract-main-content.js.map +1 -0
  80. package/dist/modules/content-schema/extract-metadata-consistency.d.ts +3 -0
  81. package/dist/modules/content-schema/extract-metadata-consistency.js +62 -0
  82. package/dist/modules/content-schema/extract-metadata-consistency.js.map +1 -0
  83. package/dist/modules/content-schema/extract-product-claims.d.ts +3 -0
  84. package/dist/modules/content-schema/extract-product-claims.js +58 -0
  85. package/dist/modules/content-schema/extract-product-claims.js.map +1 -0
  86. package/dist/modules/content-schema/extract-structured-data.d.ts +3 -0
  87. package/dist/modules/content-schema/extract-structured-data.js +25 -0
  88. package/dist/modules/content-schema/extract-structured-data.js.map +1 -0
  89. package/dist/modules/content-schema/metadata-consistency.d.ts +66 -0
  90. package/dist/modules/content-schema/metadata-consistency.js +282 -0
  91. package/dist/modules/content-schema/metadata-consistency.js.map +1 -0
  92. package/dist/modules/content-schema/product-claims.d.ts +73 -0
  93. package/dist/modules/content-schema/product-claims.js +195 -0
  94. package/dist/modules/content-schema/product-claims.js.map +1 -0
  95. package/dist/modules/content-schema/same-language-duplicates.d.ts +52 -0
  96. package/dist/modules/content-schema/same-language-duplicates.js +158 -0
  97. package/dist/modules/content-schema/same-language-duplicates.js.map +1 -0
  98. package/dist/modules/content-schema/structured-data-validation.d.ts +37 -0
  99. package/dist/modules/content-schema/structured-data-validation.js +385 -0
  100. package/dist/modules/content-schema/structured-data-validation.js.map +1 -0
  101. package/dist/modules/external-metrics/crux-field-probe.d.ts +10 -0
  102. package/dist/modules/external-metrics/crux-field-probe.js +113 -0
  103. package/dist/modules/external-metrics/crux-field-probe.js.map +1 -0
  104. package/dist/modules/external-metrics/crux-field.d.ts +61 -0
  105. package/dist/modules/external-metrics/crux-field.js +231 -0
  106. package/dist/modules/external-metrics/crux-field.js.map +1 -0
  107. package/dist/modules/http-crawl/availability-observations.d.ts +68 -0
  108. package/dist/modules/http-crawl/availability-observations.js +206 -0
  109. package/dist/modules/http-crawl/availability-observations.js.map +1 -0
  110. package/dist/modules/http-crawl/availability-probe.d.ts +8 -0
  111. package/dist/modules/http-crawl/availability-probe.js +46 -0
  112. package/dist/modules/http-crawl/availability-probe.js.map +1 -0
  113. package/dist/modules/http-crawl/crawler-access-probe.d.ts +6 -0
  114. package/dist/modules/http-crawl/crawler-access-probe.js +79 -0
  115. package/dist/modules/http-crawl/crawler-access-probe.js.map +1 -0
  116. package/dist/modules/http-crawl/crawler-access.d.ts +75 -0
  117. package/dist/modules/http-crawl/crawler-access.js +404 -0
  118. package/dist/modules/http-crawl/crawler-access.js.map +1 -0
  119. package/dist/modules/http-crawl/http-delivery-probe.d.ts +3 -0
  120. package/dist/modules/http-crawl/http-delivery-probe.js +44 -0
  121. package/dist/modules/http-crawl/http-delivery-probe.js.map +1 -0
  122. package/dist/modules/http-crawl/http-delivery.d.ts +64 -0
  123. package/dist/modules/http-crawl/http-delivery.js +269 -0
  124. package/dist/modules/http-crawl/http-delivery.js.map +1 -0
  125. package/dist/modules/http-crawl/https-security.d.ts +84 -0
  126. package/dist/modules/http-crawl/https-security.js +441 -0
  127. package/dist/modules/http-crawl/https-security.js.map +1 -0
  128. package/dist/modules/http-crawl/non-html-directives.d.ts +74 -0
  129. package/dist/modules/http-crawl/non-html-directives.js +353 -0
  130. package/dist/modules/http-crawl/non-html-directives.js.map +1 -0
  131. package/dist/modules/http-crawl/redirect-canonical-chains.d.ts +80 -0
  132. package/dist/modules/http-crawl/redirect-canonical-chains.js +459 -0
  133. package/dist/modules/http-crawl/redirect-canonical-chains.js.map +1 -0
  134. package/dist/modules/http-crawl/redirect-canonical-probe.d.ts +6 -0
  135. package/dist/modules/http-crawl/redirect-canonical-probe.js +83 -0
  136. package/dist/modules/http-crawl/redirect-canonical-probe.js.map +1 -0
  137. package/dist/modules/http-crawl/sitemap-inventory-probe.d.ts +8 -0
  138. package/dist/modules/http-crawl/sitemap-inventory-probe.js +155 -0
  139. package/dist/modules/http-crawl/sitemap-inventory-probe.js.map +1 -0
  140. package/dist/modules/http-crawl/sitemap-inventory.d.ts +107 -0
  141. package/dist/modules/http-crawl/sitemap-inventory.js +557 -0
  142. package/dist/modules/http-crawl/sitemap-inventory.js.map +1 -0
  143. package/dist/modules/http-crawl/url-variants.d.ts +86 -0
  144. package/dist/modules/http-crawl/url-variants.js +379 -0
  145. package/dist/modules/http-crawl/url-variants.js.map +1 -0
  146. package/dist/modules/site-architecture/extract-internal-links.d.ts +3 -0
  147. package/dist/modules/site-architecture/extract-internal-links.js +88 -0
  148. package/dist/modules/site-architecture/extract-internal-links.js.map +1 -0
  149. package/dist/modules/site-architecture/extract-multilingual-page.d.ts +2 -0
  150. package/dist/modules/site-architecture/extract-multilingual-page.js +29 -0
  151. package/dist/modules/site-architecture/extract-multilingual-page.js.map +1 -0
  152. package/dist/modules/site-architecture/internal-link-graph-probe.d.ts +7 -0
  153. package/dist/modules/site-architecture/internal-link-graph-probe.js +116 -0
  154. package/dist/modules/site-architecture/internal-link-graph-probe.js.map +1 -0
  155. package/dist/modules/site-architecture/internal-link-graph.d.ts +113 -0
  156. package/dist/modules/site-architecture/internal-link-graph.js +414 -0
  157. package/dist/modules/site-architecture/internal-link-graph.js.map +1 -0
  158. package/dist/modules/site-architecture/internal-link-quality.d.ts +77 -0
  159. package/dist/modules/site-architecture/internal-link-quality.js +260 -0
  160. package/dist/modules/site-architecture/internal-link-quality.js.map +1 -0
  161. package/dist/modules/site-architecture/multilingual-clusters.d.ts +82 -0
  162. package/dist/modules/site-architecture/multilingual-clusters.js +363 -0
  163. package/dist/modules/site-architecture/multilingual-clusters.js.map +1 -0
  164. package/dist/network.d.ts +4 -0
  165. package/dist/network.js +18 -2
  166. package/dist/network.js.map +1 -1
  167. package/dist/presentation.d.ts +53 -0
  168. package/dist/presentation.js +526 -0
  169. package/dist/presentation.js.map +1 -1
  170. package/dist/screenshot.d.ts +2 -1
  171. package/dist/screenshot.js +4 -2
  172. package/dist/screenshot.js.map +1 -1
  173. package/dist/seo-auditor.js +16 -6
  174. package/dist/seo-auditor.js.map +1 -1
  175. package/package.json +7 -4
@@ -0,0 +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,mB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AAC,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"]}
@@ -0,0 +1,68 @@
1
+ export declare const MAX_CHANGE_HTML_BYTES = 180000;
2
+ export declare const MAX_CHANGE_TOTAL_BYTES = 360000;
3
+ export declare const MAX_CHANGE_FINDINGS = 14;
4
+ export declare const CHANGE_STATUSES: readonly ["comparable_snapshot", "partial", "not_comparable"];
5
+ export declare const CHANGE_FINDING_CODES: readonly ["status_changed", "delivery_not_comparable", "delivery_unverified", "time_ambiguous", "extraction_limited", "noindex_added", "noindex_removed", "canonical_changed", "title_changed", "description_changed", "h1_changed", "robots_changed", "main_content_changed", "links_changed", "jsonld_changed", "html_only_changed"];
6
+ type FindingCode = typeof CHANGE_FINDING_CODES[number];
7
+ type ReviewStatus = typeof CHANGE_STATUSES[number];
8
+ export interface ChangeVersion {
9
+ observed_at: string;
10
+ html: string;
11
+ http_status?: number;
12
+ }
13
+ export interface ProductionChangeInput {
14
+ page_url: string;
15
+ baseline: ChangeVersion;
16
+ current: ChangeVersion;
17
+ }
18
+ export interface PageFingerprint {
19
+ http_status: number | null;
20
+ html_bytes: number;
21
+ html_sha256: string | null;
22
+ main_text_sha256: string | null;
23
+ main_words: number | null;
24
+ same_origin_link_targets: number | null;
25
+ title_present: boolean | null;
26
+ description_present: boolean | null;
27
+ h1_count: number | null;
28
+ canonical_state: "missing" | "self" | "different" | "ambiguous" | null;
29
+ noindex_declared: boolean | null;
30
+ jsonld_blocks: number | null;
31
+ sample_truncated: boolean;
32
+ }
33
+ export interface ChangeFinding {
34
+ code: FindingCode;
35
+ severity: "warning" | "info";
36
+ message: string;
37
+ }
38
+ export interface ProductionChangeReview {
39
+ scope: "two_caller_supplied_html_observations";
40
+ status: ReviewStatus;
41
+ time_order_ambiguous: boolean;
42
+ baseline: PageFingerprint;
43
+ current: PageFingerprint;
44
+ http_status_changed: boolean | null;
45
+ html_fingerprint_changed: boolean | null;
46
+ main_text_fingerprint_changed: boolean | null;
47
+ title_changed: boolean | null;
48
+ description_changed: boolean | null;
49
+ h1_changed: boolean | null;
50
+ canonical_changed: boolean | null;
51
+ robots_changed: boolean | null;
52
+ noindex_added: boolean | null;
53
+ noindex_removed: boolean | null;
54
+ main_words_added: number | null;
55
+ main_words_removed: number | null;
56
+ links_added: number | null;
57
+ links_removed: number | null;
58
+ jsonld_blocks_changed: boolean | null;
59
+ coverage_limited: true;
60
+ limitations: string[];
61
+ total_findings: number;
62
+ findings: ChangeFinding[];
63
+ findings_truncated: boolean;
64
+ error?: string;
65
+ }
66
+ export declare function emptyProductionChangeReview(): ProductionChangeReview;
67
+ export declare function analyzeProductionChange(input: ProductionChangeInput): Promise<ProductionChangeReview>;
68
+ export {};
@@ -0,0 +1,214 @@
1
+ /**
2
+ * V10: offline production HTML baseline comparison.
3
+ * Reuses V07's audited structural parser; never fetches, renders, stores or
4
+ * returns input text, metadata values or URLs.
5
+ */
6
+ import { load } from "cheerio";
7
+ import { analyzeRawRendered } from "../browser-ux/raw-rendered-diff.js";
8
+ import { safeMetadataLabel } from "../content-schema/metadata-consistency.js";
9
+ import { strictObservationTime } from "./strict-observation-time.js";
10
+ export const MAX_CHANGE_HTML_BYTES = 180_000;
11
+ export const MAX_CHANGE_TOTAL_BYTES = 360_000;
12
+ export const MAX_CHANGE_FINDINGS = 14;
13
+ export const CHANGE_STATUSES = ["comparable_snapshot", "partial", "not_comparable"];
14
+ export const CHANGE_FINDING_CODES = [
15
+ "status_changed", "delivery_not_comparable", "delivery_unverified",
16
+ "time_ambiguous", "extraction_limited", "noindex_added", "noindex_removed",
17
+ "canonical_changed", "title_changed", "description_changed", "h1_changed",
18
+ "robots_changed", "main_content_changed", "links_changed", "jsonld_changed",
19
+ "html_only_changed",
20
+ ];
21
+ const limitations = [
22
+ "Only two explicitly supplied HTML observations are compared; timestamps and HTTP statuses are caller claims, not independently verified production events.",
23
+ "No live fetches, deployments, browser execution, history writes, search-console evidence, ranking or traffic-causality conclusions.",
24
+ "Hashes describe supplied exact HTML bytes and normalized sampled main text; a fingerprint difference is not proof of deployment causality or indexing impact.",
25
+ "Content, links, metadata values, timestamps and page URLs are redacted. Static HTML cannot establish CSS/JS-rendered visibility or full-site coverage.",
26
+ ];
27
+ function blank() {
28
+ return {
29
+ http_status: null, html_bytes: 0, html_sha256: null,
30
+ main_text_sha256: null, main_words: null,
31
+ same_origin_link_targets: null, title_present: null,
32
+ description_present: null, h1_count: null,
33
+ canonical_state: null, noindex_declared: null,
34
+ jsonld_blocks: null, sample_truncated: false,
35
+ };
36
+ }
37
+ export function emptyProductionChangeReview() {
38
+ return {
39
+ scope: "two_caller_supplied_html_observations", status: "not_comparable",
40
+ time_order_ambiguous: false, baseline: blank(), current: blank(),
41
+ http_status_changed: null, html_fingerprint_changed: null,
42
+ main_text_fingerprint_changed: null, title_changed: null,
43
+ description_changed: null, h1_changed: null, canonical_changed: null,
44
+ robots_changed: null, noindex_added: null, noindex_removed: null,
45
+ main_words_added: null, main_words_removed: null,
46
+ links_added: null, links_removed: null, jsonld_blocks_changed: null,
47
+ coverage_limited: true, limitations, total_findings: 0,
48
+ findings: [], findings_truncated: false,
49
+ };
50
+ }
51
+ const encoder = new TextEncoder();
52
+ const byteLength = (value) => encoder.encode(value).byteLength;
53
+ async function digest(value) {
54
+ const bytes = new Uint8Array(await crypto.subtle.digest("SHA-256", encoder.encode(value)));
55
+ return Array.from(bytes, (item) => item.toString(16).padStart(2, "0")).join("");
56
+ }
57
+ function timeValue(value) {
58
+ const parsed = strictObservationTime(value);
59
+ if (parsed === undefined)
60
+ throw new Error("Invalid offset-aware ISO observation time or calendar date");
61
+ return parsed;
62
+ }
63
+ function validateVersion(value) {
64
+ if (!value || typeof value.html !== "string" ||
65
+ byteLength(value.html) > MAX_CHANGE_HTML_BYTES ||
66
+ (value.http_status !== undefined &&
67
+ (!Number.isInteger(value.http_status) || value.http_status < 200 || value.http_status > 599)) ||
68
+ (value.http_status === 200 && !value.html.trim())) {
69
+ throw new Error("Invalid bounded production HTML observation");
70
+ }
71
+ }
72
+ function normalized(value) {
73
+ return value.normalize("NFKC").replace(/\s+/gu, " ").trim();
74
+ }
75
+ function extractExtra(html) {
76
+ const $ = load(html);
77
+ const head = $("head");
78
+ const desc = normalized(head.find('meta[name="description" i]').first().attr("content") ?? "");
79
+ const robots = head.find("meta[name][content]").toArray()
80
+ .filter((el) => ["robots", "googlebot"].includes(($(el).attr("name") ?? "").toLowerCase()))
81
+ .flatMap((el) => ($(el).attr("content") ?? "").toLowerCase().split(/[\s,;]+/u))
82
+ .filter(Boolean).sort().join(",");
83
+ const main = $("main,[role='main'],article").first();
84
+ const content = (main.length ? main.clone() : $("body").first().clone());
85
+ content.find("script,style,noscript,template,svg,nav,header,footer,aside").remove();
86
+ const source = content.text();
87
+ const tooLong = source.length > 100_000;
88
+ return {
89
+ desc, robots,
90
+ normalizedMain: tooLong ? null : normalized(source).toLocaleLowerCase("en"),
91
+ tooLong,
92
+ };
93
+ }
94
+ export async function analyzeProductionChange(input) {
95
+ if (!input || !safeMetadataLabel(input.page_url) || !input.baseline || !input.current) {
96
+ throw new Error("Expected one safe query-free page URL and two observations");
97
+ }
98
+ validateVersion(input.baseline);
99
+ validateVersion(input.current);
100
+ if (byteLength(input.baseline.html) + byteLength(input.current.html) > MAX_CHANGE_TOTAL_BYTES) {
101
+ throw new Error("Combined observations exceed HTML size limit");
102
+ }
103
+ const older = timeValue(input.baseline.observed_at);
104
+ const newer = timeValue(input.current.observed_at);
105
+ if (newer < older)
106
+ throw new Error("Observation times must be oldest first");
107
+ const report = emptyProductionChangeReview();
108
+ report.time_order_ambiguous = newer === older;
109
+ const a = input.baseline, b = input.current;
110
+ report.baseline.http_status = a.http_status ?? null;
111
+ report.current.http_status = b.http_status ?? null;
112
+ report.http_status_changed = a.http_status === undefined || b.http_status === undefined
113
+ ? null : a.http_status !== b.http_status;
114
+ report.baseline.html_bytes = byteLength(a.html);
115
+ report.current.html_bytes = byteLength(b.html);
116
+ report.baseline.html_sha256 = a.html ? await digest(a.html) : null;
117
+ report.current.html_sha256 = b.html ? await digest(b.html) : null;
118
+ report.html_fingerprint_changed = report.baseline.html_sha256 && report.current.html_sha256
119
+ ? report.baseline.html_sha256 !== report.current.html_sha256 : null;
120
+ const add = (code, severity, message) => {
121
+ report.total_findings++;
122
+ if (report.findings.length < MAX_CHANGE_FINDINGS)
123
+ report.findings.push({ code, severity, message });
124
+ };
125
+ if (report.http_status_changed)
126
+ add("status_changed", "warning", "Supplied HTTP status codes differ; check delivery and challenge behavior before interpreting content changes.");
127
+ if (report.time_order_ambiguous)
128
+ add("time_ambiguous", "info", "Observations share the same claimed instant, so chronological order cannot be independently resolved.");
129
+ if (a.http_status === undefined || b.http_status === undefined)
130
+ add("delivery_unverified", "info", "A supplied HTTP status is missing; HTML differences cannot verify production availability.");
131
+ if ((a.http_status !== undefined && a.http_status !== 200) ||
132
+ (b.http_status !== undefined && b.http_status !== 200) || !a.html.trim() || !b.html.trim()) {
133
+ report.status = "not_comparable";
134
+ add("delivery_not_comparable", "warning", "At least one observation has no confirmed successful HTML delivery; content and metadata changes are suppressed, not counted as repairs.");
135
+ report.findings_truncated = report.total_findings > report.findings.length;
136
+ return report;
137
+ }
138
+ const core = analyzeRawRendered({
139
+ page_url: input.page_url, raw_html: a.html, rendered_html: b.html,
140
+ });
141
+ const [before, after] = [extractExtra(a.html), extractExtra(b.html)];
142
+ report.baseline.main_words = core.raw.main_words;
143
+ report.current.main_words = core.rendered.main_words;
144
+ report.baseline.same_origin_link_targets = core.raw.same_origin_link_targets;
145
+ report.current.same_origin_link_targets = core.rendered.same_origin_link_targets;
146
+ report.baseline.title_present = core.raw.title_present;
147
+ report.current.title_present = core.rendered.title_present;
148
+ report.baseline.description_present = core.raw.description_present;
149
+ report.current.description_present = core.rendered.description_present;
150
+ report.baseline.h1_count = core.raw.h1_count;
151
+ report.current.h1_count = core.rendered.h1_count;
152
+ report.baseline.canonical_state = core.raw.canonicals;
153
+ report.current.canonical_state = core.rendered.canonicals;
154
+ report.baseline.noindex_declared = core.raw.noindex_declared;
155
+ report.current.noindex_declared = core.rendered.noindex_declared;
156
+ report.baseline.jsonld_blocks = core.raw.jsonld_blocks;
157
+ report.current.jsonld_blocks = core.rendered.jsonld_blocks;
158
+ report.baseline.sample_truncated = core.raw.sample_truncated || before.tooLong;
159
+ report.current.sample_truncated = core.rendered.sample_truncated || after.tooLong;
160
+ report.baseline.main_text_sha256 = before.normalizedMain === null ? null : await digest(before.normalizedMain);
161
+ report.current.main_text_sha256 = after.normalizedMain === null ? null : await digest(after.normalizedMain);
162
+ report.main_text_fingerprint_changed =
163
+ report.baseline.main_text_sha256 && report.current.main_text_sha256
164
+ ? report.baseline.main_text_sha256 !== report.current.main_text_sha256 : null;
165
+ report.title_changed = core.title_changed;
166
+ report.description_changed = before.desc !== after.desc;
167
+ report.h1_changed = core.h1_changed;
168
+ report.canonical_changed = core.canonical_changed;
169
+ report.robots_changed = before.robots !== after.robots;
170
+ report.noindex_added = !core.raw.noindex_declared && core.rendered.noindex_declared;
171
+ report.noindex_removed = core.raw.noindex_declared && !core.rendered.noindex_declared;
172
+ // V07 exposes a bounded vocabulary and link sample; do not present an
173
+ // incomplete sample as an exact before/after removal count.
174
+ const sampleIncomplete = report.baseline.sample_truncated || report.current.sample_truncated;
175
+ report.main_words_added = sampleIncomplete ? null : core.main_words_added;
176
+ report.main_words_removed = sampleIncomplete ? null : core.main_words_removed;
177
+ report.links_added = sampleIncomplete ? null : core.link_targets_added;
178
+ report.links_removed = sampleIncomplete ? null : core.link_targets_removed;
179
+ report.jsonld_blocks_changed = core.raw.jsonld_blocks !== core.rendered.jsonld_blocks;
180
+ const limited = sampleIncomplete;
181
+ report.status = report.time_order_ambiguous || limited ||
182
+ a.http_status === undefined || b.http_status === undefined ? "partial" : "comparable_snapshot";
183
+ if (limited)
184
+ add("extraction_limited", "warning", "Main text or link sampling was truncated; absence and count differences are incomplete evidence.");
185
+ if (report.noindex_added)
186
+ add("noindex_added", "warning", "A noindex directive appears in the later supplied HTML.");
187
+ if (report.noindex_removed)
188
+ add("noindex_removed", "info", "A noindex directive is absent in the later supplied HTML; search-engine indexing remains unverified.");
189
+ if (report.canonical_changed)
190
+ add("canonical_changed", "warning", "Canonical declaration differs between observations; selection by search engines is not verified.");
191
+ if (report.title_changed)
192
+ add("title_changed", "info", "The supplied page title changed.");
193
+ if (report.description_changed)
194
+ add("description_changed", "info", "The supplied meta description changed.");
195
+ if (report.h1_changed)
196
+ add("h1_changed", "info", "The supplied first H1 heading changed.");
197
+ if (report.robots_changed)
198
+ add("robots_changed", "warning", "The supplied robots or Googlebot meta directives changed.");
199
+ if (report.main_text_fingerprint_changed)
200
+ add("main_content_changed", "info", "Normalized sampled main content changed; inspect authorized source versions for significance.");
201
+ if (report.links_added || report.links_removed)
202
+ add("links_changed", "info", "The bounded same-origin link target set changed.");
203
+ if (report.jsonld_blocks_changed)
204
+ add("jsonld_changed", "info", "The number of JSON-LD script blocks changed; schema validity is not established.");
205
+ if (report.html_fingerprint_changed && report.main_text_fingerprint_changed === false &&
206
+ !report.title_changed && !report.description_changed && !report.h1_changed &&
207
+ !report.canonical_changed && !report.robots_changed &&
208
+ !report.links_added && !report.links_removed && !report.jsonld_blocks_changed) {
209
+ add("html_only_changed", "info", "Exact HTML bytes changed while the selected content and metadata signals remained stable.");
210
+ }
211
+ report.findings_truncated = report.total_findings > report.findings.length;
212
+ return report;
213
+ }
214
+ //# sourceMappingURL=production-change-comparison.js.map
@@ -0,0 +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,E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F,IAAI,MAAM,CAAC,mBAAmB;QAAE,GAAG,CAAC,qBAAqB,EAAE,MAAM,EAC/D,wCAAwC,CAAC,CAAC;IAC5C,IAAI,MAAM,CAAC,UAAU;QAAE,GAAG,CAAC,YAAY,EAAE,MAAM,EAC7C,wCAAwC,CAAC,CAAC;IAC5C,IAAI,MAAM,CAAC,cAAc;QAAE,GAAG,CAAC,gBAAgB,EAAE,SAAS,EACxD,2DAA2D,CAAC,CAAC;IAC/D,IAAI,MAAM,CAAC,6BAA6B;QAAE,GAAG,CAAC,sBAAsB,EAAE,MAAM,EAC1E,+FAA+F,CAAC,CAAC;IACnG,IAAI,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,aAAa;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"]}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * P2-02 manual-only dry-run regression monitoring and optional alert PREVIEWS.
3
+ *
4
+ * The caller obtains a validated historical audit review via P2-01 first.
5
+ * This pure evaluator has no browser/network/storage/scheduler/notification API.
6
+ * A candidate is advice to review a comparable sampled-page observation;
7
+ * it is NEVER delivered or interpreted as a site-wide/Google metric signal.
8
+ */
9
+ import type { HistoricalReview } from "./historical-comparisons.js";
10
+ export declare const MONITOR_RULES: readonly ["regressed_pages", "net_error_increase", "net_warning_increase", "coverage_loss", "sitemap_drift"];
11
+ export type MonitorRule = typeof MONITOR_RULES[number];
12
+ export declare const MONITOR_DECISIONS: readonly ["preview_candidate", "review_only", "suppressed", "below_threshold", "disabled"];
13
+ export type MonitorDecision = typeof MONITOR_DECISIONS[number];
14
+ export declare const MONITOR_STATUSES: readonly ["preview_ready", "review_only", "no_candidate", "insufficient_evidence"];
15
+ export type MonitorStatus = typeof MONITOR_STATUSES[number];
16
+ export declare const MONITOR_REASON_CODES: readonly ["threshold_met", "threshold_not_met", "rule_disabled", "incomplete_latest_pair", "ambiguous_version_order", "insufficient_streak_history", "regression_streak_not_met", "observed_validator_coverage_loss", "observed_sitemap_drift", "not_enough_observed_comparisons"];
17
+ export type MonitorReasonCode = typeof MONITOR_REASON_CODES[number];
18
+ export interface MonitorPolicyInput {
19
+ min_regressed_pages?: number;
20
+ min_net_error_increase?: number;
21
+ min_net_warning_increase?: number;
22
+ min_coverage_lost_pages?: number;
23
+ consecutive_regressing_steps?: number;
24
+ review_coverage_loss?: boolean;
25
+ review_sitemap_drift?: boolean;
26
+ }
27
+ export interface MonitorPolicy {
28
+ min_regressed_pages: number;
29
+ min_net_error_increase: number;
30
+ min_net_warning_increase: number;
31
+ min_coverage_lost_pages: number;
32
+ consecutive_regressing_steps: number;
33
+ review_coverage_loss: boolean;
34
+ review_sitemap_drift: boolean;
35
+ }
36
+ export declare const DEFAULT_MONITOR_POLICY: Readonly<MonitorPolicy>;
37
+ export interface MonitorRuleResult {
38
+ rule: MonitorRule;
39
+ decision: MonitorDecision;
40
+ reason_code: MonitorReasonCode;
41
+ latest_observed_value: number;
42
+ threshold: number;
43
+ review_required: boolean;
44
+ message: string;
45
+ }
46
+ export interface MonitorPreview {
47
+ scope: "manual_sampled_regression_alert_preview_only";
48
+ source: "local_saved_ids" | "caller_supplied_snapshots";
49
+ status: MonitorStatus;
50
+ dry_run: true;
51
+ manually_invoked: true;
52
+ scheduler_enabled: false;
53
+ delivery_enabled: false;
54
+ notifications_sent: 0;
55
+ external_integrations_used: false;
56
+ latest_baseline_version: number;
57
+ latest_current_version: number;
58
+ latest_comparability: "comparable_sample" | "partial" | "not_comparable";
59
+ latest_compared_pages: number;
60
+ latest_completed_pairs: number;
61
+ candidate_count: number;
62
+ review_only_count: number;
63
+ suppressed_count: number;
64
+ coverage_limited: true;
65
+ policy: MonitorPolicy;
66
+ rules: MonitorRuleResult[];
67
+ limitations: string[];
68
+ error?: string;
69
+ }
70
+ /** Enforce a small, explicit policy with no arbitrary scripts, URLs or destinations. */
71
+ export declare function normalizeMonitorPolicy(input?: MonitorPolicyInput): MonitorPolicy;
72
+ export declare function emptyMonitorPreview(source: MonitorPreview["source"], policy?: MonitorPolicy): MonitorPreview;
73
+ export declare function previewRegressionAlerts(review: HistoricalReview, input?: MonitorPolicyInput): MonitorPreview;