compass-kb-validation 4.6.0__tar.gz → 4.7.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 (256) hide show
  1. {compass_kb_validation-4.6.0/compass_kb_validation.egg-info → compass_kb_validation-4.7.0}/PKG-INFO +51 -1
  2. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/README.md +50 -0
  3. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/__init__.py +1 -1
  4. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/auth.py +29 -4
  5. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/chunk_integrity.py +17 -9
  6. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/cli.py +24 -7
  7. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/content_fidelity.py +93 -6
  8. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/contracts.py +10 -3
  9. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/corpus.py +74 -6
  10. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/cross_check.py +108 -11
  11. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/findings.py +9 -1
  12. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/layout_match.py +51 -11
  13. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/mock_kb.py +123 -8
  14. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/models/__init__.py +50 -14
  15. compass_kb_validation-4.7.0/compass/normalise.py +40 -0
  16. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/pipeline/__init__.py +15 -0
  17. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/policy.py +5 -2
  18. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/presence.py +23 -8
  19. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/providers/graph.py +3 -2
  20. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/providers/storage.py +3 -6
  21. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/providers/vectorstore.py +240 -48
  22. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/readiness.py +65 -7
  23. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/remediation_manifest.py +43 -18
  24. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/report/__init__.py +234 -69
  25. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/report/_report_css.py +22 -0
  26. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/report/_report_js.py +1 -1
  27. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/report/export.py +10 -9
  28. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/report/fidelity_view.py +64 -14
  29. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/structure_checks.py +15 -5
  30. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/trend_analysis.py +12 -1
  31. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/validators/cross_stage.py +46 -8
  32. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/validators/redis_chunks.py +32 -5
  33. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0/compass_kb_validation.egg-info}/PKG-INFO +51 -1
  34. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass_kb_validation.egg-info/SOURCES.txt +6 -0
  35. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/discover_and_validate.py +107 -17
  36. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/run_validation.py +3 -3
  37. compass_kb_validation-4.7.0/tests/test_local_store_scale.py +110 -0
  38. compass_kb_validation-4.7.0/tests/test_r1_overlap.py +51 -0
  39. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_redis_chunks.py +3 -1
  40. compass_kb_validation-4.7.0/tests/test_tokenisers.py +74 -0
  41. compass_kb_validation-4.7.0/tests/test_trends_paging.py +106 -0
  42. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v440_outcomes.py +9 -5
  43. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_crosscheck.py +3 -1
  44. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_fidelity.py +2 -1
  45. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_remediation.py +40 -5
  46. compass_kb_validation-4.7.0/tests/test_v470_cases.py +395 -0
  47. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/LICENSE +0 -0
  48. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/__main__.py +0 -0
  49. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/acceptance.py +0 -0
  50. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/alias.py +0 -0
  51. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/ask.py +0 -0
  52. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/baseline.py +0 -0
  53. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/benchmark.py +0 -0
  54. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/check_catalog.py +0 -0
  55. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/check_outcome.py +0 -0
  56. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/chunk_coherence.py +0 -0
  57. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/chunk_eval.py +0 -0
  58. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/chunk_ref.py +0 -0
  59. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/citation.py +0 -0
  60. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/config/__init__.py +0 -0
  61. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/config_lint.py +0 -0
  62. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/content_inspect.py +0 -0
  63. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/corpus_health.py +0 -0
  64. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/cross_index.py +0 -0
  65. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/diagnostics.py +0 -0
  66. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/diff.py +0 -0
  67. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/drift.py +0 -0
  68. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/embedding_drift.py +0 -0
  69. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/eval_enrich.py +0 -0
  70. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/eval_interop.py +0 -0
  71. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/evidence.py +0 -0
  72. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/fixture_export.py +0 -0
  73. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/fixture_suite.py +0 -0
  74. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/gate.py +0 -0
  75. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/graph_probe.py +0 -0
  76. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/grounding.py +0 -0
  77. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/grounding_diff.py +0 -0
  78. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/grounding_rollup.py +0 -0
  79. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/gt_lint.py +0 -0
  80. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/health.py +0 -0
  81. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/incremental.py +0 -0
  82. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/init_wizard.py +0 -0
  83. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/line_shapes.py +0 -0
  84. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/lineage.py +0 -0
  85. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/live_dashboard.py +0 -0
  86. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/manifest.py +0 -0
  87. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/mcp_server.py +0 -0
  88. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/metadata_checks.py +0 -0
  89. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/notifications.py +0 -0
  90. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/passage_probe.py +0 -0
  91. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/pdf_support.py +0 -0
  92. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/privacy.py +0 -0
  93. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/profiler.py +0 -0
  94. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/provenance.py +0 -0
  95. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/providers/__init__.py +0 -0
  96. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/providers/embedding.py +0 -0
  97. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/providers/extractor.py +0 -0
  98. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/providers/markers.py +0 -0
  99. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/providers/snapshot.py +0 -0
  100. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/providers/source.py +0 -0
  101. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/quality_gate.py +0 -0
  102. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/question_set.py +0 -0
  103. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/remediation.py +0 -0
  104. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/report/analysis.py +0 -0
  105. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/report/audit.py +0 -0
  106. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/report/grounding_report.py +0 -0
  107. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/report/shell.py +0 -0
  108. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/retrieval_analysis.py +0 -0
  109. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/retrieval_diagnosis.py +0 -0
  110. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/simulate.py +0 -0
  111. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/snapshot_doctor.py +0 -0
  112. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/text_match.py +0 -0
  113. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/text_probes.py +0 -0
  114. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/trend_tracker.py +0 -0
  115. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/triage.py +0 -0
  116. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/utils/__init__.py +0 -0
  117. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/validators/__init__.py +0 -0
  118. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/validators/api_upload.py +0 -0
  119. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/validators/base.py +0 -0
  120. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/validators/base_sparql.py +0 -0
  121. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/validators/graphdb_metadata.py +0 -0
  122. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/validators/metadata_checks.py +0 -0
  123. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/validators/neptune_metadata.py +0 -0
  124. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/validators/registry.py +0 -0
  125. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/validators/retrieval_quality.py +0 -0
  126. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass/validators/s3_storage.py +0 -0
  127. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass_kb_validation.egg-info/dependency_links.txt +0 -0
  128. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass_kb_validation.egg-info/entry_points.txt +0 -0
  129. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass_kb_validation.egg-info/requires.txt +0 -0
  130. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/compass_kb_validation.egg-info/top_level.txt +0 -0
  131. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/ingestion_validation/__init__.py +0 -0
  132. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/profile_kb.py +0 -0
  133. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/pyproject.toml +0 -0
  134. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/setup.cfg +0 -0
  135. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_alias.py +0 -0
  136. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_alias_disambiguation.py +0 -0
  137. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_alias_temporal.py +0 -0
  138. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_alt_adapters.py +0 -0
  139. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_analysis_report.py +0 -0
  140. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_api_upload.py +0 -0
  141. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_ask.py +0 -0
  142. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_baseline.py +0 -0
  143. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_benchmark.py +0 -0
  144. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_calibrate_truth.py +0 -0
  145. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_check_catalog.py +0 -0
  146. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_chunk_eval.py +0 -0
  147. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_chunk_integrity.py +0 -0
  148. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_chunk_structure_checks.py +0 -0
  149. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_citation.py +0 -0
  150. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_citation_levels.py +0 -0
  151. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_cli.py +0 -0
  152. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_cli_commands.py +0 -0
  153. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_compat_shim.py +0 -0
  154. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_config.py +0 -0
  155. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_config_lint.py +0 -0
  156. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_content_fidelity.py +0 -0
  157. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_content_inspect.py +0 -0
  158. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_corpus.py +0 -0
  159. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_corpus_health.py +0 -0
  160. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_coverage.py +0 -0
  161. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_coverage_and_drift_config.py +0 -0
  162. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_cross_stage.py +0 -0
  163. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_diagnostics.py +0 -0
  164. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_diff.py +0 -0
  165. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_discover_cli.py +0 -0
  166. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_discovery_parallel.py +0 -0
  167. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_drift.py +0 -0
  168. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_embedding_contract.py +0 -0
  169. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_embedding_drift.py +0 -0
  170. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_eval_enrich.py +0 -0
  171. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_eval_interop.py +0 -0
  172. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_evidence.py +0 -0
  173. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_fidelity_precision.py +0 -0
  174. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_fixture_bundles.py +0 -0
  175. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_gate.py +0 -0
  176. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_graph_transport.py +0 -0
  177. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_graph_validators.py +0 -0
  178. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_grounding.py +0 -0
  179. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_grounding_report.py +0 -0
  180. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_grounding_rollup.py +0 -0
  181. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_health.py +0 -0
  182. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_incremental.py +0 -0
  183. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_init_wizard.py +0 -0
  184. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_lineage.py +0 -0
  185. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_manifest.py +0 -0
  186. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_mcp.py +0 -0
  187. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_measurement_fixes.py +0 -0
  188. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_metadata_checks.py +0 -0
  189. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_migration.py +0 -0
  190. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_models.py +0 -0
  191. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_multi_index.py +0 -0
  192. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_neptune_bugfixes.py +0 -0
  193. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_neptune_bugfixes2.py +0 -0
  194. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_notifications.py +0 -0
  195. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_pipeline.py +0 -0
  196. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_profiler.py +0 -0
  197. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_providers.py +0 -0
  198. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_quality_gate.py +0 -0
  199. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_readiness.py +0 -0
  200. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_registry.py +0 -0
  201. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_remediation.py +0 -0
  202. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_report_store_section.py +0 -0
  203. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_reporting.py +0 -0
  204. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_requirements_config.py +0 -0
  205. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_retrieval_assertions.py +0 -0
  206. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_retrieval_fields.py +0 -0
  207. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_retrieval_quality.py +0 -0
  208. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_review_hardening.py +0 -0
  209. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_run_cli.py +0 -0
  210. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_simulate.py +0 -0
  211. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_source_exclusions.py +0 -0
  212. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_source_verification.py +0 -0
  213. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_sources.py +0 -0
  214. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_storage_validator.py +0 -0
  215. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_structure_checks.py +0 -0
  216. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_synthetic_cases.py +0 -0
  217. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_tooling_420.py +0 -0
  218. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_trends.py +0 -0
  219. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_universal_concerns.py +0 -0
  220. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_utils.py +0 -0
  221. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v402_fixes.py +0 -0
  222. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v410_any_pipeline.py +0 -0
  223. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v410_gate.py +0 -0
  224. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v410_portability.py +0 -0
  225. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v420_gate.py +0 -0
  226. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v420_report_truth.py +0 -0
  227. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v421_report.py +0 -0
  228. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v430_fidelity.py +0 -0
  229. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v430_gate.py +0 -0
  230. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v430_report.py +0 -0
  231. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v430_tooling.py +0 -0
  232. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v431_report.py +0 -0
  233. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v440_fidelity.py +0 -0
  234. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v440_report_drift.py +0 -0
  235. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v440_structure.py +0 -0
  236. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v440_styles.py +0 -0
  237. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v440_trends.py +0 -0
  238. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v450_trends.py +0 -0
  239. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_acceptance.py +0 -0
  240. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_contracts.py +0 -0
  241. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_fixture.py +0 -0
  242. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_gate_document.py +0 -0
  243. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_mock_kb.py +0 -0
  244. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_policy.py +0 -0
  245. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_policy_detection.py +0 -0
  246. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_policy_run.py +0 -0
  247. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_privacy.py +0 -0
  248. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_profiles.py +0 -0
  249. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_reporting.py +0 -0
  250. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_retrieval_diagnosis.py +0 -0
  251. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_runtime.py +0 -0
  252. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_setup.py +0 -0
  253. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v460_verdicts.py +0 -0
  254. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_v4_defect_fixes.py +0 -0
  255. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.0}/tests/test_vector_fastpath.py +0 -0
  256. {compass_kb_validation-4.6.0 → compass_kb_validation-4.7.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.6.0
3
+ Version: 4.7.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,6 +149,56 @@ 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.7
153
+
154
+ 4.7 keeps what 4.6 finds and fixes what a design partner's 4.6 run got wrong: false content-loss
155
+ findings, counts that did not add up, and runs where one stage could not answer. Measured on the
156
+ offline mock knowledge bases (`compass mock-kb`) with the 4.7 planters, against 4.6.0 on the same
157
+ mocks:
158
+
159
+ | Mock KB | Real losses found (4.6.0 -> 4.7) | Documents gated without a loss | False gating lines | Unchanged values flagged |
160
+ |---|---|---|---|---|
161
+ | Reference, custom index | 32 of 32 -> 32 of 32 | 2 -> **0** | 3 -> **0** | 6 -> **0** |
162
+ | Reference, provider index | 7 of 10 -> **10 of 10** | 0 -> 0 | 0 -> 0 | 0 -> 0 |
163
+ | Large KB (50 documents) | 34 -> 34 | 0 -> 0 | 1 -> **0** | 0 -> 0 |
164
+
165
+ On the reference mock the independent cross-check confirms every planted loss as lost, with none
166
+ left unresolved. On the Large mock, overlap is measured in chunk order, so a chunker with
167
+ variable overlap passes (49 documents; 4.6.0 failed 46).
168
+
169
+ **What reads differently**
170
+
171
+ - **Partly verified.** A document where a stage could not run but nothing failed is *partly
172
+ verified*, not *not checked*. The console headline, JSON summary, corpus line and report all
173
+ count the same four outcomes: passed, failed, partly verified, not checked.
174
+ - **A store that did not answer is never cited.** Cross-store checks compare only the stores
175
+ that answered. A source replaced after ingestion is still found while the graph is down.
176
+ - **Counts name their unit.** Fidelity passages and values are counted apart, and each breakdown
177
+ sums to its total. Tracked findings say "N failed check(s) on D document(s)". Chunk integrity
178
+ gives its denominator and every chunk it left out, with the reason.
179
+ - **`remediation.json`** separates `review` (confirmed lost) from `review_suspected` (the
180
+ cross-check could not settle it), and adds `ingest` for a source with no chunks.
181
+ - **`compass readiness`** names each artifact's Compass version and time. A stale artifact does
182
+ not decide the verdict unless `--allow-stale`. Under a preset there is one verdict: the badge.
183
+ - **Faster on large corpora.** Under `--parallel`, fidelity runs alongside the document checks.
184
+ A 502-document, 208,467-chunk mock took 51 minutes instead of 75. The console prints a "Stage
185
+ times" line.
186
+
187
+ ### Upgrading from 4.6.0: what changes by default
188
+
189
+ | Change | Why | To keep 4.6.0 |
190
+ |---|---|---|
191
+ | A check that did not run or does not apply writes `passed: null` in JSON (was `false`); `outcome` is authoritative | A reader counting `passed: false` counted checks that never ran as failures | none; read `outcome` |
192
+ | JSON summary gains `partly_verified`; `not_checked` now means no check could run | Partly checked documents read "not checked" | none; `not_checked + partly_verified` is the 4.6.0 `not_checked` |
193
+ | Value drift is advisory under every preset | Unchanged values read as rewritten | `document.block_on: [value_drift]` |
194
+ | A lost line is decided on 5-token runs on its page +-1 and elsewhere | Real losses of common words were never "lost" | none needed |
195
+ | Cropped columns and image wordmarks are kinds `fragment` and `image_label`, tier low | They gated as content loss | raise them in `eval.fidelity.tiers` |
196
+ | Under a preset, readiness prints the badge as the verdict and the legacy verdict "for comparison" | Two verdicts on one screen | none; the exit code already followed the badge |
197
+ | Readiness leaves out artifacts from another version or older than the discover report | A stale artifact decided the verdict | `compass readiness --allow-stale` |
198
+ | Overlap is measured in stored chunk order; a non-fixed strategy passes if any pair overlaps | Variable overlap read as "0%" | `redis.chunking_strategy: fixed` keeps `overlap_min_ratio` |
199
+
200
+ Exit codes are unchanged.
201
+
152
202
  ## What's new in 4.6
153
203
 
154
204
  4.6 keeps what 4.5.1 finds and removes what it found wrongly. Measured on offline mock knowledge
@@ -72,6 +72,56 @@ 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.7
76
+
77
+ 4.7 keeps what 4.6 finds and fixes what a design partner's 4.6 run got wrong: false content-loss
78
+ findings, counts that did not add up, and runs where one stage could not answer. Measured on the
79
+ offline mock knowledge bases (`compass mock-kb`) with the 4.7 planters, against 4.6.0 on the same
80
+ mocks:
81
+
82
+ | Mock KB | Real losses found (4.6.0 -> 4.7) | Documents gated without a loss | False gating lines | Unchanged values flagged |
83
+ |---|---|---|---|---|
84
+ | Reference, custom index | 32 of 32 -> 32 of 32 | 2 -> **0** | 3 -> **0** | 6 -> **0** |
85
+ | Reference, provider index | 7 of 10 -> **10 of 10** | 0 -> 0 | 0 -> 0 | 0 -> 0 |
86
+ | Large KB (50 documents) | 34 -> 34 | 0 -> 0 | 1 -> **0** | 0 -> 0 |
87
+
88
+ On the reference mock the independent cross-check confirms every planted loss as lost, with none
89
+ left unresolved. On the Large mock, overlap is measured in chunk order, so a chunker with
90
+ variable overlap passes (49 documents; 4.6.0 failed 46).
91
+
92
+ **What reads differently**
93
+
94
+ - **Partly verified.** A document where a stage could not run but nothing failed is *partly
95
+ verified*, not *not checked*. The console headline, JSON summary, corpus line and report all
96
+ count the same four outcomes: passed, failed, partly verified, not checked.
97
+ - **A store that did not answer is never cited.** Cross-store checks compare only the stores
98
+ that answered. A source replaced after ingestion is still found while the graph is down.
99
+ - **Counts name their unit.** Fidelity passages and values are counted apart, and each breakdown
100
+ sums to its total. Tracked findings say "N failed check(s) on D document(s)". Chunk integrity
101
+ gives its denominator and every chunk it left out, with the reason.
102
+ - **`remediation.json`** separates `review` (confirmed lost) from `review_suspected` (the
103
+ cross-check could not settle it), and adds `ingest` for a source with no chunks.
104
+ - **`compass readiness`** names each artifact's Compass version and time. A stale artifact does
105
+ not decide the verdict unless `--allow-stale`. Under a preset there is one verdict: the badge.
106
+ - **Faster on large corpora.** Under `--parallel`, fidelity runs alongside the document checks.
107
+ A 502-document, 208,467-chunk mock took 51 minutes instead of 75. The console prints a "Stage
108
+ times" line.
109
+
110
+ ### Upgrading from 4.6.0: what changes by default
111
+
112
+ | Change | Why | To keep 4.6.0 |
113
+ |---|---|---|
114
+ | A check that did not run or does not apply writes `passed: null` in JSON (was `false`); `outcome` is authoritative | A reader counting `passed: false` counted checks that never ran as failures | none; read `outcome` |
115
+ | JSON summary gains `partly_verified`; `not_checked` now means no check could run | Partly checked documents read "not checked" | none; `not_checked + partly_verified` is the 4.6.0 `not_checked` |
116
+ | Value drift is advisory under every preset | Unchanged values read as rewritten | `document.block_on: [value_drift]` |
117
+ | A lost line is decided on 5-token runs on its page +-1 and elsewhere | Real losses of common words were never "lost" | none needed |
118
+ | Cropped columns and image wordmarks are kinds `fragment` and `image_label`, tier low | They gated as content loss | raise them in `eval.fidelity.tiers` |
119
+ | Under a preset, readiness prints the badge as the verdict and the legacy verdict "for comparison" | Two verdicts on one screen | none; the exit code already followed the badge |
120
+ | Readiness leaves out artifacts from another version or older than the discover report | A stale artifact decided the verdict | `compass readiness --allow-stale` |
121
+ | Overlap is measured in stored chunk order; a non-fixed strategy passes if any pair overlaps | Variable overlap read as "0%" | `redis.chunking_strategy: fixed` keeps `overlap_min_ratio` |
122
+
123
+ Exit codes are unchanged.
124
+
75
125
  ## What's new in 4.6
76
126
 
77
127
  4.6 keeps what 4.5.1 finds and removes what it found wrongly. Measured on offline mock knowledge
@@ -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.6.0"
8
+ __version__ = "4.7.0"
9
9
 
10
10
 
11
11
  def gate_document(settings, document_id, **kwargs):
@@ -28,6 +28,9 @@ AUTH_CODES = frozenset({
28
28
  _ACTION = re.compile(r"perform:?\s*([A-Za-z0-9-]+:[A-Za-z0-9*]+)")
29
29
  #: an HTTP status in an error text, as the HTTP adapters record it ("HTTP 403: ...")
30
30
  _HTTP = re.compile(r"\bHTTP (401|403)\b")
31
+ #: an expired temporary credential, as AWS and others word it
32
+ _EXPIRED = re.compile(r"ExpiredToken|token[^.]{0,60}\bexpired\b|expired[^.]{0,30}\btoken",
33
+ re.IGNORECASE)
31
34
  #: storage operation -> the permission it needs, for a denial that does not name it
32
35
  S3_PERMISSIONS = {"ListObjectsV2": "s3:ListBucket", "ListObjects": "s3:ListBucket",
33
36
  "HeadObject": "s3:GetObject", "GetObject": "s3:GetObject",
@@ -68,7 +71,8 @@ def auth_failure(error: Any) -> Optional[dict]:
68
71
  if error is None or error == "":
69
72
  return None
70
73
  if isinstance(error, BackendAuthError):
71
- return {"detail": error.detail, "permission": error.permission, "identity": error.identity}
74
+ return {"detail": error.detail, "permission": error.permission, "identity": error.identity,
75
+ "expired": bool(_EXPIRED.search(str(error.detail)))}
72
76
  text = str(error)
73
77
  if isinstance(error, BaseException):
74
78
  code = _code_of(error)
@@ -84,14 +88,34 @@ def auth_failure(error: Any) -> Optional[dict]:
84
88
  detail, operation = text, ""
85
89
  action = _ACTION.search(text)
86
90
  permission = action.group(1) if action else S3_PERMISSIONS.get(operation, "")
87
- return {"detail": detail[:300], "permission": permission, "identity": ""}
91
+ return {"detail": detail[:300], "permission": permission, "identity": "",
92
+ "expired": bool(_EXPIRED.search(text))}
88
93
 
89
94
 
90
95
  def describe(failure: dict, step: str) -> str:
91
96
  """The one line a run prints for a latched backend."""
92
97
  who = failure.get("identity") or "the configured credentials"
93
98
  need = f"; missing permission {failure['permission']}" if failure.get("permission") else ""
94
- return f"not run: {step} was refused access as {who}{need} ({failure.get('detail', '')})"
99
+ # An expired session token is the cause to act on: say it in the line, not only inside
100
+ # the HTTP body that follows (4.7.0 I3).
101
+ expired = ": session token expired" if failure.get("expired") or _EXPIRED.search(
102
+ str(failure.get("detail", ""))) else ""
103
+ return (f"not run: {step} was refused access as {who}{expired}{need} "
104
+ f"({failure.get('detail', '')})")
105
+
106
+
107
+ def credential_source(config: Any) -> str:
108
+ """Where a backend's credentials come from, by name, never a secret (4.7.0 I3): a named
109
+ profile, key variables (with the session token variable when one is set), or the default
110
+ chain. One reading for every backend, so doctor and the report name the source used."""
111
+ profile = str(getattr(config, "aws_profile", "") or "")
112
+ if profile:
113
+ return f"profile '{profile}'"
114
+ key_env = str(getattr(config, "aws_access_key_id_env", "") or "")
115
+ if key_env:
116
+ token = str(getattr(config, "aws_session_token_env", "") or "")
117
+ return f"keys from env {key_env}" + (f", session token from env {token}" if token else "")
118
+ return "the default AWS credential chain"
95
119
 
96
120
 
97
121
  class AuthLatch:
@@ -156,4 +180,5 @@ def duplicate_env_names(path: str) -> list[tuple[str, list[int]]]:
156
180
  return [(name, lines) for name, lines in seen.items() if len(lines) > 1]
157
181
 
158
182
 
159
- __all__ = ["duplicate_env_names", "AUTH_CODES", "S3_PERMISSIONS", "BackendAuthError", "auth_failure", "describe", "AuthLatch"]
183
+ __all__ = ["duplicate_env_names", "AUTH_CODES", "S3_PERMISSIONS", "BackendAuthError", "auth_failure", "describe", "AuthLatch",
184
+ "credential_source"]
@@ -29,6 +29,7 @@ from __future__ import annotations
29
29
  import bisect
30
30
  import re
31
31
  from collections import Counter
32
+ from itertools import chain
32
33
  from dataclasses import dataclass
33
34
  from typing import Any, Optional
34
35
 
@@ -119,13 +120,19 @@ class _Source:
119
120
  self.blank = {n for n, t in enumerate(self.texts, 1) if len(t) < 8}
120
121
  # Where each source line ends. What follows a passage is only known within a line: past
121
122
  # its end, an extractor may have carried on in another column.
122
- self.joined = ""
123
+ # Built as parts and joined once (R1): appending to an attribute string copies it on every
124
+ # line, which is quadratic on a document of hundreds of pages.
125
+ parts: list[str] = []
126
+ size = 0
123
127
  self.line_ends: list[int] = []
124
128
  for page in body_pages:
125
129
  for line in page.splitlines():
126
- self.joined += normalize(line)
127
- if not self.line_ends or len(self.joined) - self.line_ends[-1] >= _MIN_LINE:
128
- self.line_ends.append(len(self.joined))
130
+ part = normalize(line)
131
+ parts.append(part)
132
+ size += len(part)
133
+ if not self.line_ends or size - self.line_ends[-1] >= _MIN_LINE:
134
+ self.line_ends.append(size)
135
+ self.joined = "".join(parts)
129
136
  self.figures = {n: {key for key, _ in figures_of(p)} for n, p in enumerate(pages, 1)}
130
137
 
131
138
 
@@ -215,6 +222,7 @@ def check_chunks(chunks: list[dict], pages: list[str], *, figures_of: Any, split
215
222
  "findings": [{k: r[k] for k in ("chunk", "position", "status", "detail")}
216
223
  for r in flagged[:max_findings]],
217
224
  "not_checked": not_checked, "page_shift": shift,
225
+ "chunks": len(chunks), "too_short": too_short,
218
226
  "generated": generated,
219
227
  "generated_text": {
220
228
  "chunks": len(mixed),
@@ -268,11 +276,11 @@ def _locate(chunk: dict, raw: str, split_table: Any, source: _Source, names: Fie
268
276
  prose = normalize(split_table(raw))
269
277
  row["prose"] = prose
270
278
  if len(prose) >= _MIN_CHARS:
271
- for unit in grams(prose, _LOCATE_K):
272
- found = source.where.get(unit)
273
- if found:
274
- row["located"] += 1
275
- row["hits"].update(found)
279
+ # 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]
282
+ row["located"] = len(found)
283
+ row["hits"] = Counter(chain.from_iterable(found))
276
284
  return row
277
285
 
278
286
 
@@ -918,8 +918,10 @@ def cmd_check(argv: list[str]) -> int:
918
918
  passed = _outcomes["passed"]
919
919
  failed_gate, reason = dav.gate_failed(passed, len(results), corpus["verdict"],
920
920
  args.fail_under, args.require_ready,
921
- not_checked=_outcomes["not_checked"])
922
- print(f" Results: {passed}/{len(results)} passed, {_outcomes['not_checked']} not checked - "
921
+ not_checked=_outcomes["not_checked"]
922
+ + _outcomes["partly_verified"])
923
+ from compass.models import outcome_line
924
+ print(f" Results: {outcome_line(_outcomes)} ({len(results)} total) - "
923
925
  f"readiness {corpus['verdict']}")
924
926
  print(f" Gate: {'FAILED' if failed_gate else 'PASSED'} - {reason}")
925
927
  print(f" Report: {path}")
@@ -3561,6 +3563,9 @@ def cmd_readiness(argv: list[str]) -> int:
3561
3563
  p.add_argument("--compare", default="", metavar="PRESET|FILE",
3562
3564
  help="Also evaluate under this policy and show what changes")
3563
3565
  p.add_argument("--project", default="", help="Read the `readiness:` policy from this project")
3566
+ p.add_argument("--allow-stale", action="store_true",
3567
+ help="Let an artifact written by another Compass version, or older than the "
3568
+ "discover report, decide the verdict (default: it is named and left out)")
3564
3569
  p.add_argument("--env", default="")
3565
3570
  p.add_argument("--format", choices=("console", "json", "html"), default="")
3566
3571
  p.add_argument("--output", metavar="FILE", help="Write the report here (default: stdout)")
@@ -3571,8 +3576,8 @@ def cmd_readiness(argv: list[str]) -> int:
3571
3576
 
3572
3577
  from compass.config import load_settings, project_config_file
3573
3578
  from compass.triage import load_triage, triage_for
3574
- from compass.readiness import (Policy, ReadinessInputError, assess, format_readiness,
3575
- load_artifact, locate_artifacts, render_html)
3579
+ from compass.readiness import (Policy, ReadinessInputError, artifact_freshness, assess,
3580
+ format_readiness, load_artifact, locate_artifacts, render_html)
3576
3581
 
3577
3582
  given = {"ingestion": args.discover or args.report, "retrieval": args.benchmark,
3578
3583
  "grounding": args.grounding, "drift": args.drift, "fidelity": args.fidelity}
@@ -3586,15 +3591,26 @@ def cmd_readiness(argv: list[str]) -> int:
3586
3591
  policy = Policy.from_config(settings.readiness if settings else None)
3587
3592
  paths, hints = locate_artifacts(
3588
3593
  given, args.project, getattr(getattr(settings, "readiness", None), "artifacts", None))
3589
- for stage, path in sorted(paths.items()):
3590
- if not given.get(stage):
3591
- print(f" {stage}: using {path}", file=sys.stderr)
3592
3594
  if "ingestion" not in paths:
3593
3595
  print(" readiness needs a discover report: pass --discover FILE"
3594
3596
  + (f", or {hints['ingestion']}" if "ingestion" in hints else
3595
3597
  ", or --project to look for one"), file=sys.stderr)
3596
3598
  return 2
3597
3599
  artifacts = {stage: load_artifact(path) for stage, path in paths.items() if path}
3600
+ # Each artifact with its Compass version and run time; a stale one does not decide the
3601
+ # verdict unless --allow-stale (4.7.0 P1): it is named, and its stage is not examined.
3602
+ fresh = artifact_freshness(artifacts, paths)
3603
+ for stage, path in sorted(paths.items()):
3604
+ f = fresh.get(stage) or {}
3605
+ note = (f" STALE: {f['why']}" + ("" if args.allow_stale else "; not used (--allow-stale uses it)")
3606
+ if f.get("stale") else "")
3607
+ print(f" {stage}: using {path} (Compass {f.get('version')}, {f.get('generated')}){note}",
3608
+ file=sys.stderr)
3609
+ if not args.allow_stale:
3610
+ for stage in [s for s, f in fresh.items() if f["stale"]]:
3611
+ artifacts.pop(stage, None)
3612
+ hints[stage] = (f"stale artifact {paths.pop(stage)} ({fresh[stage]['why']}): re-run "
3613
+ "it, or pass --allow-stale")
3598
3614
  triage = (triage_for(settings, override=args.triage) if settings is not None
3599
3615
  else load_triage(args.triage) if args.triage else None)
3600
3616
  report = assess(artifacts, labels=dict(paths), policy=policy, project=args.project,
@@ -3611,6 +3627,7 @@ def cmd_readiness(argv: list[str]) -> int:
3611
3627
  to_stderr = fmt != "console" or bool(args.output)
3612
3628
  report["manifest"] = _manifest(settings, "readiness", to_stderr=to_stderr,
3613
3629
  artifacts={k: str(v) for k, v in paths.items()})
3630
+ report["artifacts"] = fresh
3614
3631
  from compass.findings import readiness_findings
3615
3632
  report["tracked_findings"] = _track(readiness_findings(report), settings, "readiness", args,
3616
3633
  project=args.project, to_stderr=to_stderr)
@@ -46,6 +46,7 @@ from compass.structure_checks import (count_pdf_images, structure_report, struct
46
46
  text_layer_pages)
47
47
  from compass.citation import _source_key_of, compile_exclusions, must_retain_rules
48
48
  from compass.presence import Pool, PresenceSpec, judge, lines_of, presence_spec, split_line
49
+ from compass.presence import clean as _clean, tokens as _tokens
49
50
  from compass.contracts import schema
50
51
  from compass.text_match import MARKUP_TAG, NORMALIZATION_VERSION, NORMALIZATIONS, grams, normalize
51
52
 
@@ -232,7 +233,11 @@ class _Options:
232
233
  #: (a title, subtitle or note) missing while the rows are stored.
233
234
  DEFAULT_TIERS = {"table": "high", "table_title": "medium", "number": "high", "source_note": "high",
234
235
  "heading": "medium", "figure": "low", "body": "high", "body_short": "medium",
235
- "reading_order": "medium"}
236
+ "reading_order": "medium", "fragment": "low", "image_label": "low"}
237
+ #: 4.7.0 (C2). ``fragment``: an element most of whose lines are cut inside a word at both ends
238
+ #: (a cropped column) while the page stores the words whole. ``image_label``: a line of the
239
+ #: element right after an image whose words the page stores only inside an image annotation
240
+ #: ("[Image] Harborview logo"). Both are reported, tier low; a project can raise either.
236
241
  #: role of a judged line whose words are there but interleaved with another column (rule E)
237
242
  READING_ORDER_ROLE = "reading_order"
238
243
  VERIFY_SCOPES = ("document", "page")
@@ -1136,7 +1141,8 @@ def _line_kind(meta: dict, line: str, role: str, opts: _Options, figures_of: Any
1136
1141
 
1137
1142
 
1138
1143
  def _element_findings(judged: dict, metas: dict, opts: _Options, figures_of: Any,
1139
- gated_regions: tuple) -> list[dict]:
1144
+ gated_regions: tuple, page_texts: Any = None,
1145
+ element_types: Optional[list[str]] = None) -> list[dict]:
1140
1146
  """One finding per element and kind of missing line, from each element's judged lines.
1141
1147
 
1142
1148
  An element's ``stored_share`` is the share of its judged lines present, weighted by size.
@@ -1147,6 +1153,9 @@ def _element_findings(judged: dict, metas: dict, opts: _Options, figures_of: Any
1147
1153
  Args:
1148
1154
  judged: ``{element: [(line, present, weight, role, share)]}``, judged lines in order.
1149
1155
  metas: ``{element: meta}`` from :func:`_snapshot_body`.
1156
+ page_texts: ``page -> stored texts`` of the page +-1, for the ``fragment`` and
1157
+ ``image_label`` kinds (4.7.0 C2); None leaves both off.
1158
+ element_types: every snapshot element's type, in order (the element before this one).
1150
1159
  """
1151
1160
  out: list[dict] = []
1152
1161
  for number, rows in sorted(judged.items()):
@@ -1161,7 +1170,11 @@ def _element_findings(judged: dict, metas: dict, opts: _Options, figures_of: Any
1161
1170
  "attribution": PIPELINE_DROP, "stored_share": round(share, 3),
1162
1171
  "lines_judged": len(rows), "element_text": str(meta.get("text") or "")[:600]}
1163
1172
  groups: dict[str, list] = {}
1164
- if share < opts.partial_drop_floor:
1173
+ special = _special_kind(number, rows, missing, meta, opts, page_texts, element_types)
1174
+ if special:
1175
+ groups[special] = missing
1176
+ mode = "partial" if share < opts.partial_drop_floor else "lines"
1177
+ elif share < opts.partial_drop_floor:
1165
1178
  groups[_element_kind(meta, missing, opts, figures_of)] = missing
1166
1179
  mode = "partial"
1167
1180
  else:
@@ -1181,6 +1194,66 @@ def _element_findings(judged: dict, metas: dict, opts: _Options, figures_of: Any
1181
1194
  return out
1182
1195
 
1183
1196
 
1197
+ def _page_texts(chunks: list[dict], stored: list[str], opts: _Options) -> Any:
1198
+ """``page -> stored texts`` of the chunks covering the page +-1 (every chunk when none
1199
+ states a page)."""
1200
+ spans = [_chunk_span(c, opts) for c in chunks]
1201
+ paged = any(span is not None for span in spans)
1202
+ cache: dict = {}
1203
+
1204
+ def texts(page: Any) -> list[str]:
1205
+ number = _page_int(page) if paged else 0
1206
+ if number not in cache:
1207
+ cache[number] = [stored[i] for i, span in enumerate(spans)
1208
+ if not paged or span is None or number is None
1209
+ or span[0] - 1 <= number <= span[1] + 1]
1210
+ return cache[number]
1211
+ return texts
1212
+
1213
+
1214
+ _ANNOTATION = re.compile(r"^\s*\[[^\]\n]{1,40}\]")
1215
+
1216
+
1217
+ def _cut_both_ends(line: str, words: set) -> bool:
1218
+ """A line cut inside a word at both ends: its first token the end of a longer stored word and
1219
+ its last the start of one, neither a stored word itself ("ular maintenance of the valve assem")."""
1220
+ toks = _tokens(_clean(line))
1221
+ if len(toks) < 2:
1222
+ return False
1223
+ first, last = toks[0], toks[-1]
1224
+
1225
+ def part(t: str, edge: Any) -> bool:
1226
+ return len(t) >= 2 and not t.isdigit() and t not in words and any(
1227
+ len(w) > len(t) and edge(w, t) for w in words)
1228
+ return part(first, str.endswith) and part(last, str.startswith)
1229
+
1230
+
1231
+ def _special_kind(number: int, rows: list, missing: list, meta: dict, opts: _Options,
1232
+ page_texts: Any, element_types: Optional[list[str]]) -> str:
1233
+ """``fragment`` or ``image_label`` for an element's missing lines (4.7.0 C2), else ""."""
1234
+ if page_texts is None or meta.get("table") or meta.get("figure"):
1235
+ return ""
1236
+ texts = page_texts(meta.get("page"))
1237
+ if not texts:
1238
+ return ""
1239
+ words = {t for text in texts for t in _tokens(_clean(text))}
1240
+ # A cropped column: most of the element's lines cut inside a word at both ends.
1241
+ cut = sum(1 for r in rows if _cut_both_ends(r[0], words))
1242
+ if cut >= 2 and 2 * cut >= len(rows):
1243
+ return "fragment"
1244
+ # A wordmark under an image: the element before is an image, and every word of the missing
1245
+ # lines that the page stores at all, it stores only inside an image annotation.
1246
+ before = element_types[number - 1] if element_types and 0 < number <= len(element_types) else ""
1247
+ if before and before in opts.figure_types:
1248
+ stored_lines = [ln for text in texts for ln in str(text).split("\n") if ln.strip()]
1249
+ inside = {t for ln in stored_lines if _ANNOTATION.match(ln) for t in _tokens(_clean(ln))}
1250
+ outside = {t for ln in stored_lines if not _ANNOTATION.match(ln) for t in _tokens(_clean(ln))}
1251
+ named = [t for r in missing for t in _tokens(_clean(r[0])) if not t.isdigit() and len(t) > 1]
1252
+ if named and any(t in inside for t in named) and not any(t in outside for t in named):
1253
+ return "image_label"
1254
+ return ""
1255
+
1256
+
1184
1257
  def _tier_runs(runs: list[dict], opts: _Options, figures_of: Any) -> list[dict]:
1185
1258
  """Each lost passage's tier by what it held, and whether its tier gates (``gate_tiers``).
1186
1259
 
@@ -1655,7 +1728,11 @@ def compare_document(document: str, source_key: str, pages: list[str], chunks: l
1655
1728
  for key, raw_value in figures_of(readable):
1656
1729
  result.numbers_checked += 1
1657
1730
  if figures_left[key] > 0:
1658
- figures_left[key] -= 1
1731
+ # A figure's numbers never use up a body value's (4.7.0 C3): a chart whose text
1732
+ # the pipeline dropped, before a sentence with the same value, took the store's
1733
+ # only copy and the sentence's unchanged value read as rewritten.
1734
+ if not in_figure:
1735
+ figures_left[key] -= 1
1659
1736
  continue
1660
1737
  if _glued_tail(raw_value, readable, figures_left, figures_of):
1661
1738
  continue # "FY252,658" is FY25 then 2,658, fused by the text layer
@@ -1754,7 +1831,11 @@ def compare_document(document: str, source_key: str, pages: list[str], chunks: l
1754
1831
  result.pages_low.append({"page": number, "coverage": round(page_present / page_total, 3)})
1755
1832
 
1756
1833
  gated = ("body", "unknown") if opts.figure_words == "report" else ("body", "figure", "unknown")
1757
- element_rows = _element_findings(judged_lines, element_meta, opts, figures_of, gated)
1834
+ element_rows = _element_findings(
1835
+ judged_lines, element_meta, opts, figures_of, gated,
1836
+ page_texts=_page_texts(chunks, stored, opts) if use_snapshot else None,
1837
+ element_types=[str(e.type or "").lower() for e in snapshot.elements]
1838
+ if use_snapshot and snapshot is not None else None)
1758
1839
 
1759
1840
  # Baseline is the snapshot: the source can still show what the extractor never produced.
1760
1841
  # A text layer is matched the way a source baseline is (presence.match for "source").
@@ -2323,16 +2404,22 @@ def _structure_totals(results: list[DocumentFidelity]) -> dict:
2323
2404
 
2324
2405
  def _integrity_totals(results: list[DocumentFidelity]) -> dict:
2325
2406
  """The per-chunk results across every document compared."""
2326
- checked = traced = unverifiable = 0
2407
+ checked = traced = chunks = too_short = generated = 0
2327
2408
  counts: Counter = Counter()
2328
2409
  for r in results:
2329
2410
  part = r.chunk_integrity
2330
2411
  checked += part.get("checked", 0)
2331
2412
  traced += part.get("traced", 0)
2413
+ chunks += part.get("chunks", 0)
2414
+ too_short += part.get("too_short", 0)
2415
+ generated += part.get("generated", 0)
2332
2416
  counts.update(part.get("counts") or {})
2333
2417
  unverifiable = counts.get("UNVERIFIABLE", 0)
2334
2418
  judged = checked - unverifiable
2419
+ # Every stored chunk is accounted for (A2): judged, or left out with its reason.
2335
2420
  return {"checked": checked, "traced": traced, "counts": dict(counts),
2421
+ "chunks": chunks, "too_short": too_short, "generated": generated,
2422
+ "unverifiable": unverifiable,
2336
2423
  "integrity_pct": round(100.0 * traced / judged, 1) if judged else None}
2337
2424
 
2338
2425
 
@@ -74,11 +74,18 @@ def coverage_of(verification: Any) -> str:
74
74
 
75
75
 
76
76
  def with_outcome(check: dict) -> dict:
77
- """The check row with ``outcome`` (and ``reason`` when it did not run or does not apply)."""
77
+ """The check row with ``outcome`` (and ``reason`` when it did not run or does not apply).
78
+
79
+ A check that did not run or does not apply writes ``passed: null`` (4.7.0 E.6): it neither
80
+ passed nor failed, and ``false`` read as a failure by anyone counting the 4.5.1 field.
81
+ ``outcome`` is the authoritative field.
82
+ """
78
83
  out = dict(check)
79
84
  out["outcome"] = outcome(check)
80
- if out["outcome"] in (NOT_APPLICABLE, NOT_RUN) and "reason" not in out:
81
- out["reason"] = reason_of(check)
85
+ if out["outcome"] in (NOT_APPLICABLE, NOT_RUN):
86
+ out["passed"] = None
87
+ if "reason" not in out:
88
+ out["reason"] = reason_of(check)
82
89
  return out
83
90
 
84
91