by sreekanth850 · 4mo ago · 0 comments
It includes a custom WAL, structure aware semantic chunking, ingestion and indexing pipelines, hybrid (rrf), text and vector retrieval, ACL aware filtering at query level, query classifier, citation tracking, and a CrateDB backend that performs fused retrieval over a single table. total LOC: 180 K. Status: evaluation by State agencies for investigative search on legacy documents. tool used - Codex, Luna, and earlier codex 5.3, and gpt 4 mini.
The ingestion side includes durable asynchronous processing, recovery and replay, idempotency, strict ordering, structure aware segmentation, parent child relationships, and batched local embedding. The retrieval side includes hybrid (rrf), text and vector search, document versioning, collection and category scoping, document level ACL enforcement, parent expansion, provenance, and citation tracking.
Your estimate is fair. But, reliable WAL and retrieval layer are each substantial projects. We did not build the underlying database query engine from scratch, but the correctness work around ingestion, recovery, hierarchy, security, ranking, and provenance was still significant.
The project now has more than 3,000 automated tests, including coverage for recovery, concurrency, ordering, ACLs, versioning, and retrieval behaviour. Tests are not proof of correctness, but incremental implementation, explicit invariants, failure testing, and continuous human review are how we built confidence in it. We also had script to automate live endpoint tests with real data samples, this help largely to mitigate issues after a refactoring or enhancement. total production code is 80k LOC and rest is test coverages. One thing to say after seeing the results are, many of the RAG framework does it wrong. We got exceptional results and we also have agentic retrieval for answering complex queries. We designed it in our own way because government systems cannot afford false results, especially when the product is intended for crime investigation or compliance management in banks.
Edit: I forgot to mention that we also support PostgreSQL.
After building this system, we concluded that vector dimensionality is only a small part of retrieval accuracy. We use 384 dim embeddings and still achieve excellent results.
Great, but since no human has looked at them, how do you know that they are relevant and actually test undesired behavior?
Also, would you be able to point at which tests should be added in the future?
We also use a headless API with a fully decoupled frontend, and the frontend is written entirely by developers. This helps catch additional issues during integration because every endpoint is exercised and validated through the actual userfacing workflows.
I may not be able to convince developers about the process we follow, but we got it working, and tested for concurrency, load and fanout behaviour. This is our primary requirement, as this is targeted towards large scale government customers. Regarding future tests, they will be added for new features, reported bugs, newly discovered failure modes, and regressions. This level of test coverage also helps us use AI without allowing significant drift in the codebase.