haiku.rag/haiku_rag_slim/haiku/rag
Yiorgis Gozadinos 0592206f16
Make run_db_checks an orchestration list
At 327 lines it interleaved reading the tables, deriving the lookups every
check needs, and the bodies of ten checks. Six checks were already
functions; the rest were inline, so none of them could be read or tested
without the others around them.

Each one is now a function taking exactly what it needs:
_check_document_meta_parity, _check_orphaned_chunks, _check_orphaned_items,
_check_documents_without_items, _check_dangling_item_refs,
_check_vector_dimension, _check_unembedded_chunks, _check_picture_data,
_check_settings_row and _check_pending_migrations. run_db_checks reads the
tables, then appends results.

_document_centroids takes the vector reduction. Passing the matrix as a
parameter keeps it a local of run_db_checks, so the del before clustering
still drops the last reference — measured at 6.2 MB allocated to reduce a
102 MB matrix, no second copy. There is no snapshot object: one holding
vectors would keep the largest allocation alive past the del.

The reduction also rebound doc_ids from the document-id set to the centroid
id list halfway through the function. The centroid ids have their own name
now.

No test changes: the 80 doctor tests cover these through run_db_checks and
pass unchanged.
2026-08-20 14:22:29 +03:00
..
capabilities Give the evidence capabilities one typed state 2026-08-19 17:08:44 +03:00
chat Give the evidence capabilities one typed state 2026-08-19 17:08:44 +03:00
chunkers Make get_config the only configuration lookup 2026-08-19 14:43:40 +03:00
client Split the store module by responsibility 2026-08-20 12:13:51 +03:00
config Make the documented configuration match the code 2026-08-19 15:52:50 +03:00
converters Make get_config the only configuration lookup 2026-08-19 14:43:40 +03:00
embeddings Make get_config the only configuration lookup 2026-08-19 14:43:40 +03:00
ingester Split the store module by responsibility 2026-08-20 12:13:51 +03:00
inspector Split the store module by responsibility 2026-08-20 12:13:51 +03:00
providers Wire providers.docling_serve.timeout through to the client 2026-08-19 13:30:45 +03:00
reranking Reject unknown and out-of-range configuration values 2026-08-19 15:32:51 +03:00
sandbox Point the limit comments at the right limits 2026-07-28 19:11:37 +03:00
sources Move source adapters out of the ingester package 2026-08-20 11:46:55 +03:00
store Split the store module by responsibility 2026-08-20 12:13:51 +03:00
tools Move the wire rewrite into the compaction capability 2026-08-13 13:00:02 +03:00
__init__.py Restructure into uv workspace to support minimal and full installations 2025-11-04 17:59:12 +02:00
app.py Measure the CLI and its application layer 2026-08-20 13:23:00 +03:00
circuit_breaker.py Move CircuitBreaker to a shared module 2026-07-08 11:03:30 +03:00
cli.py Measure the CLI and its application layer 2026-08-20 13:23:00 +03:00
context.py Batch context expansion across documents 2026-08-18 16:35:17 +03:00
doctor.py Make run_db_checks an orchestration list 2026-08-20 14:22:29 +03:00
logging.py Restructure into uv workspace to support minimal and full installations 2025-11-04 17:59:12 +02:00
mcp.py Make get_config the only configuration lookup 2026-08-19 14:43:40 +03:00
s3.py swap aioboto3 for obstore in the S3 client path 2026-05-11 11:29:42 +03:00
telemetry.py Route eval scripts through the shared telemetry configure 2026-07-10 11:38:33 +03:00
utils.py Reject unknown and out-of-range configuration values 2026-08-19 15:32:51 +03:00