Skip to content

fix: stop offering a package update that is already installed - #956

Merged
M4n0x merged 3 commits into
mainfrom
fix/package-update-offer
Nov 28, 2026
Merged

M4n0x merged 3 commits into
mainfrom
fix/package-update-offer

Conversation

@M4n0x

@M4n0x M4n0x commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Settings › Packages offered Update to X on the page of an older installed version even when X was already installed from the Store and in use. Pressing it could fail with "Package ai-usage 1.5.1 is already installed. Choose a new version to replace it." when the version was installed after Settings read its installed list. Fixes #955.

Changes

  • update(for:) no longer offers a version when the offering source's own copy of it, or of a later version, is installed. A folder build of that version, or a copy without an install record, doesn't count, since it may hold other files; those keep the offer and the existing file check.
  • update(_:) rereads the installed versions before downloading, and stops if the reread fails or the offer changed, so the page shows the new offer instead of applying one that wasn't seen.
  • applyUpdate rereads before deciding to install or claim, so a version installed while the "Review additional access" dialog is open is claimed instead of failing.
  • applyUpdate also stops when a later version from the same source was installed meanwhile, so confirming doesn't pin the bar to the older one.
  • loadInstalled() reads manifests and records before publishing either, and returns whether it succeeded. A throwing reloadInstalled() lets applyUpdate report a failed read.

No visible layout changes: the wrong button no longer appears, and the error no longer happens.

Testing

  • New Tests/StableBarTests/PackageUpdateOfferTests.swift: an older version offers nothing when the Store's newer copy is installed; updating rereads a version installed meanwhile; a copy without a record keeps the offer; confirming an access review after the version was installed meanwhile succeeds. The first two and the last failed before the fix.
  • All package suites pass (PackagesViewTests, PackageSourceTests, PackageStoreClientTests, theme gallery, widget package tests), and scripts/check.sh --quick passes.
  • Reproduced on a copy of a real configuration (ai-usage 1.2.0 to 1.5.1 installed, 1.5.1 in use): before the fix every older version offered 1.5.1, after it none does.
  • The full suite's menu bar, key window and popup tests (BarContextMenuTests, KeyWindowTests, PresentationIntegrationTests) fail on this Mac regardless of branch, because they read its real menu bar; CI runs them.
  • Reviewed in two rounds by GPT-6.2 Astra. Round 1's four findings are fixed in the second commit. Round 2's case, which cubic also raised, is fixed in the third: a newer version installed while the access review for an older one is open. Confirming now keeps the newer version and says it's installed, instead of moving the bar back. confirmingAnUpdateKeepsANewerVersionInstalledDuringItsReview failed before that fix.

Merging

Merge commit or rebase: all three commits are fix and describe their part.

Claude Opus 5.5 via Claude Code

An older installed version compared itself with the Store alone, so its page kept offering
the Store's version after that version was installed and in use. Updating also trusted the
installed list read when Settings opened, and refused with "already installed" when the
version had been installed since. The offer now skips versions the source's own copy already
has, and updating rereads what's installed first.
An update is still offered when no install record says whose files the newer copy holds.
Updating stops when rereading the packages folder fails or the offer changed, and applying
an update rereads it too, so one installed while its access review was open is accepted.
@M4n0x
M4n0x requested a review from Seb-GRAF as a code owner November 28, 2026 08:56

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Before and after

main at add49b0 → this pull request at 8b13782 · 203 screens drawn · 0 changed

203 unchanged screens

