Add provider storage usage and cleanup guidance#829
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 517b81fe76
ℹ️ 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".
| await Task.detached(priority: .utility) { | ||
| let scanner = ProviderStorageScanner() |
There was a problem hiding this comment.
Propagate cancellation into storage scan task
scheduleStorageFootprintRefresh cancels storageRefreshTask on every new refresh request, but scanStorageFootprints immediately starts a second Task.detached that is not a child of the cancelled task. In practice, rapid menu rebuilds can leave many full filesystem scans running in the background even after cancellation, which can cause avoidable disk churn and responsiveness issues on large provider directories.
Useful? React with 👍 / 👎.
| if self.addStorageMenuCardSection(to: menu, provider: context.currentProvider, width: context.menuWidth) { | ||
| menu.addItem(.separator()) |
There was a problem hiding this comment.
Add storage card for expanded token-account view
The storage section is only appended in the single-card path, so when tokenAccountDisplay.showAll is enabled the early branch returns without ever adding storage details. Users with multiple token accounts therefore lose the new storage row/breakdown entirely in provider detail menus under that setting, which makes the feature appear broken for that configuration.
Useful? React with 👍 / 👎.
# Conflicts: # Sources/CodexBar/StatusItemController.swift
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd6fb37078
ℹ️ 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".
| menuWidth: menuWidth, | ||
| tokenAccountDisplay: tokenAccountDisplay, | ||
| openAIContext: openAIContext) | ||
| self.store.refreshStorageFootprintsForOverview() |
There was a problem hiding this comment.
Skip storage refresh calls when feature is disabled
Calling refreshStorageFootprintsForOverview() during every menu population creates a self-refresh loop when providerStorageFootprintsEnabled is off (the default): the call path hits clearStorageFootprints(), which mutates the observed providerStorageFootprints dictionary via removeAll(), triggering observeStoreChanges and invalidateMenus(refreshOpenMenus: true), which repopulates the open menu and repeats. This can keep the menu continuously rebuilding and burn CPU while the menu is open even though the feature is disabled.
Useful? React with 👍 / 👎.
Summary
Storage: <size>rows in Overview while keeping detailed storage breakdowns in provider tabs only.Safety
Verification
swift test --filter ProviderStorageFootprintTestsswift test --filter UsageFormatterTestsswift test --filter HistoricalUsagePaceBackfillAuthorityTestscorepack pnpm check./Scripts/compile_and_run.sh