compass-kb-validation 4.7.0__tar.gz → 4.9.0__tar.gz

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 (267) hide show
  1. {compass_kb_validation-4.7.0/compass_kb_validation.egg-info → compass_kb_validation-4.9.0}/PKG-INFO +74 -3
  2. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/README.md +73 -2
  3. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/__init__.py +1 -1
  4. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/baseline.py +1 -1
  5. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/chunk_integrity.py +21 -9
  6. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/cli.py +62 -14
  7. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/config/__init__.py +1 -1
  8. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/config_lint.py +4 -0
  9. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/content_fidelity.py +461 -43
  10. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/contracts.py +4 -2
  11. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/corpus.py +1 -1
  12. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/corpus_health.py +8 -3
  13. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/cross_check.py +219 -41
  14. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/findings.py +31 -10
  15. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/gate.py +4 -2
  16. compass_kb_validation-4.9.0/compass/layout_match.py +301 -0
  17. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/mcp_server.py +18 -4
  18. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/metadata_checks.py +5 -0
  19. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/mock_kb.py +216 -15
  20. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/models/__init__.py +25 -15
  21. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/notifications.py +1 -1
  22. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/pipeline/__init__.py +18 -1
  23. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/policy.py +169 -4
  24. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/presence.py +9 -2
  25. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/providers/__init__.py +24 -3
  26. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/providers/graph.py +12 -0
  27. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/providers/source.py +5 -5
  28. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/providers/storage.py +51 -11
  29. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/providers/vectorstore.py +141 -30
  30. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/readiness.py +65 -6
  31. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/remediation.py +4 -0
  32. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/report/__init__.py +598 -146
  33. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/report/_report_css.py +11 -0
  34. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/report/_report_js.py +56 -19
  35. compass_kb_validation-4.9.0/compass/report/_tooltip.py +98 -0
  36. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/report/analysis.py +1 -12
  37. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/report/fidelity_view.py +74 -6
  38. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/report/grounding_report.py +1 -1
  39. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/report/shell.py +3 -1
  40. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/structure_checks.py +17 -20
  41. compass_kb_validation-4.9.0/compass/text_match.py +227 -0
  42. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/trend_tracker.py +4 -3
  43. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/triage.py +19 -0
  44. compass_kb_validation-4.9.0/compass/utils/__init__.py +207 -0
  45. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/validators/cross_stage.py +1 -1
  46. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/validators/redis_chunks.py +19 -3
  47. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0/compass_kb_validation.egg-info}/PKG-INFO +74 -3
  48. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass_kb_validation.egg-info/SOURCES.txt +8 -0
  49. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/discover_and_validate.py +132 -40
  50. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/run_validation.py +17 -10
  51. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_alt_adapters.py +24 -1
  52. compass_kb_validation-4.9.0/tests/test_backlog_hygiene.py +125 -0
  53. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_coverage.py +17 -0
  54. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_fidelity_precision.py +1 -1
  55. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_grounding_report.py +1 -1
  56. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_migration.py +21 -0
  57. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_neptune_bugfixes2.py +1 -1
  58. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_redis_chunks.py +1 -1
  59. compass_kb_validation-4.9.0/tests/test_report_layout_review.py +170 -0
  60. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_reporting.py +9 -9
  61. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v402_fixes.py +1 -1
  62. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v420_gate.py +1 -1
  63. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v420_report_truth.py +6 -5
  64. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v430_fidelity.py +1 -1
  65. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v430_report.py +1 -1
  66. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v440_fidelity.py +2 -2
  67. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v440_outcomes.py +8 -5
  68. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v450_trends.py +1 -1
  69. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_contracts.py +1 -1
  70. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_crosscheck.py +4 -3
  71. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_fidelity.py +2 -2
  72. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_setup.py +4 -0
  73. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v470_cases.py +9 -5
  74. compass_kb_validation-4.9.0/tests/test_v480_cases.py +299 -0
  75. compass_kb_validation-4.9.0/tests/test_v490_addendum.py +422 -0
  76. compass_kb_validation-4.9.0/tests/test_v490_cases.py +594 -0
  77. compass_kb_validation-4.9.0/tests/test_v490_qdrant.py +128 -0
  78. compass_kb_validation-4.9.0/tests/test_v490_tooltips.py +88 -0
  79. compass_kb_validation-4.7.0/compass/layout_match.py +0 -188
  80. compass_kb_validation-4.7.0/compass/text_match.py +0 -104
  81. compass_kb_validation-4.7.0/compass/utils/__init__.py +0 -108
  82. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/LICENSE +0 -0
  83. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/__main__.py +0 -0
  84. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/acceptance.py +0 -0
  85. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/alias.py +0 -0
  86. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/ask.py +0 -0
  87. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/auth.py +0 -0
  88. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/benchmark.py +0 -0
  89. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/check_catalog.py +0 -0
  90. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/check_outcome.py +0 -0
  91. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/chunk_coherence.py +0 -0
  92. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/chunk_eval.py +0 -0
  93. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/chunk_ref.py +0 -0
  94. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/citation.py +0 -0
  95. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/content_inspect.py +0 -0
  96. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/cross_index.py +0 -0
  97. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/diagnostics.py +0 -0
  98. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/diff.py +0 -0
  99. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/drift.py +0 -0
  100. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/embedding_drift.py +0 -0
  101. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/eval_enrich.py +0 -0
  102. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/eval_interop.py +0 -0
  103. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/evidence.py +0 -0
  104. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/fixture_export.py +0 -0
  105. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/fixture_suite.py +0 -0
  106. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/graph_probe.py +0 -0
  107. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/grounding.py +0 -0
  108. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/grounding_diff.py +0 -0
  109. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/grounding_rollup.py +0 -0
  110. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/gt_lint.py +0 -0
  111. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/health.py +0 -0
  112. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/incremental.py +0 -0
  113. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/init_wizard.py +0 -0
  114. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/line_shapes.py +0 -0
  115. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/lineage.py +0 -0
  116. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/live_dashboard.py +0 -0
  117. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/manifest.py +0 -0
  118. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/normalise.py +0 -0
  119. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/passage_probe.py +0 -0
  120. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/pdf_support.py +0 -0
  121. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/privacy.py +0 -0
  122. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/profiler.py +0 -0
  123. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/provenance.py +0 -0
  124. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/providers/embedding.py +0 -0
  125. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/providers/extractor.py +0 -0
  126. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/providers/markers.py +0 -0
  127. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/providers/snapshot.py +0 -0
  128. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/quality_gate.py +0 -0
  129. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/question_set.py +0 -0
  130. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/remediation_manifest.py +0 -0
  131. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/report/audit.py +0 -0
  132. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/report/export.py +0 -0
  133. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/retrieval_analysis.py +0 -0
  134. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/retrieval_diagnosis.py +0 -0
  135. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/simulate.py +0 -0
  136. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/snapshot_doctor.py +0 -0
  137. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/text_probes.py +0 -0
  138. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/trend_analysis.py +0 -0
  139. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/validators/__init__.py +0 -0
  140. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/validators/api_upload.py +0 -0
  141. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/validators/base.py +0 -0
  142. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/validators/base_sparql.py +0 -0
  143. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/validators/graphdb_metadata.py +0 -0
  144. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/validators/metadata_checks.py +0 -0
  145. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/validators/neptune_metadata.py +0 -0
  146. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/validators/registry.py +0 -0
  147. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/validators/retrieval_quality.py +0 -0
  148. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass/validators/s3_storage.py +0 -0
  149. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass_kb_validation.egg-info/dependency_links.txt +0 -0
  150. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass_kb_validation.egg-info/entry_points.txt +0 -0
  151. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass_kb_validation.egg-info/requires.txt +0 -0
  152. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/compass_kb_validation.egg-info/top_level.txt +0 -0
  153. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/ingestion_validation/__init__.py +0 -0
  154. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/profile_kb.py +0 -0
  155. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/pyproject.toml +0 -0
  156. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/setup.cfg +0 -0
  157. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_alias.py +0 -0
  158. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_alias_disambiguation.py +0 -0
  159. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_alias_temporal.py +0 -0
  160. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_analysis_report.py +0 -0
  161. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_api_upload.py +0 -0
  162. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_ask.py +0 -0
  163. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_baseline.py +0 -0
  164. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_benchmark.py +0 -0
  165. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_calibrate_truth.py +0 -0
  166. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_check_catalog.py +0 -0
  167. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_chunk_eval.py +0 -0
  168. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_chunk_integrity.py +0 -0
  169. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_chunk_structure_checks.py +0 -0
  170. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_citation.py +0 -0
  171. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_citation_levels.py +0 -0
  172. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_cli.py +0 -0
  173. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_cli_commands.py +0 -0
  174. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_compat_shim.py +0 -0
  175. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_config.py +0 -0
  176. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_config_lint.py +0 -0
  177. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_content_fidelity.py +0 -0
  178. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_content_inspect.py +0 -0
  179. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_corpus.py +0 -0
  180. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_corpus_health.py +0 -0
  181. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_coverage_and_drift_config.py +0 -0
  182. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_cross_stage.py +0 -0
  183. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_diagnostics.py +0 -0
  184. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_diff.py +0 -0
  185. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_discover_cli.py +0 -0
  186. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_discovery_parallel.py +0 -0
  187. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_drift.py +0 -0
  188. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_embedding_contract.py +0 -0
  189. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_embedding_drift.py +0 -0
  190. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_eval_enrich.py +0 -0
  191. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_eval_interop.py +0 -0
  192. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_evidence.py +0 -0
  193. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_fixture_bundles.py +0 -0
  194. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_gate.py +0 -0
  195. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_graph_transport.py +0 -0
  196. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_graph_validators.py +0 -0
  197. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_grounding.py +0 -0
  198. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_grounding_rollup.py +0 -0
  199. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_health.py +0 -0
  200. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_incremental.py +0 -0
  201. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_init_wizard.py +0 -0
  202. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_lineage.py +0 -0
  203. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_local_store_scale.py +0 -0
  204. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_manifest.py +0 -0
  205. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_mcp.py +0 -0
  206. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_measurement_fixes.py +0 -0
  207. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_metadata_checks.py +0 -0
  208. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_models.py +0 -0
  209. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_multi_index.py +0 -0
  210. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_neptune_bugfixes.py +0 -0
  211. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_notifications.py +0 -0
  212. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_pipeline.py +0 -0
  213. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_profiler.py +0 -0
  214. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_providers.py +0 -0
  215. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_quality_gate.py +0 -0
  216. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_r1_overlap.py +0 -0
  217. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_readiness.py +0 -0
  218. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_registry.py +0 -0
  219. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_remediation.py +0 -0
  220. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_report_store_section.py +0 -0
  221. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_requirements_config.py +0 -0
  222. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_retrieval_assertions.py +0 -0
  223. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_retrieval_fields.py +0 -0
  224. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_retrieval_quality.py +0 -0
  225. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_review_hardening.py +0 -0
  226. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_run_cli.py +0 -0
  227. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_simulate.py +0 -0
  228. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_source_exclusions.py +0 -0
  229. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_source_verification.py +0 -0
  230. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_sources.py +0 -0
  231. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_storage_validator.py +0 -0
  232. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_structure_checks.py +0 -0
  233. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_synthetic_cases.py +0 -0
  234. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_tokenisers.py +0 -0
  235. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_tooling_420.py +0 -0
  236. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_trends.py +0 -0
  237. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_trends_paging.py +0 -0
  238. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_universal_concerns.py +0 -0
  239. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_utils.py +0 -0
  240. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v410_any_pipeline.py +0 -0
  241. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v410_gate.py +0 -0
  242. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v410_portability.py +0 -0
  243. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v421_report.py +0 -0
  244. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v430_gate.py +0 -0
  245. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v430_tooling.py +0 -0
  246. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v431_report.py +0 -0
  247. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v440_report_drift.py +0 -0
  248. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v440_structure.py +0 -0
  249. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v440_styles.py +0 -0
  250. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v440_trends.py +0 -0
  251. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_acceptance.py +0 -0
  252. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_fixture.py +0 -0
  253. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_gate_document.py +0 -0
  254. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_mock_kb.py +0 -0
  255. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_policy.py +0 -0
  256. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_policy_detection.py +0 -0
  257. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_policy_run.py +0 -0
  258. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_privacy.py +0 -0
  259. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_profiles.py +0 -0
  260. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_remediation.py +0 -0
  261. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_reporting.py +0 -0
  262. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_retrieval_diagnosis.py +0 -0
  263. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_runtime.py +0 -0
  264. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v460_verdicts.py +0 -0
  265. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_v4_defect_fixes.py +0 -0
  266. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_vector_fastpath.py +0 -0
  267. {compass_kb_validation-4.7.0 → compass_kb_validation-4.9.0}/tests/test_vectorstore_filters.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compass-kb-validation
