Repository navigation
fix(db,poll): harden budget ledger, finding events, and revue coverage - #30
Conversation
Address CodeRabbit proactive review findings #689, #690, #691, #692, #693, #694: - Load all spends in the active refill/lookback window instead of capping at 50 rows (#689) - Persist dated refill_samples across budget ledger save/load (#690) - Route poll_repo budget updates through update_budget_ledger so webhook throttle deadlines are not clobbered (#691) - Delete removed provisional spends on save while preserving confirmed spend history (#692) - Run update_finding_status read/update/event insert in a single transaction (#693) - Skip stale apply_revue_coverage updates when blob_sha is absent and newer unreviewed lines exist (#694)
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Relates to #14
Addresses verified CodeRabbit steward findings:
Db::load_budget_ledgerand filter by the active refill/lookback window (plus provisional rows) so repos withlimit > 50do not undercount active spends.migrations/0003_refill_samples.sql(budget_state.refill_samples_json) and persist/restoreBudgetLedger::refill_samplesacross save/load so the 7-day rolling max survives restarts and updates.poll_repoand apply them viaDb::update_budget_ledgerunderledger_lockinstead of callingsave_budget_ledgerwith a pre-request snapshot, preventing poll saves from clobbering concurrent webhook throttle deadlines.save_budget_ledgerin a transaction and delete storedprovisionalspend rows no longer present inledger.spendswhile keeping allconfirmedspend history intact.Db::update_finding_status(SELECT, guardedUPDATE, andfinding_eventsINSERT) in one SQLite transaction so concurrent updates cannot record a stalefrom_status.Db::apply_revue_coverageto also skip whenblob_shaisNonefor a differentreviewed_commitwithunreviewed_lines > 0.Verification
cargo test(30 tests passed, including 5 new regression tests intests/db_tests.rs)cargo clippy --all-targets --all-features -- -D warnings(clean)Summary by CodeRabbit