Expand description
Read-only diagnosis of a store an embedding-model change made unopenable, and the feasibility proof the rebuild depends on (#1762). Never writes to the store it inspects. Read-only diagnosis of a store that a changed embedding model has made unopenable, and the feasibility proof the rebuild depends on (#1762, PR A).
§What this module is NOT
It does not migrate, does not switch anything over, and never writes to the
store it inspects. Producing a crate::migration::MigrationState is a
later step behind an explicit prepare command; a diagnosis yields a
crate::migration::DiagnosisReport and nothing else.
§Why a feasibility proof comes first
A rebuild must re-insert every fact under its ORIGINAL u64 id: edges are
(id, from, to, relation) with no vector of their own, entity hubs derive
their id from the topic, and the working-context index addresses facts by
id. Renumbering would silently sever all three. So before any rebuild code
is written, the architecture has to be shown to support reading every fact
back out — ids, content, ordinary metadata, RESERVED metadata and the
absolute expiry — and putting it back unchanged.
MemoryStore offers no enumeration at all: every read is by id or a
top-k vector search, and count() counts without listing. Two paths down
into the engine do, and they are not equivalent:
- a
VelesQLscan with no vector predicate, walked byLIMIT/OFFSET(crate::migration::enumerate_collection) — complete and deterministic, but quadratic, and BOUNDED: the pipeline clampslimit + offsetto 100_000 and goes silently empty past that mark; - the collection’s own
scroll_batch(crate::migration::enumerate_by_cursor) — a cursor keyed on the point id, exclusive and ascending, which bypasses the query pipeline and so carries neither the clamp nor the re-sort.
The first was written first because WHERE id > n genuinely does not work —
filters read the payload and the id is not in it. That ruled out expressing
a cursor in VelesQL; it did not rule out the cursor, and treating the
query language’s limit as the architecture’s limit is the error this module
now records rather than repeats.
That either parses is not the proof. Both are measured by running them against a seeded store and comparing what comes back, field by field, and against each other.
Structs§
- Batch
Reinsertion - What a batch re-insertion produced.
- Collection
Inventory - One collection as the rebuild will find it.
- Diagnosis
Report - Everything a rebuild needs to know about a store, and nothing it could act on by accident.
- Edge
Reinsertion - What putting the edges back produced.
- Execute
Outcome - What one
executerun did, and where its artefacts live. - Migrate
Options - What the operator asked the command to do.
- Migrate
Outcome - What one
migraterun did. The early stages areNoneexactly when the journal routed past them — reporting a rebuild that did not run would be misreporting, and with the source already archived it could not have run. - Migration
Lock - Exclusive possession of a migration workspace.
- Migration
State - What a prepared migration recorded, so a later run can decide whether to resume it.
- RawFact
- One fact as the rebuild will need to re-create it.
- Rebuild
Destination - The destination store, created and sized by the caller.
- Rebuild
Journal - Where the journal lives and the proof we may write it.
- Rebuild
Outcome - What a completed pass did — counts, not verdicts. The verdict is the destination re-reads performed along the way.
- Rebuild
Source - The source store, opened read-only in spirit: nothing here writes to it.
- Switch
Outcome - What a completed switch did.
- Switch
State - Which of the three directories exist when a switch-over is interrupted.
- Target
Contract - What the operator is pointing the rebuild at: the target embedder’s identity, and the regime they selected.
- TtlSummary
- What the expiries in a collection amount to.
- Validation
Outcome - What one validation pass established.
Enums§
- Capability
- Whether a capability the rebuild depends on is established, or missing.
- Collection
Progress - How far one collection’s rebuild got inside
Phase::Prepared. - Compatibility
- What the source’s own record permits, independently of what was asked for.
- Phase
- Where a migration has got to.
- Recovery
- What to do with a migration found stopped.
- Reinsertion
- What putting a fact back produced.
- Resolution
- What the rebuild will do, or why it will not run.
- Source
Provenance - What the store itself records about the embedder that filled it.
- Strategy
- What the operator selected on the command line.
- Vector
Policy - Which vector each reinserted fact carries.
Constants§
- AGENT_
COLLECTIONS - Collections
AgentMemoryopens, all at the same dimension — so any one of them refusing the new dimension makes the whole store unopenable, and an inventory that skipped the empty ones would under-report the work. - ARCHIVE_
SUFFIX - The archive slot: a sibling of the source, named after it.
- DIAGNOSIS_
FORMAT_ VERSION - The shape of a
DiagnosisReport, stamped into every report. - LOCK_
FILE - The file that marks a migration in progress.
- PHASES
- Every phase, in order — so an exhaustive check cannot silently miss one added later.
- STATE_
FILE - The file a prepared migration records its state in.
- STATE_
FORMAT_ VERSION - The shape of a
MigrationState. - STATE_
TEMP_ FILE - The fixed sibling staging file for an atomic state replacement.
Functions§
- assess
- Read the source’s record against the target contract.
- bytes_
on_ disk - Sum of every regular file’s length under
root. - cross_
check_ edges - The same collection of edges, gathered through the INCOMING index instead.
- default_
scratch_ parent - The default scratch parent: the directory the store itself sits in.
- diagnose
- Inspect
sourceand report what a rebuild ontotarget_modelwould face. - dry_run
- Diagnose the store under
optionsagainsttarget, and render the result. - enumerate_
by_ cursor - Read every fact of
collectionout ofdbby cursor, in batches ofbatch. - enumerate_
collection - Read every fact of
collectionout ofdb, in pages ofpage. - enumerate_
page - One page of
collection, starting atoffset— the unit a checkpoint resumes from, and what makes the walk above interruptible rather than all-or-nothing. - execute
- Diagnose, stage, lock, rebuild, release — the whole non-dry-run path.
- export_
edges - Every edge of
collectionthat lies between two exported facts, as complete tuples. - export_
edges_ verified - The export, checked against the incoming index over ONE snapshot of the live facts.
- fingerprint
- A versioned SHA-256 digest of every directory, regular file and file byte.
- migrate
- Rebuild, validate and switch — entering wherever the journal stands.
- migration_
complete_ notice - Re-exported so the binary can print the completion without duplicating it.
- parse_
migrate_ args - Parse
migrate-embeddings’ flags. - rebuild
- Run the rebuild to completion, resuming from whatever
staterecords. - refuses
- Whether this diagnosis leaves the command with nothing it could run.
- reinsert
- Put
factback intocollectionunder its ORIGINAL id, withvectoras the caller decided it. - reinsert_
batch - Put a whole batch back, in one write.
- reinsert_
edges - Put
edgesback intocollection, AFTER the facts. - render
- Render a report for an operator: what is here, what would happen, and what still blocks it.
- require_
destination - Require the flag a non-dry-run cannot proceed without.
- resolve
- Decide the regime from what was asked and what the store permits.
- same_
filesystem - Whether
aandbsit on the same filesystem. - scroll_
page - One batch of
collection, starting strictly aftercursor, with the cursor to resume from. - switch_
over - Drive the switch from wherever the journal stands to
Committed. - validate_
destination - Validate
destinationagainststoreand journal the result.