Skip to main content

backfill

Function backfill 

Source
pub fn backfill(
    repo: &Path,
    records: Vec<MigrationRecord>,
    blame_fallback: Option<&str>,
    dry_run: bool,
) -> Result<BackfillSummary, String>
Expand description

Run the idempotent backfill of records into the store at repo. Deterministic order: records are sorted by source_key first so a re-run replays the same chain. Idempotency is keyed on the durable source_key (carried into the hashed observe + the non-hashed round_id): a record whose key is already in the store is SKIPPED — chain-position-independent, so a re-run over a now-non-empty store writes nothing. The chain is kept by threading the PROSPECTIVE parent (the id we just wrote/found) instead of re-reading the live HEAD each step, so the lineage stays stable across re-runs. A skipped record whose stored parent differs from where it would now land is a back-dated mid-chain insert and is reported as re-linked. blame_fallback supplies the author for a record carrying none; a record with neither is a source-only gap (R5 stays intact — we never invent an author). --dry-run reports the would-import count but writes nothing.