docs/essentials-clock-settings-dark, docs/essentials-clock-settings-light, docs/essentials-dark, docs/essentials-light, docs/essentials-settings-dark, docs/essentials-settings-light, docs/hero-dark, docs/hero-light, docs/popups-dark, docs/popups-light, docs/settings-dark, docs/settings-light, docs/themes-dark, docs/themes-light, scenes/accessibility-guide-dark, scenes/app-menu-popup-dark, scenes/apple-menu-settings-dark, scenes/apple-menu-symbol-bar-dark, scenes/apple-menu-symbol-settings-dark, scenes/bar-dividers-dark, scenes/bottom-bar-popup-dark, scenes/chat-popup-dark, scenes/crowded-edit-bar-dark, scenes/disk-meter-bar-dark, scenes/dock-badges-bar-dark, scenes/edit-bar-wide-group-dark, scenes/essentials-clock-popup-dark, scenes/essentials-disk-popup-dark, scenes/filled-slider-popup-dark, scenes/glass-text-follows-background-bar-dark, scenes/glass-text-follows-background-bar-light, scenes/group-members-bar-dark, scenes/group-others-bar-dark, scenes/group-text-color-bar-dark, scenes/gruvbox-bar-dark, scenes/gruvbox-bar-light, scenes/horizontal-list-popup-dark, scenes/increase-contrast-bar-dark, scenes/increase-contrast-bar-light, scenes/increase-contrast-popup-dark, scenes/increase-contrast-popup-light, scenes/input-source-popup-dark, scenes/labeled-metric-built-in-dark, scenes/labeled-metric-catppuccin-dark, scenes/labeled-metric-catppuccin-light, scenes/meeting-live-popup-dark, scenes/meeting-soon-bar-dark, scenes/menu-bar-items-widget-settings-dark, scenes/menu-bar-items-widget-style-dark, scenes/merged-status-bar-dark, scenes/notch-flare-bar-dark, scenes/output-device-popup-dark, scenes/package-template-clash-bar-dark, scenes/popup-gap-bar-dark, scenes/popup-spacing-bar-dark, scenes/popup-view-dark, scenes/preset-dashboard-bar-dark, scenes/preset-developer-bar-dark, scenes/preset-everyday-bar-dark, scenes/preset-minimal-bar-dark, scenes/preset-workday-bar-dark, scenes/privacy-both-bar-dark, scenes/privacy-hide-when-idle-bar-dark, scenes/privacy-idle-bar-dark, scenes/privacy-microphone-bar-dark, scenes/privacy-settings-dark, scenes/quick-toggles-bar-dark, scenes/quick-toggles-displays-popup-dark, scenes/quick-toggles-every-tile-popup-dark, scenes/quick-toggles-network-popup-dark, scenes/quick-toggles-networks-popup-dark, scenes/quick-toggles-popup-dark, scenes/reduce-transparency-bar-dark, scenes/reduce-transparency-bar-light, scenes/reduce-transparency-glass-bar-dark, scenes/reduce-transparency-glass-bar-light, scenes/reduce-transparency-text-follows-background-bar-dark, scenes/reduce-transparency-text-follows-background-bar-light, scenes/ring-bar-dark, scenes/settings-bar-dark, scenes/settings-bar-link-dark, scenes/settings-bar-link-review-dark, scenes/settings-bar-link-workspace-color-dark, scenes/settings-bar-look-dark, scenes/settings-bar-look-light, scenes/settings-bar-placement-bottom-dark, scenes/settings-bar-placement-dark, scenes/settings-calendar-picker-dark, scenes/settings-calendar-widget-dark, scenes/settings-clock-widget-dark, scenes/settings-crashes-dark, scenes/settings-disk-widget-dark, scenes/settings-feedback-dark, scenes/settings-general-dark, scenes/settings-general-kiwidesk-dark, scenes/settings-general-macos15-dark, scenes/settings-general-macos27-dark, scenes/settings-general-manager-not-found-dark, scenes/settings-general-move-dark, scenes/settings-general-move-failed-dark, scenes/settings-general-move-moving-dark, scenes/settings-general-move-replace-dark, scenes/settings-general-setup-open-dark, scenes/settings-general-spaces-dark, scenes/settings-general-yabai-gap-dark, scenes/settings-group-dark, scenes/settings-group-defaults-dark, scenes/settings-group-defaults-light, scenes/settings-group-theme-color-dark, scenes/settings-group-theme-color-light, scenes/settings-help-dark, scenes/settings-help-starred-dark, scenes/settings-labeled-metric-dark, scenes/settings-narrow-dark, scenes/settings-package-dark, scenes/settings-package-widget-dark, scenes/settings-profiles-conditions-dark, scenes/settings-profiles-dark, scenes/settings-profiles-groups-dark, scenes/settings-profiles-theme-dark, scenes/settings-quick-toggles-dark, scenes/settings-quits-dark, scenes/settings-store-dark, scenes/settings-theme-dark, scenes/settings-theme-edits-dark, scenes/settings-theme-edits-light, scenes/settings-theme-groups-dark, scenes/settings-theme-light, scenes/settings-theme-link-dark, scenes/settings-theme-link-light, scenes/settings-theme-origins-dark, scenes/settings-theme-versions-dark, scenes/settings-tiled-dark, scenes/settings-tiled-narrowest-dark, scenes/settings-uninstall-dark, scenes/settings-uninstall-failed-dark, scenes/settings-widget-backgrounds-dark, scenes/settings-widget-backgrounds-light, scenes/settings-widget-colors-dark, scenes/settings-widget-colors-light, scenes/settings-widget-style-theme-edits-dark, scenes/settings-widget-style-theme-edits-light, scenes/settings-workspace-hidden-dark, scenes/setup-allow-aerospace-gap-dark, scenes/setup-allow-automation-dark, scenes/setup-allow-below-menu-bar-dark, scenes/setup-allow-dark, scenes/setup-allow-dot-dark, scenes/setup-allow-macos27-dark, scenes/setup-allow-offline-dark, scenes/setup-allow-spaces-dark, scenes/setup-allow-workday-dark, scenes/setup-choose-dark, scenes/setup-choose-new-dark, scenes/setup-choose-no-battery-dark, scenes/setup-done-dark, scenes/setup-intro-dark, scenes/setup-intro-wallpaper-dark, scenes/setup-move-existing-dark, scenes/setup-move-failed-dark, scenes/setup-move-ready-dark, scenes/setup-move-replace-dark, scenes/shadow-offsets-bar-dark, scenes/shadow-offsets-bar-light, scenes/share-my-bar-dark, scenes/share-my-bar-dock-dark, scenes/share-my-bar-glass-dark, scenes/share-my-bar-glass-light, scenes/share-my-bar-landscape-dark, scenes/share-my-bar-link-dark, scenes/share-my-bar-macbook-dark, scenes/share-my-bar-post-dark, scenes/slider-end-stop-popup-dark, scenes/sound-details-popup-dark, scenes/stablebar-widget-bar-dark, scenes/stablebar-widget-settings-dark, scenes/starter-bar-dark, scenes/starter-edit-bar-dark, scenes/symbol-variants-bar-dark, scenes/system-monitor-memory-bar-dark, scenes/system-monitor-shows-settings-dark, scenes/system-monitor-split-warning-bar-dark, scenes/text-follows-background-bar-dark, scenes/text-follows-background-bar-light, scenes/themed-slider-inline-dark, scenes/themed-slider-inline-light, scenes/themed-slider-popup-dark, scenes/themed-slider-popup-light, scenes/themed-slider-tooltip-dark, scenes/themed-slider-tooltip-light, scenes/tinted-app-icons-bar-dark, scenes/tinted-app-icons-bar-light, scenes/tinted-image-bar-dark, scenes/tinted-image-bar-light, scenes/update-popup-dark, scenes/update-popup-star-github-cli-dark, scenes/update-popup-star-thanks-dark, scenes/workspace-badges-bar-dark, scenes/workspace-cells-bar-dark, scenes/workspace-focused-window-bar-dark, and 3 more

