Skip to content

fix(status-bar): tolerate missing provider snapshots - #9408

Merged
nwparker merged 1 commit into
stablyai:mainfrom
nsxdavid:fix/status-bar-provider-snapshots
Jul 24, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
nsxdavid:fix/status-bar-provider-snapshots

Conversation

@nsxdavid

@nsxdavid nsxdavid commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes a status-bar crash that occurred when a rate-limit snapshot from an older main process omitted a provider key.

ELI5

Sometimes the app's bottom bar asked for provider info that hadn't arrived yet and choked on the empty answer. Now it waits calmly instead of crashing.

Root cause & fix

isProviderConfigured and isProviderSnapshotPending used a strict provider === null check, so an undefined snapshot (which happens when an older main process omits newly added provider keys) slipped past the guard and crashed on provider.status. The fix switches to a loose provider == null check so both null and undefined snapshots are treated as pending. Configured providers stay visible while their snapshot loads; unconfigured providers stay hidden. No provider payloads or IPC contracts change.

Evidence

Validated & rebased onto latest main during a bug-bash triage on 2026-07-23.

  • Test file: src/renderer/src/components/status-bar/status-bar-provider-visibility.test.ts
  • Fix file: src/renderer/src/components/status-bar/status-bar-provider-visibility.ts
  • On branch: all 29 tests pass.
  • Reverting only the fix (keeping the new tests) reproduces the bug: 4 fail with TypeError: Cannot read properties of undefined (reading 'status'), including the older-main-process regression tests.
  • Lint: oxlint on the fix source is clean; PR reports pnpm typecheck passing.
STEP 2a — on branch: Test Files 1 passed, Tests 29 passed.
STEP 2b — fix reverted: Tests 4 failed | 25 passed.
  TypeError: Cannot read properties of undefined (reading 'status')
  - getVisibleUsageProvider > creates a pending snapshot when an older main process omits a configured provider
  - isUsageEmptyState > treats provider keys omitted by an older main process as pending

Trade-offs

None — pure fix.

Regression risk

Zero-regression: the change only widens a null check to also catch undefined, so already-defined and null snapshots follow byte-identical paths. Behavior for configured, pending, and empty-state providers is unchanged and locked in by the passing 29-test suite. No IPC, payload, or platform-specific code is touched.

Credit to @nsxdavid for the original fix. Validated, rebased, and (where applicable) hardened via automated bug-bash review; original fix design preserved.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Provider visibility types and helpers now accept undefined provider snapshots. Missing snapshots are treated as unconfigured, while configured providers omitted by an older main process can remain pending. Tests cover configuration checks, visible usage providers, and empty-state handling for omitted provider keys.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary, root cause, evidence, and risk, but it omits required template sections like Screenshots, AI Review Report, Security Audit, and Notes. Add the missing template sections, especially Screenshots, Testing checklist items, AI Review Report, Security Audit, and Notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately summarizes the main change: handling missing provider snapshots in the status bar.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@brennanb2025

Copy link
Copy Markdown
Contributor

Taking a look!

@nwparker
nwparker force-pushed the fix/status-bar-provider-snapshots branch from b8fee39 to a7de8e1 Compare July 23, 2026 11:49
@nwparker

Copy link
Copy Markdown
Contributor

Thanks @nsxdavid I'm going to try to merge now. Give me a few mins here

@nwparker
nwparker merged commit 5a1ca24 into stablyai:main Jul 24, 2026
@nwparker

Copy link
Copy Markdown
Contributor

Thanks so much for this, @nsxdavid — tolerate missing provider snapshots. Verified (fail-on-main/pass-on-branch), rebased on latest main, reviewed, and merged. Really appreciate it! 🙏

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.

3 participants