compass-kb-validation 1.0.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 (63) hide show
  1. compass_kb_validation-1.0.0/LICENSE +21 -0
  2. compass_kb_validation-1.0.0/PKG-INFO +305 -0
  3. compass_kb_validation-1.0.0/README.md +240 -0
  4. compass_kb_validation-1.0.0/compass_kb_validation.egg-info/PKG-INFO +305 -0
  5. compass_kb_validation-1.0.0/compass_kb_validation.egg-info/SOURCES.txt +61 -0
  6. compass_kb_validation-1.0.0/compass_kb_validation.egg-info/dependency_links.txt +1 -0
  7. compass_kb_validation-1.0.0/compass_kb_validation.egg-info/entry_points.txt +3 -0
  8. compass_kb_validation-1.0.0/compass_kb_validation.egg-info/requires.txt +55 -0
  9. compass_kb_validation-1.0.0/compass_kb_validation.egg-info/top_level.txt +3 -0
  10. compass_kb_validation-1.0.0/discover_and_validate.py +184 -0
  11. compass_kb_validation-1.0.0/ingestion_validation/__init__.py +8 -0
  12. compass_kb_validation-1.0.0/ingestion_validation/config/__init__.py +428 -0
  13. compass_kb_validation-1.0.0/ingestion_validation/corpus.py +113 -0
  14. compass_kb_validation-1.0.0/ingestion_validation/live_dashboard.py +161 -0
  15. compass_kb_validation-1.0.0/ingestion_validation/models/__init__.py +117 -0
  16. compass_kb_validation-1.0.0/ingestion_validation/notifications.py +111 -0
  17. compass_kb_validation-1.0.0/ingestion_validation/pipeline/__init__.py +128 -0
  18. compass_kb_validation-1.0.0/ingestion_validation/providers/__init__.py +94 -0
  19. compass_kb_validation-1.0.0/ingestion_validation/providers/graph.py +179 -0
  20. compass_kb_validation-1.0.0/ingestion_validation/providers/source.py +141 -0
  21. compass_kb_validation-1.0.0/ingestion_validation/providers/storage.py +238 -0
  22. compass_kb_validation-1.0.0/ingestion_validation/providers/vectorstore.py +805 -0
  23. compass_kb_validation-1.0.0/ingestion_validation/remediation.py +77 -0
  24. compass_kb_validation-1.0.0/ingestion_validation/report/__init__.py +1040 -0
  25. compass_kb_validation-1.0.0/ingestion_validation/report/_report_css.py +874 -0
  26. compass_kb_validation-1.0.0/ingestion_validation/report/_report_js.py +477 -0
  27. compass_kb_validation-1.0.0/ingestion_validation/report/export.py +126 -0
  28. compass_kb_validation-1.0.0/ingestion_validation/trend_tracker.py +167 -0
  29. compass_kb_validation-1.0.0/ingestion_validation/utils/__init__.py +106 -0
  30. compass_kb_validation-1.0.0/ingestion_validation/validators/__init__.py +21 -0
  31. compass_kb_validation-1.0.0/ingestion_validation/validators/api_upload.py +228 -0
  32. compass_kb_validation-1.0.0/ingestion_validation/validators/base.py +25 -0
  33. compass_kb_validation-1.0.0/ingestion_validation/validators/base_sparql.py +235 -0
  34. compass_kb_validation-1.0.0/ingestion_validation/validators/graphdb_metadata.py +44 -0
  35. compass_kb_validation-1.0.0/ingestion_validation/validators/neptune_metadata.py +55 -0
  36. compass_kb_validation-1.0.0/ingestion_validation/validators/redis_chunks.py +542 -0
  37. compass_kb_validation-1.0.0/ingestion_validation/validators/registry.py +150 -0
  38. compass_kb_validation-1.0.0/ingestion_validation/validators/retrieval_quality.py +172 -0
  39. compass_kb_validation-1.0.0/ingestion_validation/validators/s3_storage.py +236 -0
  40. compass_kb_validation-1.0.0/ingestion_validation/validators/ui_document.py +155 -0
  41. compass_kb_validation-1.0.0/pyproject.toml +74 -0
  42. compass_kb_validation-1.0.0/run_validation.py +185 -0
  43. compass_kb_validation-1.0.0/setup.cfg +4 -0
  44. compass_kb_validation-1.0.0/tests/test_alt_adapters.py +402 -0
  45. compass_kb_validation-1.0.0/tests/test_api_upload.py +124 -0
  46. compass_kb_validation-1.0.0/tests/test_config.py +151 -0
  47. compass_kb_validation-1.0.0/tests/test_corpus.py +110 -0
  48. compass_kb_validation-1.0.0/tests/test_gate.py +108 -0
  49. compass_kb_validation-1.0.0/tests/test_graph_validators.py +163 -0
  50. compass_kb_validation-1.0.0/tests/test_models.py +76 -0
  51. compass_kb_validation-1.0.0/tests/test_notifications.py +66 -0
  52. compass_kb_validation-1.0.0/tests/test_pipeline.py +109 -0
  53. compass_kb_validation-1.0.0/tests/test_providers.py +58 -0
  54. compass_kb_validation-1.0.0/tests/test_redis_chunks.py +206 -0
  55. compass_kb_validation-1.0.0/tests/test_registry.py +68 -0
  56. compass_kb_validation-1.0.0/tests/test_remediation.py +25 -0
  57. compass_kb_validation-1.0.0/tests/test_reporting.py +195 -0
  58. compass_kb_validation-1.0.0/tests/test_retrieval_quality.py +80 -0
  59. compass_kb_validation-1.0.0/tests/test_sources.py +108 -0
  60. compass_kb_validation-1.0.0/tests/test_storage_validator.py +74 -0
  61. compass_kb_validation-1.0.0/tests/test_trends.py +85 -0
  62. compass_kb_validation-1.0.0/tests/test_ui_validator.py +43 -0
  63. compass_kb_validation-1.0.0/tests/test_utils.py +56 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 COMPASS Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,305 @@