3
- Version: 4.7.0
3
+ Version: 4.9.0
4
4
  Summary: Knowledge-base readiness validation for RAG & AI agents — config-driven, deterministic pipeline integrity checks.
5
5
  Author: COMPASS
6
6
  License: MIT
@@ -149,9 +149,78 @@ Two modes: **live** validation as documents are ingested, and **post-hoc discove
149
149
 
150
150
  > Scope note: COMPASS validates *pipeline & data integrity*. It does **not** judge answer quality — that's the evaluation layer's job. COMPASS is the gate that runs first.
151
151
 
152
+ ## What's new in 4.9
153
+
154
+ 4.9 fixes what a field run of 4.8 still got wrong and gives every run one verdict. Measured on the
155
+ offline mock knowledge bases (`compass mock-kb`) and on synthetic documents:
156
+
157
+ | Measure | 4.8.0 | 4.9 |
158
+ |---|---|---|
159
+ | Mock scorecards (custom, provider, Large): real losses found, false gates | as listed for 4.8 | identical; the new shapes (approximate values, hyphenated titles, cropped footnotes) read as intended |
160
+ | One 50-page document, 10% of lines lost: peak memory, time | 728 MB, 161 s | 257 MB, 26 s |
161
+ | One 400-page document, 10% of lines lost: peak memory, time | not measured | 763 MB, 148 s (`scripts/fidelity_memory_check.py`) |
162
+ | 502-document mock, full discover with fidelity, 8 workers (one 16 GB host, same session) | 59.1 min; 1 document failed on a memory error, 2 comparisons failed | 48.9 min; none |
163
+ | Qdrant (157-document KB, real embedded engine): documents validated | 150 | 157 |
164
+
165
+ **What reads differently**
166
+
167
+ - **One verdict per run.** With a readiness preset, the HTML badge, the readiness page, the JSON
168
+ `verdict`, the console and the exit code all give the preset's badge, with the numbers that
169
+ decided it ("READY WITH CONDITIONS: 0 blocked, 7 need review (4.5% of 157) ...") and what blocks.
170
+ The legacy verdict is shown once, for comparison. Opt-in `readiness.policy.retrieval_relief`.
171
+ - **Content verdicts.** An approximate value (`~20.6`) no longer takes a table row's `0.6`; a title
172
+ the sentence above writes hyphenated stays `table_title`; a cropped footnote and a logo wordmark
173
+ (in any annotation form, or misread by OCR) never gate.
174
+ - **A failed storage read is an error, never "not found".** A stale stored key finds its source by
175
+ ETag under the prefix, and the source checks run.
176
+ - **The summary names one weakest area**, the one the verdict rests on; hygiene is labelled
177
+ "advisory checks only".
178
+ - **Every hover uses the report's own tooltip**, charts included.
179
+
180
+ See the [CHANGELOG](CHANGELOG.md) for the upgrade table: under a preset discover's exit code follows
181
+ the badge, and the console's integrity line is now `Integrity:`.
182
+
183
+ ## What's new in 4.8
184
+
185
+ 4.8 fixes what a field run of 4.7 still got wrong, keeping every finding. Measured on the
186
+ offline mock knowledge bases (`compass mock-kb`) with the 4.8 planters, against 4.7.0 on the same
187
+ mocks:
188
+
189
+ | Mock KB | Real losses found (4.7.0 -> 4.8) | Documents gated without a loss | False gating lines | Unchanged values flagged (per value) |
190
+ |---|---|---|---|---|
191
+ | Reference, custom index | 32 -> 32 | 2 -> **0** | 2 -> **0** | 2 -> **0** (changed values found 1 -> **3 of 3**) |
192
+ | Reference, provider index | 10 of 10 -> 10 of 10 | 0 -> 0 | 0 -> 0 | 0 -> 0 |
193
+ | Large KB (50 documents) | 34 -> 34 | 0 -> 0 | 10 -> **0** (form questions in table rows) | 0 -> 0 |
194
+
195
+ Fidelity uses about 40% less CPU than 4.7.0 on the Large mock (paired runs, identical results),
196
+ for about 90 MB more peak memory per fidelity process (capped on the largest documents).
197
+
198
+ **What reads differently**
199
+
200
+ - **Table rows are judged cell by cell.** A line whose words sit in the cells of one stored row
201
+ is stored, layout differs; a table title whose words are in the sentence above stays lost.
202
+ - **The cross-check confirms `lost` only when a word of the line is missing from its page.**
203
+ Every word on the page, in another order, is `unresolved`: still gating under the legacy
204
+ verdict, NEEDS REVIEW under a preset.
205
+ - **A chart read as a table** (an evenly spaced scale in a cell) is a figure, tier low.
206
+ - **`overall` says `PARTLY_VERIFIED`** where the headline does; readiness findings are counted as
207
+ KB-level.
208
+
209
+ ### Upgrading from 4.7.0: what changes by default
210
+
211
+ | Change | Why | To keep 4.7.0 |
212
+ |---|---|---|
213
+ | JSON `overall` is `PARTLY_VERIFIED` for a document where a check could not run while others did; schemas `compass-run/2`, `compass-discovery/2` | The headline said partly verified, the JSON `NOT_CHECKED` | match both values where you matched `NOT_CHECKED` |
214
+ | Cross-check `lost` needs a word missing from the page +-1; else `unresolved` | Lines with every word on the page were confirmed lost | none; both gate under the legacy verdict |
215
+ | A stored Markdown row is judged cell by cell | Form questions in a row's cells gated as lost | none needed |
216
+ | An axis scale in a table cell is kind `figure`, tier low | Chart labels gated as table text | raise `figure` in `eval.fidelity.tiers` |
217
+ | Readiness findings line: "N readiness finding(s) (KB-level)" | Stage names were counted as documents | none; finding ids are unchanged |
218
+
219
+ Exit codes are unchanged.
220
+
152
221
  ## What's new in 4.7
