Skip to content

fix(spend): sync heatmap bucket calendar - #3102

Closed
Yuxin-Qiao wants to merge 1 commit into
steipete:mainfrom
Yuxin-Qiao:fix/spend-heatmap-calendar
Closed

fix(spend): sync heatmap bucket calendar#3102
Yuxin-Qiao wants to merge 1 commit into
steipete:mainfrom
Yuxin-Qiao:fix/spend-heatmap-calendar

Conversation

@Yuxin-Qiao

Copy link
Copy Markdown
Contributor

Heatmap used Calendar.current and only observed points (SpendActivityHeatmap.swift:391,460), so changing costUsageBucketTimeZoneIdentifier (IANA pinned bucketing from #3015) left the 371-cell SpendActivitySeries sliced in the old zone until next points change — future column off-by-one and weekly aggregation aliasing.

Before: PreferencesSpendDashboardPane.swift:400 created SpendActivityHeatmapView(points:selectedDay:) with default .current, onChange(of: points) only.

After: add calendar: Calendar to SpendActivityHeatmapView, init from SpendActivitySeries.make(..., calendar:) and add onChange(of: calendar). Pane now passes settings.costUsageBucketCalendar, matching SpendDashboardModel.build:300 gregorianCalendar(timeZone: calendar.timeZone) and StatusItemController+OverviewSpend:201 fix in #3064.

Verified: swiftformat + swiftlint --strict clean, backward compatible default .current for previews.

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.
@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@Yuxin-Qiao

Copy link
Copy Markdown
Contributor Author

Superseded by larger silent-refresh PR

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