fix: fall back to percent in Both mode when pace is unavailable#527
fix: fall back to percent in Both mode when pace is unavailable#527Astro-Han wants to merge 2 commits intosteipete:mainfrom
Conversation
| let paceText: String? = Self.paceText(pace: pace) | ||
| guard let paceText else { return nil } | ||
| // Fall back to percent-only when pace is unavailable (e.g. Copilot) | ||
| guard let paceText = Self.paceText(pace: pace) else { return percent } |
There was a problem hiding this comment.
Could this fallback change what Codex shows when pace is unavailable? I’m wondering if returning percent here means .both no longer falls through to the credits display path in cases where the weekly/session window is exhausted, so it might be worth tracing how menuBarDisplayText(for:) behaves for exhausted Codex snapshots.
There was a problem hiding this comment.
Good catch — I traced this through and the credits fallback path is guarded by mode == .percent at StatusItemController+Animation.swift:465:
if provider == .codex,
mode == .percent, // ← hard gate
...So when mode == .both, the credits branch is never entered regardless of what displayText returns. The two paths are fully isolated by the mode enum check.
The existing tests (menuBarDisplayTextUsesCreditsWhenCodexWeeklyIsExhausted / ...SessionIsExhausted) also confirm this — they both explicitly set menuBarDisplayMode = .percent.
Closes steipete#232. When a provider (e.g. Copilot) has no pace data, the "Both" display mode now gracefully degrades to show percent-only instead of hiding the menu bar text entirely.
9bae1f1 to
3ff121f
Compare
Summary
Changes
MenuBarDisplayText.swift:.bothbranch returnspercentinstead ofnilwhen pace is unavailable (one-line change)StatusItemAnimationTests.swift: Updated assertions and renamed test functions to match the new fallback behaviorTest plan
swift buildpassesmenuBarDisplayText*tests pass with updated expectations