bundle: try mas install before falling back to mas get#22271
Conversation
|
Thanks for your pull request. This has been closed because it appears to use an incomplete or outdated pull request template. Please edit the pull request body to fill in the current pull request template. This workflow will reopen the pull request automatically once the template is complete. |
|
I need to investigate. |
Fixes purchase-history regression introduced by Homebrew#21590 (closes Homebrew#21559). `mas get` fails on macOS 26.5 / mas 7.0.0 for apps in the Apple ID's purchase history but not on disk, while `mas install` succeeds. Try `install` first (fast path for owned apps); fall back to `get` for fresh-account scenario (the original Homebrew#21559 motivation). Fixes Homebrew#22270
15854df to
a67c0f2
Compare
|
I've never gotten 1160374471 before. I had never even heard of it, so my first $ mas config
mas ▁▁▁▁ 7.0.0
slice ▁▁ arm64
slices ▁ arm64
dist ▁▁▁ homebrew/core/mas
origin ▁ https://github.com/mas-cli/mas.git
rev ▁▁▁▁ 7c70ffdfd9f71a654300a78b3b627782e6abe1b4
swift ▁▁ 6.3 (swiftlang-6.3.0.123.5 clang-2100.0.123.102)
driver ▁ 1.148.6
store ▁▁ US
region ▁ US
macos ▁▁ 26.5 (25F71)
mac ▁▁▁▁ Mac16,9
cpu ▁▁▁▁ Apple M4 Max
arch ▁▁▁ arm64
$ mas get 1160374471
Password:
==> Downloading PiPifier (1.4)
==> Downloaded PiPifier (1.4)
==> Getting PiPifier (1.4)
==> Got PiPifier (1.4) in /Applications/PiPifier.app
$ mas list 1160374471
1160374471 PiPifier (1.4)
$ mas uninstall 1160374471
Uninstalled '/Applications/PiPifier.app' to '/Users/user/.Trash/PiPifier.app'
$ mas list 1160374471
Error: No installed apps with ADAM ID 1160374471
Warning: No installed apps found
If this is unexpected, index apps in Spotlight (which might take some time):
# Individual app (if the omitted apps are known). e.g., for Xcode:
mdimport /Applications/Xcode.app
# All apps:
vol="$(/usr/libexec/PlistBuddy -c "Print :PreferredVolume:name" ~/Library/Preferences/com.apple.appstored.plist 2>/dev/null)"
mdimport /Applications ${vol:+"/Volumes/${vol}/Applications"}
# All volumes:
sudo mdutil -Eai on
$ mas get 1160374471
==> Downloading PiPifier (1.4)
==> Downloaded PiPifier (1.4)
==> Getting PiPifier (1.4)
==> Got PiPifier (1.4) in /Applications/PiPifier.app
$ mas list 1160374471
1160374471 PiPifier (1.4) |
|
Thanks for the quick turnaround on this. Context: I use My config (differs from yours only in store/region): Reproducer with Hush (1544743900) — uninstall + $ mas list 1544743900
1544743900 Hush (1.0.18)
$ mas uninstall 1544743900
Uninstalled '/Applications/Hush.app' to '/Users/wojtek/.Trash/Hush.app'
$ mas list 1544743900
Error: No installed apps with ADAM ID 1544743900
Warning: No installed apps found
$ mas get 1544743900
Error: No downloads initiated for ADAM ID 1544743900
$ mas install 1544743900
==> Downloading Hush Nag Blocker (1.0.18)
==> Downloaded Hush Nag Blocker (1.0.18)
==> Installing Hush Nag Blocker (1.0.18)
==> Installed Hush Nag Blocker (1.0.18) in /Applications/Hush.appOne nuance: even your passing test ( No hypothesis yet on the root cause. Happy to capture |
|
Thanks for the additional detail. If you can provide the Homebrew personnel: if & when this is solved, or more information is found about the extent and/or cause of the different behaviors, I'll let you know. I could create a new mas command, or update one of the existing commands, to try get then install if the get fails (or vice versa), but I assume that running one command then the other, like in this PR, should solve the problem for brew bundle. |
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Makes sense, thanks @wojteksbt!
|
Hi @rgoldberg, I filed the upstream issue with the |
|
Hi @MikeMcQuaid — quick note: this PR was opened against Looking at the post-merge runs on — the direct merge into If you'd still like this change, I'm happy to open a fresh PR with |
Please, thanks! |
brew lgtm(style, typechecking and tests) with your changes locally?(Ran components individually:
brew tests --only=bundle/mac_app_store --no-parallel14/14 pass,brew styleno new offenses,brew typecheckclean.)AI (Claude Code) drafted the patch and RSpec test based on issue #22270, which I authored after manually reproducing the regression on a fresh macOS 26.5 install. I verified the empirical reproducer myself (
mas get <id>fails wheremas install <id>succeeds for a purchase-history app not on disk). Tests, style, and typecheck were all run locally before pushing.What this fixes
Fixes #22270.
PR #21590 switched
brew bundlefrommas installtomas getbased on the assertion in #21559 that they're equivalent for already-purchased apps. Empirically on macOS 26.5 / mas 7.0.0 this isn't true —mas getreturnsNo downloads initiated for ADAM ID <id>for apps in the Apple ID's purchase history but not present on disk, whilemas installsucceeds for the same id in the same session.This adopts the fallback strategy from the #21559 body that wasn't taken in #21590:
Both scenarios are now covered: purchase-history restore (install succeeds, get not called) and fresh Apple Account (install fails, get takes over).
cc @rgoldberg @MikeMcQuaid