153
222
 
154
- 4.7 keeps what 4.6 finds and fixes what a design partner's 4.6 run got wrong: false content-loss
223
+ 4.7 keeps what 4.6 finds and fixes what a field run of 4.6 got wrong: false content-loss
155
224
  findings, counts that did not add up, and runs where one stage could not answer. Measured on the
156
225
  offline mock knowledge bases (`compass mock-kb`) with the 4.7 planters, against 4.6.0 on the same
157
226
  mocks:
@@ -202,7 +271,7 @@ Exit codes are unchanged.
202
271
  ## What's new in 4.6
203
272
 
204
273
  4.6 keeps what 4.5.1 finds and removes what it found wrongly. Measured on offline mock knowledge
205
- bases built from a design partner's measured shapes (`compass mock-kb`), against 4.5.1 with the
274
+ bases built from measured production shapes (`compass mock-kb`), against 4.5.1 with the
206
275
  same configuration:
207
276
 
208
277
  | Mock KB | Real losses found (4.5.1 -> 4.6) | Documents gated without a loss | False gating lines |
@@ -457,6 +526,8 @@ eval:
457
526
  lost_passages_allowed: 0 # named lost passages tolerated (snapshot baseline)
458
527
  figure_words: gate # gate | report: lost words inside figures gate or not