Visual review: 203 screens, none changed.

The access review can stay open while a later version from the same source is
installed, such as from the command line. Confirming it then pinned the bar to
the reviewed, older version. Stop instead and say the newer one is installed.
@M4n0x M4n0x added the deep-review CodeRabbit reviews this pull request: big or risky changes label Nov 28, 2026
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

PackageLibrary now filters update offers against installed versions and reloads installed packages before downloading or applying an update. Tests cover external installs, install records, and updates confirmed during access review.

Changes: Package update handling

Layer / File(s) Summary
Installed-state refresh and offer filtering
Sources/StableBar/Packages/PackageLibrary.swift, Tests/StableBarTests/PackageUpdateOfferTests.swift
loadInstalled() reports success or failure and retains the existing lists when loading fails. Update offers are suppressed when the source’s newest installed version is at least as new. Tests cover installed versions and missing install records.
Update and apply revalidation
Sources/StableBar/Packages/PackageLibrary.swift, Tests/StableBarTests/PackageUpdateOfferTests.swift
The update flow reloads installed packages and proceeds only if the offered entry is unchanged. The apply flow stops when a newer version from the same source is installed. Tests cover external installs during update and access review.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 8b137

This change stops Settings from offering a package update when the Store's own copy of that version, or a later one, is already installed. It also rechecks installed versions before downloading and before applying an update. No actionable merge-blocking issue was found.

