Fix weekly usage period labels - #165
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The 90-day and all-time usage APIs resolve
granularity=autoto weekly buckets, but the macOS Usage pane treated every returned bucket as a day. The summary could say13/14 Active days, while the chart and its accessibility controls still saidCost per day,Previous usage day, andthis day's value.Central change
The Usage pane now derives every period-unit label from the API's effective
filters_echo.granularity: daily responses use day copy, weekly responses use week copy, and unknown or legacy payloads use neutral period copy rather than guessing.What changed
Visual contract
The two new canonical references visibly cover:
Recorded use · 90dand the selected90drange chip;Active weeks 13/14;Cost per week;Both PNGs were generated on the pinned canonical renderer, immediately re-verified, and reviewed directly. The six existing Usage references remain unchanged.
Review order
DashboardModel.swiftandUsagePane.swift: effective-granularity decoding and the shared period presentation.UsagePeriodPresentationTests.swift: daily, weekly, empty, unknown, and legacy semantics, including chart/accessibility copy.DashboardStore.swift,DashboardSnapshotHarness.swift,UsageSnapshotHarness.swift, anddashboard.json: deterministic 7-day/90-day state wiring.UsageSnapshotHarnessTests.swiftandUsageVisualRegressionTests.swift: eight-artifact render contract.usage-weekly-reference-*.pngfiles: final visual evidence.Safety
mainwithout conflicts, then re-verified.Verification
Red evidence established before implementation:
Final integrated tree:
swift test— 151 passed; 6 visual wrappers intentionally delegated to the canonical verifierswift build -c release— passedpython -m pytest tests/test_tokens_explorer.py::test_usage_summary_whitelist_validation_and_granularity_override— passed./Scripts/visual-snapshots verify— About, Dashboard, Menu, Setup, eight-state Usage, and Work references all matchgit diff origin/main --check— passed