Skip to content

Lite's daily-summary retention horizon starts at the first whole month the archive cleanup keeps, not at the cutoff day - #3984

Merged
erikdarlingdata merged 1 commit into
devfrom
fix/lite-daily-summary-horizon-month-start
Sep 23, 2026
Merged

erikdarlingdata merged 1 commit into
devfrom
fix/lite-daily-summary-horizon-month-start

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

Follow-up to #3975 (#3967). Lite's daily-summary retention horizon now starts where Lite's history actually starts.

The defect

LocalDataService.DailySummaryRetentionHorizon returned the archive retention's cutoff day: today minus ArchiveRetentionMonths, for example 2026-06-18 on 2026-09-18. The archive cleanup doesn't delete at that day, though. It deletes a file whole once the month the file is named for falls before the cutoff. On 2026-09-18 the June file goes, and with it every row from June 18 to June 30. Those days sat on the retained side of the horizon, so get_daily_summary / get_daily_summary_range judged them as days inside retention that simply had no data, instead of purged, and published a retention_horizon about two weeks earlier than the data really goes back.

#3975 already added RetentionService.OldestRetainedInstant for this: the first month start at or after the cutoff. It gave the Overview freshness band that instant. The daily summary was the one reader still using the raw cutoff.

The fix

DailySummaryRetentionHorizon returns RetentionService.OldestRetainedInstant(utcNow), so both Lite surfaces agree on when the history ends. The doc comment explains why the horizon is not the cutoff. This is Lite only: Darling's horizons are per-signal and day-based (DailySummaryRetention.HorizonFor) and have no whole-month file deletion.

Test plan

  • TheLiteHorizon_IsTheArchiveRetention_InMonths_FromTheFirstWholeMonthKept: a mid-month clock (2026-09-18) gets 2026-07-01, and equals OldestRetainedInstant. A month-start clock (2026-09-01) keeps its own month (2026-06-01). The old code returned 2026-06-18 for the first case.
  • McpPageContractTests, DarkPastRetentionReadsOfflineToolTests, FindingsRetentionHorizonPinTests, PerformanceCalendarDataTests: 32/32.
  • Full Lite.Tests: 5,147 run, 0 failed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GdmA4ND1wLSqA91ax1m4xv

…h the archive cleanup keeps, not at the cutoff day

The cleanup deletes an archive file whole once the month it is named for
falls before the cutoff, so the days between the cutoff and the next month
start are gone with it. DailySummaryRetentionHorizon returned the cutoff day,
which judged those days as retained with no data instead of purged, and
published a retention_horizon up to a month earlier than Lite's history. It
now returns RetentionService.OldestRetainedInstant, the instant #3975 gave
the Overview freshness band.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GdmA4ND1wLSqA91ax1m4xv
@erikdarlingdata
erikdarlingdata enabled auto-merge (squash) September 23, 2026 03:07
@erikdarlingdata
erikdarlingdata merged commit 1fa925d into dev Sep 23, 2026
15 of 16 checks passed
@erikdarlingdata
erikdarlingdata deleted the fix/lite-daily-summary-horizon-month-start branch September 23, 2026 03:14
erikdarlingdata added a commit that referenced this pull request Sep 23, 2026
…3920, #3927, #3931, #3932, #3940, #3942, #3946, #3947, #3950, #3952, #3955, #3956, #3957, #3964, #3965, #3966, #3968, #3972, #3975, #3979, #3980, #3981, #3983, #3984, #3985) (#3989)

The wave's fix PRs deliberately carried no CHANGELOG edits (parallel-agent hot-spot protocol); each agent reported its entry and this commit lands them together, byte-verified against origin/dev.


Claude-Session: https://claude.ai/code/session_01GdmA4ND1wLSqA91ax1m4xv

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant