Skip to content

fix(menubar): explicit observation dependency for the budget flame#507

Merged
iamtoruk merged 1 commit into
mainfrom
fix/menubar-budget-flame-observation
Jun 18, 2026
Merged

fix(menubar): explicit observation dependency for the budget flame#507
iamtoruk merged 1 commit into
mainfrom
fix/menubar-budget-flame-observation

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

Follow-up hardening from an independent multi-agent validation of #505/#506.

What

The menubar withObservationTracking block read displayMetric, dailyBudget, and dailyTokenBudget, but not the derived isOverDailyBudget (which also depends on todayPayload). Today it still works because payload/menubarPayload register a dependency on the same underlying cache storage, so a today-usage write fires the re-tint. But that is incidental: if the cache is ever refactored or todayPayload memoized separately, the flame would silently stop updating on budget crossings.

This reads isOverDailyBudget in the tracking block, making the dependency explicit and intent-proof.

Validation context

Three independent validators reviewed #505/#506: build clean, quota-over-budget tint precedence preserved, no leftover cost-only comparisons, token units consistent, sentinel/parsing/persistence correct, no SwiftUI focus-loss or feedback loop, no metric-switch desync. This was the one low-risk robustness gap they converged on. Remaining items they noted are pre-existing or minor UX (see PR discussion).

Verification

  • swift build passes.

… crossings

The menubar refresh observation block read displayMetric and the two budget
values, but not the derived isOverDailyBudget (which also depends on
todayPayload). It worked only because payload/menubarPayload happened to touch
the same cache storage. Read isOverDailyBudget explicitly so the flame re-tints
when today's usage crosses the budget, and so the dependency survives any future
cache refactor.
@iamtoruk iamtoruk merged commit 8794dde into main Jun 18, 2026
3 checks passed
@iamtoruk iamtoruk deleted the fix/menubar-budget-flame-observation branch June 18, 2026 11:23
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