Security architecture risk: Low · up to 8b137

The update now checks for newer installed versions before proceeding. One narrow gap remains: if the same version is installed separately while access review is open, confirming can enable that copy without verifying that its files match what the user reviewed.

Retained concerns

  • Medium · security · inferred: Confirmation can now select a copy installed while access review was open based on matching package ID, version, and recorded source. For a same-source copy, those identifiers do not establish that its files match the reviewed artifact. If they differ, an enabled selection can activate contents the user did not review. The previous stale-list path refused the duplicate install instead.
Security review details

Security Blast Radius

  • inferred — The affected decision is whether a package version becomes selected in the local configuration. The identified mismatch requires a pending update, a separately installed same-source copy with different contents, and an enabled selection for activation.

Trust Boundaries and Controls

  • observed — A local or unrecorded installed copy must match the reviewed files before it can take on a source's identity. A different recorded source is refused. The gap is in the same-source path, not a general bypass of source ownership.

Hardening Proposals

  • proposed — Bind activation to the reviewed package contents even when the source record already matches. If the installed copy cannot be shown to match, leave the current selection unchanged and require a fresh review.
Pre-merge checks: Passed 3

Check name Status Explanation
Description check Passed The description covers the problem (Settings › Packages offering an update to an already-installed Store version, and the "already installed" failure, linked to Fixes #955), the changes by area (updat…
Linked Issues check Passed Issue #955 is the only direct linked issue, and it is open. Its coding requirements are:

1. Offer no update when the Store's own copy of that version, or a newer one, is installed [#955]. `update(for…
Out of Scope Changes check Passed All changed hunks in Sources/StableBar/Packages/PackageLibrary.swift relate to #955:
- update(for:) and the new newestVersion(of:from:) implement the offer suppression and the folder-build excep…
Full details: Description check

Explanation

The description covers the problem (Settings › Packages offering an update to an already-installed Store version, and the "already installed" failure, linked to Fixes #955), the changes by area (update(for:), update(_:), applyUpdate, loadInstalled()), and a detailed testing section. It also reports the real-configuration reproduction, the test failures that are unrelated to this branch, and the model and harness that did the work on the last line. The Merging section states the merge strategy (merge commit or rebase) and says the three commits are all fix type. Minor gap: the Problem section does not state the Store-vs-folder rule in a single sentence, but the Changes section explains it. The template is followed in structure and all required information is present.

Full details: Linked Issues check

Explanation

Issue #955 is the only direct linked issue, and it is open. Its coding requirements are:

  1. Offer no update when the Store's own copy of that version, or a newer one, is installed [#955]. update(for:) now calls newestVersion(of:from:), which counts only installed versions whose record has the offering source and which are not local folder builds. It returns nil when that newest version is at or above the entry version.
  2. A folder build or a copy without an install record keeps the offer [#955]. newestVersion returns nil when the record is missing or the source differs, and it filters out record.isLocal versions, so the offer and the existing file check remain.
  3. Updating must not fail because the version was installed after Settings read its list [#955]. update(_:) now calls loadInstalled() before downloading. It proceeds only if update(for:) still returns the same entry key. This prevents the .alreadyInstalled failure from the stale list.
  4. Installing during the "Review additional access" dialog must not fail [#955]. applyUpdate calls reloadInstalled() first. It then claims the version when isInstalled(draft) is true, and it shows a notice when a newer same-source version is installed.
  5. The issue's stale-data diagnosis is addressed. loadInstalled() reads manifests and records before it publishes either, and it returns a success flag. applyUpdate reports a failed reread through the thrown error.

Automated tests: the PR description and raw summary report Tests/StableBarTests/PackageUpdateOfferTests.swift, which covers these cases. I did not inspect the test file. The source diff supports the behavior described. The result relies on the author's reported test runs.

Uncertainty: the issue asks that the page stop offering the update after an outside install while Settings stays open. The fix applies the new state on the next loadInstalled() publish or on the press in update(_:). I did not verify that Settings reloads installed state on its own while open. The press path does handle the stale offer.

Full details: Out of Scope Changes check

Explanation

All changed hunks in Sources/StableBar/Packages/PackageLibrary.swift relate to #955:

  • update(for:) and the new newestVersion(of:from:) implement the offer suppression and the folder-build exception.
  • update(_:) adds the reread and offer-key check before download.
  • applyUpdate adds the reread, the claim path, and the newer-version notice.
  • loadInstalled() and reloadInstalled() add the atomic reread and the success result that the other changes need.

The new test file Tests/StableBarTests/PackageUpdateOfferTests.swift tests these same behaviors. The PR description and raw summary do not show unrelated changes. No stack evidence was supplied, so this check covers only changes introduced by the current PR.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between add49b0 and 8b13782.

Files selected for processing: 2

  • Sources/StableBar/Packages/PackageLibrary.swift
  • Tests/StableBarTests/PackageUpdateOfferTests.swift

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@M4n0x
M4n0x added this pull request to the merge queue Nov 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 28, 2026
@M4n0x
M4n0x added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit 4592ebc Nov 28, 2026
29 checks passed
@M4n0x
M4n0x deleted the fix/package-update-offer branch November 28, 2026 23:17
stablebar-releases Bot pushed a commit that referenced this pull request Nov 29, 2026
## [0.20.0](v0.19.0...v0.20.0) (2026-11-29)

### Features

* animate widgets that a profile shows or hides ([#948](#948)) by @M4n0x ([eec8544](eec8544)), closes [#947](#947) [#947](#947)
* log quit causes and show unexpected quits in Status ([#953](#953)) by @M4n0x ([ea5a64e](ea5a64e)), closes [#952](#952)

### Bug Fixes

* choose a submenu item opened from the App menus tray ([#944](#944)) by @MaHofseth ([add49b0](add49b0)), closes [#942](#942)
* draw borders in whole pixels so they keep every edge on 1x screens ([#934](#934)) by @M4n0x ([8590fcd](8590fcd)), closes [#933](#933) [#933](#933)
* keep a package version installed when its folder is hidden ([#962](#962)) by @M4n0x ([2d97d15](2d97d15)), closes [#961](#961)
* keep the Sound details open and smooth when picking a device ([#931](#931)) by @M4n0x ([df96453](df96453)), closes [#928](#928) [#928](#928)
* keep windows clear of the bar after a double-click fills them ([#936](#936)) by @M4n0x ([c1478d1](c1478d1)), closes [#935](#935) [#935](#935)
* leave the keyboard with the app while StableBar shows its menus ([#943](#943)) by @MaHofseth ([abc1c4f](abc1c4f)), closes [#941](#941)
* play an app's first sound at its mixer volume ([#899](#899)) by @M4n0x ([2c38350](2c38350)), closes [#897](#897) [#897](#897)
* show a turned-off widget's last output when it comes back ([#950](#950)) by @M4n0x ([6776fcb](6776fcb)), closes [#949](#949) [#949](#949)
* show Countdown and Join in Settings after picking it ([#940](#940)) by @MaHofseth ([6ecaa72](6ecaa72))
* stop offering a package update that is already installed ([#956](#956)) by @M4n0x ([4592ebc](4592ebc))
@stablebar-releases

Copy link
Copy Markdown

🎉 This PR is included in version 0.20.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deep-review CodeRabbit reviews this pull request: big or risky changes released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Settings keeps offering a package update that is already installed

1 participant