You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
daily-cache: surgical tz-migration de-dup to replace the reverted coverage floor #770
PR #762's P2 coverage floor was reverted before merge after adversarial verification: on a forced timezone re-derive against a real cache copy it dropped a genuine, non-duplicated carried day (claude 2026-06-18, 399.70 USD, 1,572 calls) that exists nowhere else, and the floor also engaged on every non-tz complete-parse re-derive, where the same drop class is latent for any mid-range source hole. The bounded alternative it fixes (a midnight-adjacent turn double-counting on the old and new bucket day after a tz change, roughly 117 USD over-count on the same dataset) is the smaller error and biases toward preservation, which is the store's declared bias.
The surgical design this issue tracks, per the review: on a tzChanged re-derive, identify the specific turns the fresh parse re-bucketed across midnight and subtract only their contribution from the carried old-day slice, instead of blanket-blocking carried slices by a per-provider coverage floor. This distinguishes 'semantics moved the data' from 'sources are gone' (the deferred finding #3 from the #755 review thread), which presence-based carry cannot.
The reverted implementation and its test suite live in #762's history (commit e07f324 and the lane doc removed in the split commit); the repro proving the loss is preserved in the review record. P3 from that PR (single-slice turn attribution) shipped.
@iamtoruk two finished but never-pushed implementations of exactly this surgical design turned up in local session worktrees; both are now preserved verbatim as branches, each green on its own base:
fix/770-tz-carry-dedup (base fd4ede2, a few commits behind current main): touches daily-cache.ts / day-aggregator.ts / usage-aggregator.ts, ships 9 dedicated tests in tests/daily-cache-tz-dedup.test.ts; 48/48 green including the full carry-forward suite. This is the stronger candidate.
fix/770-tz-migration-dedup (base 8578199, older): same direction, asserts through extensions to daily-cache-carry-forward.test.ts; 40/40 green.
Deliberately NOT opening a PR: this issue exists because the previous attempt (#762 P2) was reverted after adversarial verification caught it dropping a real carried day, and the declared bias of this store is preservation. A change in that class should get your eyes on the design before it rides toward main. If the first branch matches what you had in mind, say so and I will rebase it onto current main, re-verify against a real cache copy (including the forced tz re-derive scenario that killed the coverage floor), and open the PR.
Fixed by #906 (merged 2026-08-10): the carry merge now subtracts from each carried baseline slice exactly what the fresh parse still attributes to that (date, provider) under the old tz bucketing, so midnight-straddling turns count once while sources-gone days survive untouched. Verified on a real 94-day corpus with a forced tz flip: zero days dropped, zero spurious deltas. Ships in the next release.
Activity
ozymandiashh commentedon Aug 3, 2026
@iamtoruk two finished but never-pushed implementations of exactly this surgical design turned up in local session worktrees; both are now preserved verbatim as branches, each green on its own base:
fix/770-tz-carry-dedup(base fd4ede2, a few commits behind current main): touchesdaily-cache.ts/day-aggregator.ts/usage-aggregator.ts, ships 9 dedicated tests intests/daily-cache-tz-dedup.test.ts; 48/48 green including the full carry-forward suite. This is the stronger candidate.fix/770-tz-migration-dedup(base 8578199, older): same direction, asserts through extensions todaily-cache-carry-forward.test.ts; 40/40 green.Deliberately NOT opening a PR: this issue exists because the previous attempt (#762 P2) was reverted after adversarial verification caught it dropping a real carried day, and the declared bias of this store is preservation. A change in that class should get your eyes on the design before it rides toward main. If the first branch matches what you had in mind, say so and I will rebase it onto current main, re-verify against a real cache copy (including the forced tz re-derive scenario that killed the coverage floor), and open the PR.
fix(daily-cache): surgical tz-migration de-dup for carried days (geta…
Merge pull request #906 from ozymandiashh/fix/770-tz-carry-dedup
iamtoruk commentedon Aug 10, 2026
Fixed by #906 (merged 2026-08-10): the carry merge now subtracts from each carried baseline slice exactly what the fresh parse still attributes to that (date, provider) under the old tz bucketing, so midnight-straddling turns count once while sources-gone days survive untouched. Verified on a real 94-day corpus with a forced tz flip: zero days dropped, zero spurious deltas. Ships in the next release.