backfill_source_bases_once

Function backfill_source_bases_once 

Source
pub fn backfill_source_bases_once(
    home: &Path,
    registry: &Registry,
) -> Result<SourceBackfillStats, RegistryError>
Expand description

One-shot backfill of source_agents_base onto registry records written before schema v3 — i.e. by P0.3b’s global migration (#1389) or any pre-P0.4 live mirror.

The main migrate_from_sqlite_once short-circuits on .migrated_from_sqlite, so an already-migrated registry never re-runs row_to_record and its records keep source_agents_base: None. A cross-channel listnamedagents read then re-joins working_dir under the READER’s own channel and resolves the wrong workspace / --resume cwd. This pass re-derives each record’s source channel from the SQLite sources and sets only source_agents_base, preserving every live-mirror-enriched field (session_id, identity, timestamps) — it never blind-upserts the SQLite-derived record. Guarded by its own marker; idempotent; read-only on SQLite.