fix(spend): sync heatmap bucket calendar - #3102
Conversation
SpendActivityHeatmapView always used Calendar.current and only observed points, so switching costUsageBucketTimeZoneIdentifier (IANA pinned bucketing from steipete#3015) left the 371-cell heatmap sliced in the old timezone until next points change — 1-day off future column and weekly aliasing. Pass settings.costUsageBucketCalendar into the heatmap and add onChange(calendar) to recompute the series. Overview and dashboard now share the same bucket calendar.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(spend): sync heatmap bucket calendar This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e280db9b25
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| SpendDashboardPanel { | ||
| SpendActivityHeatmapView( | ||
| points: self.controller.model.tokenActivity, | ||
| calendar: self.settings.costUsageBucketCalendar, |
There was a problem hiding this comment.
Format heatmap labels in the bucket time zone
When the pinned bucket zone differs from the current macOS zone (for example, after traveling from New York to Los Angeles), the series now represents dates at midnight in the pinned zone, but SpendActivityDateFormatting.mediumDateString and the formatter in monthMarkers still use the system zone. An Aug 20 bucket at midnight ET therefore renders as Aug 19 in PT, causing tooltips, accessibility descriptions, and potentially month labels to misidentify cells even though selection uses Aug 20. Thread series.calendar.timeZone into these formatters.
Useful? React with 👍 / 👎.
|
Superseded by larger silent-refresh PR |
Heatmap used
Calendar.currentand only observedpoints(SpendActivityHeatmap.swift:391,460), so changingcostUsageBucketTimeZoneIdentifier(IANA pinned bucketing from #3015) left the 371-cellSpendActivitySeriessliced in the old zone until next points change — future column off-by-one and weekly aggregation aliasing.Before:
PreferencesSpendDashboardPane.swift:400createdSpendActivityHeatmapView(points:selectedDay:)with default.current,onChange(of: points)only.After: add
calendar: CalendartoSpendActivityHeatmapView, init fromSpendActivitySeries.make(..., calendar:)and addonChange(of: calendar). Pane now passessettings.costUsageBucketCalendar, matchingSpendDashboardModel.build:300gregorianCalendar(timeZone: calendar.timeZone)andStatusItemController+OverviewSpend:201fix in #3064.Verified:
swiftformat+swiftlint --strictclean, backward compatible default.currentfor previews.