desktop/src-tauri/crates/core/src/retention_tiered.rs
Comment 1, line 1
desktop/src-tauri/crates/core/src/retention_tiered.rs:1
//! User-configured retention for details and hourly/daily/weekly/monthly/yearly archives.Comment 2, line 2
desktop/src-tauri/crates/core/src/retention_tiered.rs:2
//! Longer aggregate periods retain longer history; materialize weeks/months/years before deleting days.Comment 3, line 3
desktop/src-tauri/crates/core/src/retention_tiered.rs:3
//! Compute distinct_sessions from retained details; materialized NULL leaves that count unknown (V06).Comment 4, line 4
desktop/src-tauri/crates/core/src/retention_tiered.rs:4
//! Materialized weeks use Monday/ISO labels; changing their week-start requires explicit rebuilding.Comment 5, line 13
desktop/src-tauri/crates/core/src/retention_tiered.rs:13
/// Tiered retention durations in days.Comment 6, line 21
desktop/src-tauri/crates/core/src/retention_tiered.rs:21
/// None retains yearly history indefinitely.Comment 7, line 27
desktop/src-tauri/crates/core/src/retention_tiered.rs:27
// User-selected defaults from 2026-09-26: hourly 3 days, daily 90 days, weekly 3 years, monthly 10 years.Comment 8, line 41
desktop/src-tauri/crates/core/src/retention_tiered.rs:41
// Detail retention is independent of aggregate tiers and may exceed hourly retention.Comment 9, line 42
desktop/src-tauri/crates/core/src/retention_tiered.rs:42
// Aggregate durations must satisfy hourly <= daily <= weekly <= monthly <= yearly.Comment 10, line 94
desktop/src-tauri/crates/core/src/retention_tiered.rs:94
// A day can belong to an incomplete week and a completed month/year. Use theComment 11, line 95
desktop/src-tauri/crates/core/src/retention_tiered.rs:95
// latest boundary so every day affecting any completed period is considered.Comment 12, line 132
desktop/src-tauri/crates/core/src/retention_tiered.rs:132
/// Enforce details, hourly, materialized week/month/year, daily, then period retention.Comment 13, line 133
desktop/src-tauri/crates/core/src/retention_tiered.rs:133
/// One transaction; the detail floor prevents expired records from returning on rescan (V14).Comment 14, line 182
desktop/src-tauri/crates/core/src/retention_tiered.rs:182
// 1. Seal expired daily partitions, then delete expired events/diagnostics.Comment 15, line 214
desktop/src-tauri/crates/core/src/retention_tiered.rs:214
// F2: Seal daily cost rows after details expire; keep historical amounts unchanged and queryable.Comment 16, line 218
desktop/src-tauri/crates/core/src/retention_tiered.rs:218
// 2. Apply hourly retention.Comment 17, line 227
desktop/src-tauri/crates/core/src/retention_tiered.rs:227
// 3. Completed history is stable when only open periods change. Row countsComment 18, line 228
desktop/src-tauri/crates/core/src/retention_tiered.rs:228
// detect removed partitions; revisions detect equal-sized replacements andComment 19, line 229
desktop/src-tauri/crates/core/src/retention_tiered.rs:229
// late corrections. Imported future revisions conservatively force rebuild.Comment 20, line 264
desktop/src-tauri/crates/core/src/retention_tiered.rs:264
// 4. Delete daily rows after materialization; protect starts of ongoing weeks/months/years.Comment 21, line 265
desktop/src-tauri/crates/core/src/retention_tiered.rs:265
// Deleting those days would lose the inputs needed to finish the period.Comment 22, line 266
desktop/src-tauri/crates/core/src/retention_tiered.rs:266
// Retain from the earliest protected year/month/week start, then include its whole ISO boundary week.Comment 23, line 275
desktop/src-tauri/crates/core/src/retention_tiered.rs:275
// Keep a whole ISO week at the boundary. A later cleanup must notComment 24, line 276
desktop/src-tauri/crates/core/src/retention_tiered.rs:276
// rebuild that week from only its surviving January days.Comment 25, line 282
desktop/src-tauri/crates/core/src/retention_tiered.rs:282
// F2: Prune daily cost rows with daily retention after detail/estimate history expires.Comment 26, line 291
desktop/src-tauri/crates/core/src/retention_tiered.rs:291
// 5. Apply weekly/monthly retention and optional yearly retention; None retains years indefinitely.Comment 27, line 340
desktop/src-tauri/crates/core/src/retention_tiered.rs:340
/// Materialize completed weeks/months/years represented in inclusive [from, to]; delete old period rows before inserting replacements.Comment 28, line 341
desktop/src-tauri/crates/core/src/retention_tiered.rs:341
/// Skip periods with end_day >= to; daily rows continue to serve ongoing periods.Comment 29, line 560
desktop/src-tauri/crates/core/src/retention_tiered.rs:560
/// Week/month/year containing a day; weeks use ISO Monday labels as described above.