459
528
  figure_match: words # words | run: a figure's label line is matched word by word
529
+ locate_sample: false # true: faster chunk integrity and structure checks by a
530
+ # sampled locate; their advisory counts can move slightly
460
531
  presence: # how a line is judged present (one test for everything)
461
532
  unit: line # each line on its own; lines are never joined
462
533
  match: tokens # tokens (default for a snapshot) | chars (for a text layer)
@@ -72,9 +72,78 @@ Two modes: **live** validation as documents are ingested, and **post-hoc discove
72
72
 
73
73
  > Scope note: COMPASS validates *pipeline & data integrity*. It does **not** judge answer quality — that's the evaluation layer's job. COMPASS is the gate that runs first.
74
74
 
75
+ ## What's new in 4.9
76
+
77
+ 4.9 fixes what a field run of 4.8 still got wrong and gives every run one verdict. Measured on the
78
+ offline mock knowledge bases (`compass mock-kb`) and on synthetic documents:
79
+
80
+ | Measure | 4.8.0 | 4.9 |
81
+ |---|---|---|
82
+ | Mock scorecards (custom, provider, Large): real losses found, false gates | as listed for 4.8 | identical; the new shapes (approximate values, hyphenated titles, cropped footnotes) read as intended |
83
+ | One 50-page document, 10% of lines lost: peak memory, time | 728 MB, 161 s | 257 MB, 26 s |
84
+ | One 400-page document, 10% of lines lost: peak memory, time | not measured | 763 MB, 148 s (`scripts/fidelity_memory_check.py`) |
85
+ | 502-document mock, full discover with fidelity, 8 workers (one 16 GB host, same session) | 59.1 min; 1 document failed on a memory error, 2 comparisons failed | 48.9 min; none |
86
+ | Qdrant (157-document KB, real embedded engine): documents validated | 150 | 157 |
87
+
88
+ **What reads differently**
89
+
90
+ - **One verdict per run.** With a readiness preset, the HTML badge, the readiness page, the JSON
91
+ `verdict`, the console and the exit code all give the preset's badge, with the numbers that
92
+ decided it ("READY WITH CONDITIONS: 0 blocked, 7 need review (4.5% of 157) ...") and what blocks.
93
+ The legacy verdict is shown once, for comparison. Opt-in `readiness.policy.retrieval_relief`.
94
+ - **Content verdicts.** An approximate value (`~20.6`) no longer takes a table row's `0.6`; a title
95
+ the sentence above writes hyphenated stays `table_title`; a cropped footnote and a logo wordmark
96
+ (in any annotation form, or misread by OCR) never gate.
97
+ - **A failed storage read is an error, never "not found".** A stale stored key finds its source by
98
+ ETag under the prefix, and the source checks run.
99
+ - **The summary names one weakest area**, the one the verdict rests on; hygiene is labelled
100
+ "advisory checks only".
101
+ - **Every hover uses the report's own tooltip**, charts included.
102
+
103
+ See the [CHANGELOG](CHANGELOG.md) for the upgrade table: under a preset discover's exit code follows
104
+ the badge, and the console's integrity line is now `Integrity:`.
105
+
106
+ ## What's new in 4.8
107
+
108
+ 4.8 fixes what a field run of 4.7 still got wrong, keeping every finding. Measured on the
109
+ offline mock knowledge bases (`compass mock-kb`) with the 4.8 planters, against 4.7.0 on the same
110
+ mocks:
111
+
112
+ | Mock KB | Real losses found (4.7.0 -> 4.8) | Documents gated without a loss | False gating lines | Unchanged values flagged (per value) |
113
+ |---|---|---|---|---|
114
+ | Reference, custom index | 32 -> 32 | 2 -> **0** | 2 -> **0** | 2 -> **0** (changed values found 1 -> **3 of 3**) |
115
+ | Reference, provider index | 10 of 10 -> 10 of 10 | 0 -> 0 | 0 -> 0 | 0 -> 0 |
116
+ | Large KB (50 documents) | 34 -> 34 | 0 -> 0 | 10 -> **0** (form questions in table rows) | 0 -> 0 |
117
+
118
+ Fidelity uses about 40% less CPU than 4.7.0 on the Large mock (paired runs, identical results),
119
+ for about 90 MB more peak memory per fidelity process (capped on the largest documents).
120
+
121
+ **What reads differently**
122
+
123
+ - **Table rows are judged cell by cell.** A line whose words sit in the cells of one stored row
124
+ is stored, layout differs; a table title whose words are in the sentence above stays lost.
125
+ - **The cross-check confirms `lost` only when a word of the line is missing from its page.**
126
+ Every word on the page, in another order, is `unresolved`: still gating under the legacy
127
+ verdict, NEEDS REVIEW under a preset.
128
+ - **A chart read as a table** (an evenly spaced scale in a cell) is a figure, tier low.
129
+ - **`overall` says `PARTLY_VERIFIED`** where the headline does; readiness findings are counted as
130
+ KB-level.
131
+
132
+ ### Upgrading from 4.7.0: what changes by default
133
+
134
+ | Change | Why | To keep 4.7.0 |
135
+ |---|---|---|
136
+ | JSON `overall` is `PARTLY_VERIFIED` for a document where a check could not run while others did; schemas `compass-run/2`, `compass-discovery/2` | The headline said partly verified, the JSON `NOT_CHECKED` | match both values where you matched `NOT_CHECKED` |
137
+ | Cross-check `lost` needs a word missing from the page +-1; else `unresolved` | Lines with every word on the page were confirmed lost | none; both gate under the legacy verdict |
138
+ | A stored Markdown row is judged cell by cell | Form questions in a row's cells gated as lost | none needed |
139
+ | An axis scale in a table cell is kind `figure`, tier low | Chart labels gated as table text | raise `figure` in `eval.fidelity.tiers` |
140
+ | Readiness findings line: "N readiness finding(s) (KB-level)" | Stage names were counted as documents | none; finding ids are unchanged |
141
+
142
+ Exit codes are unchanged.
143
+
75
144
  ## What's new in 4.7