1
+ Metadata-Version: 2.4
2
+ Name: compass-kb-validation
3
+ Version: 1.0.0
4
+ Summary: Knowledge-base readiness validation for RAG & AI agents — config-driven, deterministic pipeline integrity checks.
5
+ Author: COMPASS
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/TestAutomationArchitect/compass
8
+ Project-URL: Repository, https://github.com/TestAutomationArchitect/compass
9
+ Project-URL: Issues, https://github.com/TestAutomationArchitect/compass/issues
10
+ Keywords: rag,knowledge-base,vector-database,data-validation,pipeline-testing,llm-infrastructure
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Software Development :: Quality Assurance
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: requests>=2.31.0
21
+ Requires-Dist: boto3>=1.34.0
22
+ Requires-Dist: pyyaml>=6.0.1
23
+ Requires-Dist: python-dotenv>=1.0.0
24
+ Requires-Dist: redis>=5.0.0
25
+ Provides-Extra: dashboard
26
+ Requires-Dist: fastapi>=0.104.0; extra == "dashboard"
27
+ Requires-Dist: uvicorn>=0.24.0; extra == "dashboard"
28
+ Provides-Extra: pdf
29
+ Requires-Dist: PyPDF2>=3.0.0; extra == "pdf"
30
+ Provides-Extra: ui
31
+ Requires-Dist: playwright>=1.40.0; extra == "ui"
32
+ Provides-Extra: qdrant
33
+ Requires-Dist: qdrant-client>=1.7.0; extra == "qdrant"
34
+ Provides-Extra: pgvector
35
+ Requires-Dist: psycopg[binary]>=3.1; extra == "pgvector"
36
+ Provides-Extra: pinecone
37
+ Requires-Dist: pinecone>=5.0.0; extra == "pinecone"
38
+ Provides-Extra: weaviate
39
+ Requires-Dist: weaviate-client>=4.5.0; extra == "weaviate"
40
+ Provides-Extra: azure
41
+ Requires-Dist: azure-storage-blob>=12.0.0; extra == "azure"
42
+ Requires-Dist: azure-identity>=1.15.0; extra == "azure"
43
+ Provides-Extra: gcs
44
+ Requires-Dist: google-cloud-storage>=2.10.0; extra == "gcs"
45
+ Provides-Extra: all
46
+ Requires-Dist: fastapi>=0.104.0; extra == "all"
47
+ Requires-Dist: uvicorn>=0.24.0; extra == "all"
48
+ Requires-Dist: PyPDF2>=3.0.0; extra == "all"
49
+ Requires-Dist: playwright>=1.40.0; extra == "all"
50
+ Requires-Dist: qdrant-client>=1.7.0; extra == "all"
51
+ Requires-Dist: psycopg[binary]>=3.1; extra == "all"
52
+ Requires-Dist: pinecone>=5.0.0; extra == "all"
53
+ Requires-Dist: weaviate-client>=4.5.0; extra == "all"
54
+ Requires-Dist: azure-storage-blob>=12.0.0; extra == "all"
55
+ Requires-Dist: azure-identity>=1.15.0; extra == "all"
56
+ Requires-Dist: google-cloud-storage>=2.10.0; extra == "all"
57
+ Provides-Extra: dev
58
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
59
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
60
+ Requires-Dist: pyflakes>=3.0.0; extra == "dev"
61
+ Requires-Dist: pyright==1.1.409; extra == "dev"
62
+ Requires-Dist: bandit>=1.7.5; extra == "dev"
63
+ Requires-Dist: pip-audit>=2.6.0; extra == "dev"
64
+ Dynamic: license-file
65
+
66
+ # COMPASS — Knowledge-Base Readiness Validation for RAG & AI Agents
67
+
68
+ [![CI](https://github.com/TestAutomationArchitect/compass/actions/workflows/ci.yml/badge.svg)](https://github.com/TestAutomationArchitect/compass/actions/workflows/ci.yml)
69
+
70
+ **COMPASS** — **COM**prehensive **P**ipeline **A**nalysis & **S**tructure **S**earch
71
+
72
+ A config-driven, **deterministic** framework that proves an AI/RAG knowledge base is correctly **built, intact, and retrievable** — *before* AI agents consume it. It's the integrity gate beneath answer-quality evaluation: not "are the answers good?" but **"is the knowledge base itself sound?"**
73
+
74
+ ## What COMPASS Does
75
+
76
+ COMPASS validates a document's journey through your ingestion pipeline and verifies the resulting knowledge base is agent-ready. The pipeline is **declarative** — you choose which steps run, in what order, in YAML — and ships with these built-in steps:
77
+
78
+ ```
79
+ API Upload → Object Storage → Knowledge Graph → Vector Store → Retrieval → UI Visibility
80
+ ```
81
+
82
+ Enable only the steps your setup has (no object store? no graph? drop them), reorder them, or register your own. For each enabled step it deterministically checks, for example:
83
+
84
+ - **Ingestion** — the document was accepted and assigned an id
85
+ - **Object storage** — it persisted with the right content type, size, and integrity (S3, MinIO, R2, Azure Blob, GCS…)
86
+ - **Knowledge graph** — required metadata predicates are present and well-formed (GraphDB, Neptune, Neo4j…)
87
+ - **Vector store** — chunks exist with valid embeddings, correct dimensions/metric, sane ordering/overlap, no cross-document contamination (Redis, Qdrant, Pinecone, pgvector…) — **28 toggleable checks**
88
+ - **Retrieval** — the document's own content is actually retrievable (recall@K, MRR — informational)
89
+ - **UI visibility** — it surfaces in the end-user application
90
+
91
+ Two modes: **live** validation as documents are ingested, and **post-hoc discovery** of a corpus that's already loaded.
92
+
93
+ > 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.
94
+
95
+ ## Key Features
96
+
97
+ ✅ **Declarative pipeline** — choose/reorder/extend steps in YAML; no fixed shape
98
+ ✅ **Config-Driven** — zero code changes per project; all customization in YAML
99
+ ✅ **Pluggable backends** — storage / vector store / knowledge graph via a provider registry (one file to add a vendor)
100
+ ✅ **Pluggable steps** — register custom validators in a step registry; the report adapts automatically
101
+ ✅ **Deterministic & cheap** — structural/byte/schema checks, no LLM, CI-gateable
102
+ ✅ **Interactive reporting** — self-contained HTML dashboard + JSON + JUnit XML
103
+ ✅ **Trend Tracking** — SQLite historical performance analysis
104
+ ✅ **Notifications** — Slack/Teams webhooks for alerts
105
+ ✅ **Parallel Execution** — process many documents concurrently
106
+ ✅ **Graceful Degradation** — non-critical failures don't crash the pipeline
107
+
108
+ ## Quick Start
109
+
110
+ Install the package (core deps only; add extras per backend — see below):
111
+
112
+ ```bash
113
+ pip install compass-kb-validation
114
+ # backends/features on demand, e.g.:
115
+ pip install "compass-kb-validation[qdrant,pgvector]"
116
+ ```
117
+
118
+ This installs two commands: `compass-validate` (live) and `compass-discover` (post-hoc).
119
+ Create a project config (`config/projects/<name>.yaml`) and, for live validation,
120
+ a `test_data/<name>.yaml` listing the documents to push. Then:
121
+
122
+ ```bash
123
+ # Live ingestion — validate documents as they're uploaded through your API
124
+ compass-validate --project my-kb --output-format all
125
+
126
+ # Post-hoc discovery — validate a knowledge base that's already populated
127
+ compass-discover --project my-kb --include-retrieval
128
+
129
+ # Validate connectivity/config only (no backends hit)
130
+ compass-validate --project my-kb --dry-run
131
+ ```
132
+
133
+ > From source instead of PyPI: `git clone … && cd compass && pip install -e ".[all]"`.
134
+ > Releases are published via [PUBLISHING.md](PUBLISHING.md).
135
+
136
+ Reports are written to `reports/` (HTML dashboard + JSON + JUnit XML). Add
137
+ `--live` to open a real-time progress dashboard, `--trends` to record history,
138
+ `--parallel` for concurrency.
139
+
140
+ ### Try it locally (no cloud needed)
141
+
142
+ A self-contained Docker stack runs the full pipeline against MinIO + Redis Stack +
143
+ a mock ingestion API — see **[integration/README.md](integration/README.md)**.
144
+
145
+ ## Project Structure
146
+
147
+ ```
148
+ compass/
149
+ ├── run_validation.py # Entry point — live ingestion validation
150
+ ├── discover_and_validate.py # Entry point — post-hoc discovery
151
+ ├── ingestion_validation/ # Main package
152
+ │ ├── models/ # StepResult / PipelineResult (stdlib dataclasses)
153
+ │ ├── config/ # Layered YAML config + typed Settings
154
+ │ ├── utils/ # Run-id, logging, polling w/ backoff
155
+ │ ├── providers/ # Pluggable backends via a registry:
156
+ │ │ ├── storage.py # object storage (S3-family…)
157
+ │ │ ├── vectorstore.py # vector store (Redis/RediSearch…)
158
+ │ │ ├── graph.py # knowledge graph (SPARQL, Neptune…)
159
+ │ │ └── source.py # document discovery (storage|index|manifest)
160
+ │ ├── validators/ # BaseValidator + step registry + the steps
161
+ │ │ └── registry.py # declarative pipeline (StepSpec registry)
162
+ │ ├── pipeline/ # Orchestrator (context propagation, halting)
163
+ │ ├── report/ # Self-contained HTML dashboard + JSON/JUnit
164
+ │ ├── corpus.py # Corpus-level KB readiness analysis
165
+ │ ├── live_dashboard.py # FastAPI + SSE real-time dashboard
166
+ │ ├── notifications.py # Slack / Teams webhooks
167
+ │ └── trend_tracker.py # SQLite historical trends
168
+ ├── config/{base.yaml, projects/_template.yaml}
169
+ ├── test_data/_template.yaml # Documents to validate (live mode)
170
+ ├── integration/ # Local Docker integration stack
171
+ ├── tests/ # Unit tests (backends faked — no live services)
172
+ └── reports/ # Generated reports (gitignored)
173
+ ```
174
+
175
+ ## Documentation
176
+
177
+ - **[ARCHITECTURE.md](ARCHITECTURE.md)** — how COMPASS is built: layers, data flow, the registries, the two run modes, extension points
178
+ - **[EXTENDING-BACKENDS.md](EXTENDING-BACKENDS.md)** — add a new backend (storage/vector/graph/source) or a new pipeline step
179
+ - **[integration/README.md](integration/README.md)** — run the full pipeline locally on Docker
180
+ - [CONTRIBUTING.md](CONTRIBUTING.md) · [SECURITY.md](SECURITY.md)
181
+
182
+ ## Configuration
183
+
184
+ All behaviour lives in YAML; credentials are referenced by **environment-variable
185
+ name** and resolved at runtime (never stored in config). `config/base.yaml` holds
186
+ shared defaults; each `config/projects/<name>.yaml` overlays only what differs and
187
+ selects a `dev`/`staging`/`prod` environment block.
188
+
189
+ ```yaml
190
+ # config/projects/my-kb.yaml
191
+ display_name: "My Knowledge Base"
192
+
193
+ # Declarative pipeline — choose which steps run, in what order (registry keys).
194
+ # Omit to use the full default pipeline.
195
+ pipeline:
196
+ steps: [api_upload, s3_storage, redis_chunks, retrieval_quality]
197
+ critical_steps: ["API Upload", "S3 Storage"] # failure here halts the run
198
+
199
+ # Where post-hoc discovery finds documents: storage | vectorstore | manifest
200
+ discovery:
201
+ provider: vectorstore # enumerate the KB straight from the index
202
+
203
+ environments:
204
+ dev:
205
+ api:
206
+ base_url_env: API_BASE_URL # env-var NAME, not the value
207
+ graphql_mutation: |
208
+ mutation ($file: Upload!, $metadata: JSON) { uploadDocument(file:$file, metadata:$metadata){ status document_id } }
209
+ s3:
210
+ provider: s3 # s3 | minio | r2 | azure_blob | gcs …
211
+ bucket_name: my-documents
212
+ prefix: knowledge-base/
213
+ redis:
214
+ provider: redis # redis | qdrant | pinecone | pgvector …
215
+ search_index: my_embeddings
216
+ expected_embedding_dim: 1536
217
+ expected_distance_metric: COSINE
218
+ ```
219
+
220
+ ## Advanced Usage
221
+
222
+ ### Add a custom pipeline step
223
+
224
+ Steps are declarative — register a validator and reference it in `pipeline.steps`:
225
+
226
+ ```python
227
+ from ingestion_validation.validators.base import BaseValidator
228
+ from ingestion_validation.validators.registry import register_step, StepSpec
229
+ from ingestion_validation.models import StepResult, StepStatus
230
+
231
+ class PiiRedactionValidator(BaseValidator):
232
+ step_name = "PII Redaction"
233
+ def __init__(self, config): self.config = config
234
+ def validate(self, context: dict) -> StepResult:
235
+ return StepResult(self.step_name, StepStatus.PASSED, "no PII leaked")
236
+
237
+ register_step(StepSpec(
238
+ key="pii_redaction", name="PII Redaction",
239
+ factory=lambda settings, shared: PiiRedactionValidator(settings.s3),
240
+ abbr="PII", order=25,
241
+ ))
242
+ # then: pipeline.steps: [api_upload, pii_redaction, redis_chunks]
243
+ ```
244
+
245
+ The orchestrator, live dashboard, and HTML report adapt automatically. See
246
+ **[EXTENDING-BACKENDS.md](EXTENDING-BACKENDS.md)** for adding backends too.
247
+
248
+ ### CI/CD integration — the readiness gate
249
+
250
+ COMPASS is built to run **before** your agents or eval consume the knowledge
251
+ base: wire it into the pipeline that publishes the KB and fail the build when
252
+ the KB is not retrieval-ready. Every entry point returns a CI-friendly exit
253
+ code — **0 = gate passed, 1 = gate failed, 2 = config error** — and emits JUnit
254
+ XML for any CI system.
255
+
256
+ **Gate strictness** (discovery mode) is yours to choose:
257
+
258
+ ```bash
259
+ # Strictest: any failed document fails the build (default)
260
+ compass-discover --project my-kb
261
+
262
+ # Tolerate a few failures: require >= 95% of documents to pass
263
+ compass-discover --project my-kb --fail-under 95
264
+
265
+ # Also require the corpus to be READY (completeness/coverage/dedup verdict)
266
+ compass-discover --project my-kb --require-ready
267
+ ```
268
+
269
+ **GitHub Actions** — drop the reusable action into your KB pipeline:
270
+
271
+ ```yaml
272
+ # .github/workflows/kb-readiness.yml
273
+ jobs:
274
+ kb-readiness:
275
+ runs-on: ubuntu-latest
276
+ steps:
277
+ - uses: actions/checkout@v4 # your repo holds config/projects/<name>.yaml
278
+ - uses: TestAutomationArchitect/compass@v1
279
+ with:
280
+ project: my-kb
281
+ require-ready: "true" # block promotion unless READY
282
+ # fail-under: "95" # ...or tolerate a bounded failure rate
283
+ env:
284
+ REDIS_HOST: ${{ secrets.REDIS_HOST }} # config references env-var names; supply them here
285
+ ```
286
+
287
+ A full example you can copy is in **[examples/kb-readiness.yml](examples/kb-readiness.yml)**.
288
+
289
+ **Container** — no Python setup needed; works in any CI or a self-hosted runner:
290
+
291
+ ```bash
292
+ docker build -t compass:latest .
293
+ docker run --rm -v "$PWD:/work" --env-file .env \
294
+ compass:latest compass-discover --project my-kb --require-ready
295
+ ```
296
+
297
+ ## Applicable Domains
298
+
299
+ Enterprise document management · legal/compliance · healthcare · financial
300
+ research · customer-support KBs · internal wikis · e-commerce catalogs · academic
301
+ repositories — any RAG/agent knowledge base built from a document pipeline.
302
+
303
+ ## License
304
+
305
+ MIT License — see [LICENSE](LICENSE).
@@ -0,0 +1,240 @@
1
+ # COMPASS — Knowledge-Base Readiness Validation for RAG & AI Agents
2
+
3
+ [![CI](https://github.com/TestAutomationArchitect/compass/actions/workflows/ci.yml/badge.svg)](https://github.com/TestAutomationArchitect/compass/actions/workflows/ci.yml)
4
+
5
+ **COMPASS** — **COM**prehensive **P**ipeline **A**nalysis & **S**tructure **S**earch
6
+
7
+ A config-driven, **deterministic** framework that proves an AI/RAG knowledge base is correctly **built, intact, and retrievable** — *before* AI agents consume it. It's the integrity gate beneath answer-quality evaluation: not "are the answers good?" but **"is the knowledge base itself sound?"**
8
+
9
+ ## What COMPASS Does
10
+
11
+ COMPASS validates a document's journey through your ingestion pipeline and verifies the resulting knowledge base is agent-ready. The pipeline is **declarative** — you choose which steps run, in what order, in YAML — and ships with these built-in steps:
12
+
13
+ ```
14
+ API Upload → Object Storage → Knowledge Graph → Vector Store → Retrieval → UI Visibility
15
+ ```
16
+
17
+ Enable only the steps your setup has (no object store? no graph? drop them), reorder them, or register your own. For each enabled step it deterministically checks, for example:
18
+
19
+ - **Ingestion** — the document was accepted and assigned an id
20
+ - **Object storage** — it persisted with the right content type, size, and integrity (S3, MinIO, R2, Azure Blob, GCS…)
21
+ - **Knowledge graph** — required metadata predicates are present and well-formed (GraphDB, Neptune, Neo4j…)
22
+ - **Vector store** — chunks exist with valid embeddings, correct dimensions/metric, sane ordering/overlap, no cross-document contamination (Redis, Qdrant, Pinecone, pgvector…) — **28 toggleable checks**
23
+ - **Retrieval** — the document's own content is actually retrievable (recall@K, MRR — informational)
24
+ - **UI visibility** — it surfaces in the end-user application
25
+
26
+ Two modes: **live** validation as documents are ingested, and **post-hoc discovery** of a corpus that's already loaded.
27
+
28
+ > 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.
29
+
30
+ ## Key Features
31
+
32
+ ✅ **Declarative pipeline** — choose/reorder/extend steps in YAML; no fixed shape
33
+ ✅ **Config-Driven** — zero code changes per project; all customization in YAML
34
+ ✅ **Pluggable backends** — storage / vector store / knowledge graph via a provider registry (one file to add a vendor)
35
+ ✅ **Pluggable steps** — register custom validators in a step registry; the report adapts automatically
36
+ ✅ **Deterministic & cheap** — structural/byte/schema checks, no LLM, CI-gateable
37
+ ✅ **Interactive reporting** — self-contained HTML dashboard + JSON + JUnit XML
38
+ ✅ **Trend Tracking** — SQLite historical performance analysis
39
+ ✅ **Notifications** — Slack/Teams webhooks for alerts
40
+ ✅ **Parallel Execution** — process many documents concurrently
41
+ ✅ **Graceful Degradation** — non-critical failures don't crash the pipeline
42
+
43
+ ## Quick Start
44
+
45
+ Install the package (core deps only; add extras per backend — see below):
46
+
47
+ ```bash
48
+ pip install compass-kb-validation
49
+ # backends/features on demand, e.g.:
50
+ pip install "compass-kb-validation[qdrant,pgvector]"
51
+ ```
52
+
53
+ This installs two commands: `compass-validate` (live) and `compass-discover` (post-hoc).
54
+ Create a project config (`config/projects/<name>.yaml`) and, for live validation,
55
+ a `test_data/<name>.yaml` listing the documents to push. Then:
56
+
57
+ ```bash
58
+ # Live ingestion — validate documents as they're uploaded through your API
59
+ compass-validate --project my-kb --output-format all
60
+
61
+ # Post-hoc discovery — validate a knowledge base that's already populated
62
+ compass-discover --project my-kb --include-retrieval
63
+
64
+ # Validate connectivity/config only (no backends hit)
65
+ compass-validate --project my-kb --dry-run
66
+ ```
67
+
68
+ > From source instead of PyPI: `git clone … && cd compass && pip install -e ".[all]"`.
69
+ > Releases are published via [PUBLISHING.md](PUBLISHING.md).
70
+
71
+ Reports are written to `reports/` (HTML dashboard + JSON + JUnit XML). Add
72
+ `--live` to open a real-time progress dashboard, `--trends` to record history,
73
+ `--parallel` for concurrency.
74
+
75
+ ### Try it locally (no cloud needed)
76
+
77
+ A self-contained Docker stack runs the full pipeline against MinIO + Redis Stack +
78
+ a mock ingestion API — see **[integration/README.md](integration/README.md)**.
79
+
80
+ ## Project Structure
81
+
82
+ ```
83
+ compass/
84
+ ├── run_validation.py # Entry point — live ingestion validation
85
+ ├── discover_and_validate.py # Entry point — post-hoc discovery
86
+ ├── ingestion_validation/ # Main package
87
+ │ ├── models/ # StepResult / PipelineResult (stdlib dataclasses)
88
+ │ ├── config/ # Layered YAML config + typed Settings
89
+ │ ├── utils/ # Run-id, logging, polling w/ backoff
90
+ │ ├── providers/ # Pluggable backends via a registry:
91
+ │ │ ├── storage.py # object storage (S3-family…)
92
+ │ │ ├── vectorstore.py # vector store (Redis/RediSearch…)
93
+ │ │ ├── graph.py # knowledge graph (SPARQL, Neptune…)
94
+ │ │ └── source.py # document discovery (storage|index|manifest)
95
+ │ ├── validators/ # BaseValidator + step registry + the steps
96
+ │ │ └── registry.py # declarative pipeline (StepSpec registry)
97
+ │ ├── pipeline/ # Orchestrator (context propagation, halting)
98
+ │ ├── report/ # Self-contained HTML dashboard + JSON/JUnit
99
+ │ ├── corpus.py # Corpus-level KB readiness analysis
100
+ │ ├── live_dashboard.py # FastAPI + SSE real-time dashboard
101
+ │ ├── notifications.py # Slack / Teams webhooks
102
+ │ └── trend_tracker.py # SQLite historical trends
103
+ ├── config/{base.yaml, projects/_template.yaml}
104
+ ├── test_data/_template.yaml # Documents to validate (live mode)
105
+ ├── integration/ # Local Docker integration stack
106
+ ├── tests/ # Unit tests (backends faked — no live services)
107
+ └── reports/ # Generated reports (gitignored)
108
+ ```
109
+
110
+ ## Documentation
111
+
112
+ - **[ARCHITECTURE.md](ARCHITECTURE.md)** — how COMPASS is built: layers, data flow, the registries, the two run modes, extension points
113
+ - **[EXTENDING-BACKENDS.md](EXTENDING-BACKENDS.md)** — add a new backend (storage/vector/graph/source) or a new pipeline step
114
+ - **[integration/README.md](integration/README.md)** — run the full pipeline locally on Docker
115
+ - [CONTRIBUTING.md](CONTRIBUTING.md) · [SECURITY.md](SECURITY.md)
116
+
117
+ ## Configuration
118
+
119
+ All behaviour lives in YAML; credentials are referenced by **environment-variable
120
+ name** and resolved at runtime (never stored in config). `config/base.yaml` holds
121
+ shared defaults; each `config/projects/<name>.yaml` overlays only what differs and
122
+ selects a `dev`/`staging`/`prod` environment block.
123
+
124
+ ```yaml
125
+ # config/projects/my-kb.yaml
126
+ display_name: "My Knowledge Base"
127
+
128
+ # Declarative pipeline — choose which steps run, in what order (registry keys).
129
+ # Omit to use the full default pipeline.
130
+ pipeline:
131
+ steps: [api_upload, s3_storage, redis_chunks, retrieval_quality]
132
+ critical_steps: ["API Upload", "S3 Storage"] # failure here halts the run
133
+
134
+ # Where post-hoc discovery finds documents: storage | vectorstore | manifest
135
+ discovery:
136
+ provider: vectorstore # enumerate the KB straight from the index
137
+
138
+ environments:
139
+ dev:
140
+ api:
141
+ base_url_env: API_BASE_URL # env-var NAME, not the value
142
+ graphql_mutation: |
143
+ mutation ($file: Upload!, $metadata: JSON) { uploadDocument(file:$file, metadata:$metadata){ status document_id } }
144
+ s3:
145
+ provider: s3 # s3 | minio | r2 | azure_blob | gcs …
146
+ bucket_name: my-documents
147
+ prefix: knowledge-base/
148
+ redis:
149
+ provider: redis # redis | qdrant | pinecone | pgvector …
150
+ search_index: my_embeddings
151
+ expected_embedding_dim: 1536
152
+ expected_distance_metric: COSINE
153
+ ```
154
+
155
+ ## Advanced Usage
156
+
157
+ ### Add a custom pipeline step
158
+
159
+ Steps are declarative — register a validator and reference it in `pipeline.steps`:
160
+
161
+ ```python
162
+ from ingestion_validation.validators.base import BaseValidator
163
+ from ingestion_validation.validators.registry import register_step, StepSpec
164
+ from ingestion_validation.models import StepResult, StepStatus
165
+
166
+ class PiiRedactionValidator(BaseValidator):
167
+ step_name = "PII Redaction"
168
+ def __init__(self, config): self.config = config
169
+ def validate(self, context: dict) -> StepResult:
170
+ return StepResult(self.step_name, StepStatus.PASSED, "no PII leaked")
171
+
172
+ register_step(StepSpec(
173
+ key="pii_redaction", name="PII Redaction",
174
+ factory=lambda settings, shared: PiiRedactionValidator(settings.s3),
175
+ abbr="PII", order=25,
176
+ ))
177
+ # then: pipeline.steps: [api_upload, pii_redaction, redis_chunks]
178
+ ```
179
+
180
+ The orchestrator, live dashboard, and HTML report adapt automatically. See
181
+ **[EXTENDING-BACKENDS.md](EXTENDING-BACKENDS.md)** for adding backends too.
182
+
183
+ ### CI/CD integration — the readiness gate
184
+
185
+ COMPASS is built to run **before** your agents or eval consume the knowledge
186
+ base: wire it into the pipeline that publishes the KB and fail the build when
187
+ the KB is not retrieval-ready. Every entry point returns a CI-friendly exit
188
+ code — **0 = gate passed, 1 = gate failed, 2 = config error** — and emits JUnit
189
+ XML for any CI system.
190
+
191
+ **Gate strictness** (discovery mode) is yours to choose:
192
+
193
+ ```bash
194
+ # Strictest: any failed document fails the build (default)
195
+ compass-discover --project my-kb
196
+
197
+ # Tolerate a few failures: require >= 95% of documents to pass
198
+ compass-discover --project my-kb --fail-under 95
199
+
200
+ # Also require the corpus to be READY (completeness/coverage/dedup verdict)
201
+ compass-discover --project my-kb --require-ready
202
+ ```
203
+
204
+ **GitHub Actions** — drop the reusable action into your KB pipeline:
205
+
206
+ ```yaml
207
+ # .github/workflows/kb-readiness.yml
208
+ jobs:
209
+ kb-readiness:
210
+ runs-on: ubuntu-latest
211
+ steps:
212
+ - uses: actions/checkout@v4 # your repo holds config/projects/<name>.yaml
213
+ - uses: TestAutomationArchitect/compass@v1
214
+ with:
215
+ project: my-kb
216
+ require-ready: "true" # block promotion unless READY
217
+ # fail-under: "95" # ...or tolerate a bounded failure rate
218
+ env:
219
+ REDIS_HOST: ${{ secrets.REDIS_HOST }} # config references env-var names; supply them here
220
+ ```
221
+
222
+ A full example you can copy is in **[examples/kb-readiness.yml](examples/kb-readiness.yml)**.
223
+
224
+ **Container** — no Python setup needed; works in any CI or a self-hosted runner:
225
+
226
+ ```bash
227
+ docker build -t compass:latest .
228
+ docker run --rm -v "$PWD:/work" --env-file .env \
229
+ compass:latest compass-discover --project my-kb --require-ready
230
+ ```
231
+
232
+ ## Applicable Domains
233
+
234
+ Enterprise document management · legal/compliance · healthcare · financial
235
+ research · customer-support KBs · internal wikis · e-commerce catalogs · academic
236
+ repositories — any RAG/agent knowledge base built from a document pipeline.
237
+
238
+ ## License
239
+
240
+ MIT License — see [LICENSE](LICENSE).