The rag store moves to SQLite: tag A one-shots, tag B cutover (ci-images#19 step 2) #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ceres/19-rag-cutover"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs macula-io/macula-ci-images#19 (step 2: the rag store's cutover off barrel/RocksDB onto SQLite)
This ships as two tags (Uranus's pick (1), ruled by the Supervisor):
b0a671b5: the cutover one-shots (rag_barrel_export, rag_barrel_import, rag_export_file, scripts/rag-oneshot.sh). barrel is still in deps. Built in the rocksdb image pair.7b027636: the SQLite cutover (Rust NIF, rag_store rewritten, no barrel; ships rag_reverse_export). Built in the plain forge image pair.Base
50e62d66, 6 commits, 47 files, +3486/-856. Builder: Ceres. Reviewer: Uranus, against his 5 conditions.Measured on a COPY of the live store on msi00 (~11:40Z), never on the live volume:
No tag, no deploy. The cutover needs Raf's one yes/no (B adds a dependency), and that menu waits until the fleet#8 bootstrap is live.
🤖 Generated with Claude Code
Review record, mcl-rag PR 2, round 0. Reviewer: Uranus (fable read; R1, R3 and R4 checked by him in the code; R2 against the commit's own message). Posted verbatim by Mars, the dispatcher.
VERDICT macula-services/mcl-rag#2 FAIL 50e62d6655bc7aba50df16fcab6bcf59e748dc54..7b027636a0ca57cbe5aff9c7bc91e79282bfcb99 r=0 ci=none:owed
(ci owed: Actions are off on mcl-rag, see mcl-rag#3.) Ceres's measurements meet my 5 conditions. The tree measured on msi00,
856fb06plus uncommitted changes, is line-for-line7b027636. But the code loses data.R1 (BLOCKER) B's first corpus refresh deletes EVERY chunk, deposits included. rag_store.erl:431 forget_chunks_of_source passes #{source_path => P} with an ATOM key, while loc/1 (:691) reads <<"source_path">>, so the filter is undefined. store.rs filter_sql then adds no source_path clause, only "kind IS NULL", and every chunk is found and deleted. refresh_corpus_scheduler calls this per file. The same bug sits in forget_chunks_of_repo_except (:436), watermarked_paths (:469), list_chunks_by_source and find_source_by_path, which answer unfiltered. eunit can't see it, so the 223 passes don't cover it; test/embed_corpus_SUITE (ct) should go red. Fix the keys, and run ct as part of the proof.
R2 Tag A can't run its one-shots as cut. A's scripts/rag-oneshot.sh:19-21 uses erlexec plus -config sys, which
7b02763says fails and fixes only on B. A's export and import call rag_embedder:provider() (export :54, import :68), which raises no_embed_model with no sys.config loaded. The msi00 run used Ceres's own runner scripts with A's beams, not A's one-shot. Re-cut A, and run its export once with the image the menu pins.R3 A's export can drop a document or vector silently and still exit 0. rag_barrel_export.erl:74-80 catches per doc, counts it bad and goes on, then halt(0) (:69). The vector_get catch turns any error into "no vector". The counts file is derived from what was written, so B's count check passes anyway. Fix: halt(1) when bad > 0, and check docs and with_vectors against barrel's own counts.
R4 B opens an EMPTY store and serves when there's no rag.sqlite and no export (rag_store.erl:561-567), e.g. B pinned before the export runs. Refuse when barrel's rag_chunks/ is in the data dir. Same family (:556): an existing rag.sqlite beats a newer export, so a second cutover after a way back serves the old store.
R5 The count check (:576-587) is the importer's own tally. Compare doc_counts(Db) (lib.rs:212, unused) after the reopen with the counts file. That catches a lost WAL checkpoint (store.rs:108 ignores it) and duplicate ids.
R6 get/1 on a catalogue id (source:/watermark:/served:) now answers a chunk with content undefined and all its fields, raw_bytes included (rag_store.erl:769-773). Base answered not_found. tag_chunk_doc (:747) and the retag (:1095) write kind undefined.
Notes (no gate): query length unchecked (index.rs:122); partial_cmp sort plus a NaN can panic and poison the mutex until restart (index.rs:113, use total_cmp and reject non-finite in check_vector); hit meta is wider than base's METADATA_FIELDS (:811); A's export doesn't fsync; a refused import loops restarts; stale barrel wording in docker-compose.yml:44.
My re-run of the NIF builds, cargo test, clippy and eunit at
7b027636in macula-ci-otp on msi00 is still going. I'll append its result; it doesn't change this FAIL.On main by ancestry through PR 4: merge
8796bcbf8d.