76
145
 
77
- 4.7 keeps what 4.6 finds and fixes what a design partner's 4.6 run got wrong: false content-loss
146
+ 4.7 keeps what 4.6 finds and fixes what a field run of 4.6 got wrong: false content-loss
78
147
  findings, counts that did not add up, and runs where one stage could not answer. Measured on the
79
148
  offline mock knowledge bases (`compass mock-kb`) with the 4.7 planters, against 4.6.0 on the same
80
149
  mocks:
@@ -125,7 +194,7 @@ Exit codes are unchanged.
125
194
  ## What's new in 4.6
126
195
 
127
196
  4.6 keeps what 4.5.1 finds and removes what it found wrongly. Measured on offline mock knowledge
128
- bases built from a design partner's measured shapes (`compass mock-kb`), against 4.5.1 with the
197
+ bases built from measured production shapes (`compass mock-kb`), against 4.5.1 with the
129
198
  same configuration:
130
199
 
131
200
  | Mock KB | Real losses found (4.5.1 -> 4.6) | Documents gated without a loss | False gating lines |
@@ -380,6 +449,8 @@ eval:
380
449
  lost_passages_allowed: 0 # named lost passages tolerated (snapshot baseline)
381
450
  figure_words: gate # gate | report: lost words inside figures gate or not
382
451
  figure_match: words # words | run: a figure's label line is matched word by word
452
+ locate_sample: false # true: faster chunk integrity and structure checks by a
453
+ # sampled locate; their advisory counts can move slightly
383
454
  presence: # how a line is judged present (one test for everything)
384
455
  unit: line # each line on its own; lines are never joined
385
456
  match: tokens # tokens (default for a snapshot) | chars (for a text layer)
