desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs
Comment 1, line 1
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:1
//! Prefer local model_usage database snapshots. JSONL is a fallback only whenComment 2, line 2
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:2
//! this root has never supplied a database. The source prunes after 30 days;Comment 3, line 3
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:3
//! snapshots replace complete source/day partitions, never match time or tokens.Comment 4, line 16
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:16
/// Backfill counts recorded in operation logs and the UI.Comment 5, line 19
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:19
/// model_usage rows read with a nonnull completed_at; usage fields may be unknown.Comment 6, line 21
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:21
/// Records in unchanged snapshots.Comment 7, line 23
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:23
/// Newly inserted events.Comment 8, line 25
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:25
/// Events updated under an existing key on repeat backfill.Comment 9, line 29
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:29
/// Open cli/db/db.sqlite read-only and synchronize its snapshots. `instance_id`Comment 10, line 30
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:30
/// must match the zcode JSONL instance, retaining common ownership/user routing.Comment 11, line 114
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:114
// input_uncached = input - (cache_read + cache_write); invalid or missing operandsComment 12, line 115
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:115
// leave it None, including cache exceeding input; never fill unknown values with zero.Comment 13, line 218
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:218
/// Persist a snapshot and its aggregates in one transaction. Old details areComment 14, line 219
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:219
/// used only inside this transaction, then removed under the existing policy.Comment 15, line 227
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:227
// Validate the complete snapshot before deleting any existing contribution.Comment 16, line 296
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:296
// The source may already have removed the beginning of this day.Comment 17, line 297
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:297
// Keep the previously captured complete contribution; never replace itComment 18, line 298
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:298
// with a partial snapshot or infer missing calls from token amounts.Comment 19, line 351
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:351
/// Map db.query_source as modelio_v1 does; unverified compact remains unknown.Comment 20, line 361
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:361
/// model_usage row selected by completed_at; optional usage fields remain optional.Comment 21, line 380
desktop/src-tauri/crates/core/src/adapters/zcode/db_backfill.rs:380
/// Parser version identifying the backfill rule used by an event.