@@ -5,7 +5,7 @@ end-to-end: API upload -> object storage -> knowledge graph -> vector store ->
5
5
  retrieval quality, plus cross-store consistency.
6
6
  """
7
7
 
8
- __version__ = "4.7.0"
8
+ __version__ = "4.9.0"
9
9
 
10
10
 
11
11
  def gate_document(settings, document_id, **kwargs):
@@ -28,7 +28,7 @@ def _doc_status(result: Any) -> str:
28
28
  if result.all_passed:
29
29
  return "PASSED"
30
30
  # Not checked is neither: it can be neither a regression nor a recovery.
31
- return "NOT_CHECKED" if result.overall == "NOT_CHECKED" else "FAILED"
31
+ return "NOT_CHECKED" if result.overall in ("PARTLY_VERIFIED", "NOT_CHECKED") else "FAILED"
32
32
 
33
33
 
34
34
  def _hard_failed_checks(result: Any) -> list[str]:
@@ -33,7 +33,7 @@ from itertools import chain
33
33
  from dataclasses import dataclass
34
34
  from typing import Any, Optional
35
35
 
36
- from compass.text_match import grams, normalize
36
+ from compass.text_match import grams, normalize, sampled_grams
37
37
 
38
38
  TRACED = "TRACED"
39
39
  WRONG_PAGE = "WRONG_PAGE"
@@ -110,12 +110,23 @@ class _Source:
110
110
 
111
111
  def __init__(self, pages: list[str], body_pages: list[str], figures_of: Any):
112
112
  self.texts = [normalize(p) for p in pages]
113
- self.where: dict[str, list[int]] = {}
113
+ # unit -> the pages holding it, in order. Built with set operations (4.8.0 R1): most
114
+ # units are on one page and are recorded in bulk; only those on several are listed.
115
+ # Page by page against the index's own keys (M1, 4.9.0): every page's unit set, and a set
116
+ # of every unit seen, were held at once beside the index, three copies of the document.
117
+ self.where: dict[str, tuple] = {}
118
+ many: dict[str, list[int]] = {}
114
119
  wording: set[str] = set()
115
120
  for number, text in enumerate(self.texts, 1):
116
- for unit in grams(text, _LOCATE_K):
117
- self.where.setdefault(unit, []).append(number)
118
- wording.update(grams(text, _WORDING_K))
121
+ units = sampled_grams(text, _LOCATE_K)
122
+ again = self.where.keys() & units
123
+ for unit in again:
124
+ if unit not in many:
125
+ many[unit] = list(self.where[unit])
126
+ many[unit].append(number)
127
+ self.where.update(dict.fromkeys(units - again if again else units, (number,)))
128
+ wording.update(sampled_grams(text, _WORDING_K))
129
+ self.where.update({unit: tuple(numbers) for unit, numbers in many.items()})
119
130
  self.wording = wording
120
131
  self.blank = {n for n, t in enumerate(self.texts, 1) if len(t) < 8}
121
132
  # Where each source line ends. What follows a passage is only known within a line: past
@@ -250,7 +261,7 @@ def _generated_shares(rows: list[dict], source: _Source, split_table: Any) -> li
250
261
  dropped = 0
251
262
  for piece in pieces:
252
263
  norm = normalize(piece)
253
- units = grams(norm, _WORDING_K) if len(norm) >= _MIN_CHARS else frozenset()
264
+ units = sampled_grams(norm, _WORDING_K) if len(norm) >= _MIN_CHARS else frozenset()
254
265
  if units and len(units & source.wording) / len(units) < _UNTRACEABLE_BELOW:
255
266
  dropped += len(piece)
256
267
  else:
@@ -277,8 +288,8 @@ def _locate(chunk: dict, raw: str, split_table: Any, source: _Source, names: Fie
277
288
  row["prose"] = prose
278
289
  if len(prose) >= _MIN_CHARS:
279
290
  # Gathered, then counted once at C speed (R1): the same hits as a Counter update per unit.
280
- where = source.where
281
- found = [at for at in (where.get(unit) for unit in grams(prose, _LOCATE_K)) if at]
291
+ # C-level map and filter (4.8.0 R1): the pages of every unit some page holds.
292
+ found = list(filter(None, map(source.where.get, sampled_grams(prose, _LOCATE_K))))
282
293
  row["located"] = len(found)
283
294
  row["hits"] = Counter(chain.from_iterable(found))
284
295
  return row
@@ -293,7 +304,8 @@ def _judge(row: dict, source: _Source, stored_units: frozenset, figures_of: Any,
293
304
  low = row["stated"] + shift - tolerance
294
305
  stated = set(range(low, row["stated_end"] + shift + tolerance + 1))
295
306
  drawn = {p for p, n in row["hits"].items() if row["located"] and n / row["located"] >= _PAGE_SHARE}
296
- units = grams(row["prose"], _WORDING_K) if len(row["prose"]) >= _MIN_CHARS else frozenset()
307
+ units = (sampled_grams(row["prose"], _WORDING_K) if len(row["prose"]) >= _MIN_CHARS
308
+ else frozenset())
297
309
  share = len(units & source.wording) / len(units) if units else None
298
310
 
299
311
  if share is not None and share < _UNTRACEABLE_BELOW:
@@ -1256,8 +1256,9 @@ def cmd_migrate(argv: list[str]) -> int:
1256
1256
  except Exception as exc: # noqa: BLE001 - malformed/empty project YAML -> clean message, not a traceback
1257
1257
  print(f" Config error: {exc}")
1258
1258
  return 2
1259
+ # Progress on stderr: stdout carries only the result, so --json pipes cleanly (4.9.0).
1259
1260
  print(f" Sampling up to {args.sample} chunks and re-embedding with {args.to} "
1260
- f"(calls the candidate embedding API per chunk) ...")
1261
+ f"(calls the candidate embedding API per chunk) ...", file=sys.stderr)
1261
1262
  try:
1262
1263
  payload = migration_report(settings, provider, model, sample=args.sample,
1263
1264
  top_k=args.top_k, dimensions=args.dimensions)
@@ -1429,7 +1430,8 @@ def cmd_coverage(argv: list[str]) -> int:
1429
1430
  if filters and not _supports_filters(settings.redis.provider):
1430
1431
  print(f" Note: the '{settings.redis.provider}' backend cannot pre-filter KNN; "
1431
1432
  f"--filter is ignored and results are unfiltered.", file=sys.stderr)
1432
- print(f" Embedding {len(questions)} question(s) and probing top-{args.top_k} against the index ...")
1433
+ print(f" Embedding {len(questions)} question(s) and probing top-{args.top_k} against the index ...",
1434
+ file=sys.stderr)
1433
1435
  try:
1434
1436
  payload = coverage_report(settings, questions, top_k=args.top_k,
1435
1437
  universe=args.universe, filters=filters)
@@ -1662,7 +1664,7 @@ def cmd_evidence(argv: list[str]) -> int:
1662
1664
  limit = 1 if args.quick else (args.limit or settings.evidence.sample_size)
1663
1665
 
1664
1666
  print(f" compass evidence - project={args.project or '(none)'} checks={checks} limit={limit}",
1665
- file=sys.stderr if args.format == "json" else sys.stdout)
1667
+ file=sys.stderr)
1666
1668
  try:
1667
1669
  payload = ev.gather_evidence(settings, checks, document_filter=args.document, limit=limit)
1668
1670
  except Exception as exc: # noqa: BLE001 - unreachable/misconfigured backend -> clean message
@@ -1694,7 +1696,8 @@ def cmd_evidence(argv: list[str]) -> int:
1694
1696
  counts[r.verdict] = counts.get(r.verdict, 0) + 1
1695
1697
  print(f" {payload['docs_probed']} doc(s) probed - "
1696
1698
  f"CONFIRMED {counts.get('CONFIRMED', 0)}, WEAK {counts.get('WEAK', 0)}, "
1697
- f"not reproduced {counts.get('NOT_REPRODUCED', 0)}, errors {counts.get('ERROR', 0)}")
1699
+ f"not reproduced {counts.get('NOT_REPRODUCED', 0)}, errors {counts.get('ERROR', 0)}",
1700
+ file=sys.stderr)
1698
1701
  return 0
1699
1702
 
1700
1703
 
@@ -1885,16 +1888,43 @@ def _source_page_reader(settings):
1885
1888
  _last_body: dict = {}
1886
1889
  _why: dict = {"text": ""}
1887
1890
 
1891
+ _listing: dict = {}
1892
+
1893
+ def _by_name() -> dict:
1894
+ """The source prefix's objects by file name, listed once per reader (per process)."""
1895
+ if "names" not in _listing:
1896
+ try:
1897
+ objects = storage.list(getattr(settings.s3, "prefix", "") or "")
1898
+ except Exception: # noqa: BLE001 - no listing: nothing located now; asked again
1899
+ return {} # next time, so one dropped connection does not last the run
1900
+ names: dict = {}
1901
+ for o in objects or []:
1902
+ key = str(o.get("key") or "")
1903
+ names.setdefault(key.rsplit("/", 1)[-1], []).append(
1904
+ {"key": key, "etag": str(o.get("etag") or "").strip('"')})
1905
+ _listing["names"] = names
1906
+ return _listing["names"]
1907
+
1888
1908
  def _locate(file_name: str, limit: int = 5) -> list[dict]:
1889
1909
  """Objects whose key ends in ``file_name``: where a source went when its key is stale."""
1890
1910
  if not file_name:
1891
1911
  return []
1892
- try:
1893
- found = [o for o in storage.list(getattr(settings.s3, "prefix", "") or "")
1894
- if o.get("key", "").rsplit("/", 1)[-1] == file_name]
1895
- except Exception: # noqa: BLE001 - a hint for the reason line only
1896
- return []
1897
- return [{"key": o["key"], "etag": o.get("etag", "")} for o in found[:limit]]
1912
+ return list(_by_name().get(file_name, []))[:limit]
1913
+
1914
+ def _resolve(key: str, version: str = "") -> tuple[str, str]:
1915
+ """``(key, how)`` of the source when the stored key is stale (S1, 4.9.0), else ``("", "")``.
1916
+
1917
+ Looked up by file name under the configured prefix. With a stored version (ETag), only an
1918
+ object with that ETag is the source: another one is a different version, and comparing
1919
+ with it would report the change as a loss. Without one, a single object of that name.
1920
+ """
1921
+ name = (key or "").rsplit("/", 1)[-1]
1922
+ found = [o for o in _by_name().get(name, []) if o["key"] != key]
1923
+ version = str(version or "").strip('"')
1924
+ if version:
1925
+ same = [o for o in found if o["etag"] == version]
1926
+ return (same[0]["key"], "ETag") if same else ("", "")
1927
+ return (found[0]["key"], "file name") if len(found) == 1 else ("", "")
1898
1928
 
1899
1929
  def _bytes(key: str) -> Optional[bytes]:
1900
1930
  """The source's bytes, from the page read just before it: downloaded once per document."""
@@ -1903,6 +1933,7 @@ def _source_page_reader(settings):
1903
1933
  _pages.source_bytes = _bytes # type: ignore[attr-defined]
1904
1934
  _pages.last_reason = lambda: _why["text"] # type: ignore[attr-defined]
1905
1935
  _pages.locate = _locate # type: ignore[attr-defined]
1936
+ _pages.resolve = _resolve # type: ignore[attr-defined]
1906
1937
  return _pages
1907
1938
 
1908
1939
 
@@ -2671,11 +2702,11 @@ def cmd_fidelity(argv: list[str]) -> int:
2671
2702
  # One count per fact: the page, readiness and discover read the counts settled by triage.
2672
2703
  try:
2673
2704
  from compass.findings import settled_fidelity
2674
- from compass.triage import triage_for
2705
+ from compass.triage import attach_integrity_precision, triage_for
2675
2706
 
2676
- report["settled"] = settled_fidelity(
2677
- report, triage_for(settings, override=getattr(args, "triage", "") or ""),
2678
- index=report["index"])
2707
+ _triage = triage_for(settings, override=getattr(args, "triage", "") or "")
2708
+ report["settled"] = settled_fidelity(report, _triage, index=report["index"])
2709
+ attach_integrity_precision(report, _triage)
2679
2710
  except Exception as exc: # noqa: BLE001 - the page falls back to untriaged counts
2680
2711
  report["rule_errors"].append(f"fidelity counts were not settled by triage: {exc}")
2681
2712
  report["show_nongating"] = str((getattr(settings.eval, "fidelity", None) or {})
@@ -3366,6 +3397,12 @@ def _apply_policy_layer(report: dict, artifacts: dict, settings: Any, args: Any)
3366
3397
  layer = evaluate(discovery, fidelity, active)
3367
3398
  report["policy_layer"] = layer
3368
3399
  report["exit_code"] = layer["exit_code"]
3400
+ from compass.readiness import regrade_report
3401
+ regrade_report(report, layer)
3402
+ # One verdict per run (G2, 4.9.0): under a preset the top-level verdict IS the badge, as the
3403
+ # exit code already was; the stage verdict is kept once, named as the legacy one.
3404
+ report["legacy_verdict"] = report.get("verdict")
3405
+ report["verdict"] = layer["badge"]
3369
3406
  if args.compare:
3370
3407
  other = effective(project_policy, cli_policy=args.compare, cli_sets=args.set)
3371
3408
  if other is not None:
@@ -3597,9 +3634,20 @@ def cmd_readiness(argv: list[str]) -> int:
3597
3634
  ", or --project to look for one"), file=sys.stderr)
3598
3635
  return 2
3599
3636
  artifacts = {stage: load_artifact(path) for stage, path in paths.items() if path}
3637
+ # A discover run with --fidelity carries its comparison in the discover report: the
3638
+ # fidelity stage reads it there when no separate fidelity report is given, so this page
3639
+ # and the discover report judge the same comparison (4.9.0 review).
3640
+ found = artifacts.get("ingestion")
3641
+ if ("fidelity" not in artifacts and isinstance(found, dict)
3642
+ and isinstance(found.get("fidelity"), dict) and found["fidelity"].get("results")):
3643
+ artifacts["fidelity"] = found["fidelity"]
3644
+ paths["fidelity"] = f"{paths['ingestion']} (its fidelity section)"
3645
+ hints.pop("fidelity", None)
3600
3646
  # Each artifact with its Compass version and run time; a stale one does not decide the
3601
3647
  # verdict unless --allow-stale (4.7.0 P1): it is named, and its stage is not examined.
3602
3648
  fresh = artifact_freshness(artifacts, paths)
3649
+ if str(paths.get("fidelity", "")).endswith("(its fidelity section)") and "ingestion" in fresh:
3650
+ fresh["fidelity"] = dict(fresh["ingestion"]) # the same file, the same run
3603
3651
  for stage, path in sorted(paths.items()):
3604
3652
  f = fresh.get(stage) or {}
3605
3653
  note = (f" STALE: {f['why']}" + ("" if args.allow_stale else "; not used (--allow-stale uses it)")
@@ -1293,7 +1293,7 @@ _MAPPING_KEYS: dict[tuple[str, str], tuple[str, ...]] = {
1293
1293
  "layout_rules", "layout_slack",
1294
1294
  "probe_min_share", "max_chunks", "cross_check", "value_patterns",
1295
1295
  "kinds", "section_roles", "role_tiers", "boilerplate_min_documents",
1296
- "order"),
1296
+ "order", "locate_sample"),
1297
1297
  ("eval", "snapshot"): ("provider", "location", "format", "formats", "fallback_locations",
1298
1298
  "version"),
1299
1299
  ("eval", "source_exclusions"): ("repeated_on_pages", "min_chars", "figure_min_chars",
@@ -253,6 +253,10 @@ def _lint_policy(settings: Any) -> list[Finding]:
253
253
  if (policy.get("quarantine") or {}).get("enabled") and not (policy.get("document") or {}).get("block_on"):
254
254
  findings.append(("warn", "quarantine is enabled but document.block_on is empty: no document "
255
255
  "is ever blocked, so nothing is quarantined."))
256
+ if policy.get("retrieval_relief") and str(fidelity.get("probe_retrieval") or "off") == "off":
257
+ findings.append(("info", "readiness.policy.retrieval_relief is on, but the retrieval probe "
258
+ "is off (eval.fidelity.probe_retrieval): relief applies only to "
259
+ "runs with --probe-retrieval lexical or vector."))
256
260
  if not (policy.get("waivers") or {}).get("require_expiry", True):
257
261
  findings.append(("warn", "waivers do not require an expiry date: a waived finding stays "
258
262
  "waived until someone removes it."))