Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

πŸ–₯️ Only search, outdated and update macOS apps #505

Merged
merged 14 commits into from
Feb 18, 2024
Merged

Conversation

phatblat
Copy link
Member

Resolves #336, #491

Obviates #496, #503, #504

Since the introduction of iOS apps on macOS (running on Apple Silicon), mas has had no knowledge of the difference and occasionally shows iOS apps in search results or attempts to update macOS apps with the iOS app metadata and fails with confusing errors.

This PR builds on @chris-araman's research and simply filters out iOS apps for now. I'm opening this as a draft for review and to show the community that I'm looking into resolving these issues, but this change will need some testing before release.

Explicit support for installing and updating iOS apps can be added, but that work will be outside this PR.

@phatblat
Copy link
Member Author

I've published a build with this on the releases page:
https://github.com/mas-cli/mas/releases/tag/v1.8.7-beta.1

@rgoldberg
Copy link
Contributor

For 1.8.7 Beta 1 on macOS 12.7.2 on Intel:

$ mas outdated
899247664 TestFlight (3.3.0 -> 3.4.3)
545519333 Prime Video (10.11 -> 10.11.1)

3.3.0 & 10.11 are the most recent versions that can be installed on my machine, so the above output seems incorrect.

When I tested the change from #496 & #503 (they have the exact same one-line change) in Xcode 14.2, mas outdated correctly did not output anything.

Can you try #496 and/or #503 in Xcode? If that works for you, can you release 1.8.7 Beta 2 with just that change, not including the other changes from this PR?

Thanks.

Sorry for the delay. I should be able to quickly test anything you release in the upcoming weeks much more rapidly than my 3-week delay for 1.8.7 Beta 1.

@phatblat
Copy link
Member Author

Updated this branch from main and actions workflow is stalling while it's running tests.

[225/226] Compiling MasKitTests resource_bundle_accessor.swift
[225/226] Linking masPackageTests
Build complete! (21.58s)
Test Suite 'All tests' started at 2024-02-17 19:09:14.201.
Test Suite 'masPackageTests.xctest' started at 2024-02-17 19:09:14.202.
Test Suite 'AppListsFormatterSpec' started at 2024-02-17 19:09:14.202.
Test Case '-[MasKitTests.AppListsFormatterSpec app_list_formatter__formats_nothing_as_empty_string]' started.
Test Case '-[MasKitTests.AppListsFormatterSpec app_list_formatter__formats_nothing_as_empty_string]' passed (0.001 seconds).
Test Case '-[MasKitTests.AppListsFormatterSpec app_list_formatter__can_format_a_single_product]' started.
Test Case '-[MasKitTests.AppListsFormatterSpec app_list_formatter__can_format_a_single_product]' passed (0.000 seconds).
Test Case '-[MasKitTests.AppListsFormatterSpec app_list_formatter__can_format_two_products]' started.
Test Case '-[MasKitTests.AppListsFormatterSpec app_list_formatter__can_format_two_products]' passed (0.000 seconds).
Test Suite 'AppListsFormatterSpec' passed at 2024-02-17 19:09:14.203.
	 Executed 3 tests, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'HomeCommandSpec' started at 2024-02-17 19:09:14.203.
Test Case '-[MasKitTests.HomeCommandSpec home_command__fails_to_open_app_with_invalid_ID]' started.
Test Case '-[MasKitTests.HomeCommandSpec home_command__fails_to_open_app_with_invalid_ID]' passed (0.000 seconds).
Test Case '-[MasKitTests.HomeCommandSpec home_command__can_t_find_app_with_unknown_ID]' started.
Test Case '-[MasKitTests.HomeCommandSpec home_command__can_t_find_app_with_unknown_ID]' passed (0.000 seconds).
Test Case '-[MasKitTests.HomeCommandSpec home_command__opens_app_on_MAS_Preview]' started.
Test Case '-[MasKitTests.HomeCommandSpec home_command__opens_app_on_MAS_Preview]' passed (0.000 seconds).
Test Suite 'HomeCommandSpec' passed at 2024-02-17 19:09:14.204.
	 Executed 3 tests, with 0 failures (0 unexpected) in 0.001 (0.001) seconds
Test Suite 'InfoCommandSpec' started at 2024-02-17 19:09:14.204.
Test Case '-[MasKitTests.InfoCommandSpec Info_command__fails_to_open_app_with_invalid_ID]' started.
Test Case '-[MasKitTests.InfoCommandSpec Info_command__fails_to_open_app_with_invalid_ID]' passed (0.000 seconds).
Test Case '-[MasKitTests.InfoCommandSpec Info_command__can_t_find_app_with_unknown_ID]' started.
Test Case '-[MasKitTests.InfoCommandSpec Info_command__can_t_find_app_with_unknown_ID]' passed (0.000 seconds).
Test Case '-[MasKitTests.InfoCommandSpec Info_command__displays_app_details]' started.
Test Case '-[MasKitTests.InfoCommandSpec Info_command__displays_app_details]' passed (0.003 seconds).
Test Suite 'InfoCommandSpec' passed at 2024-02-17 19:09:14.207.
	 Executed 3 tests, with 0 failures (0 unexpected) in 0.003 (0.003) seconds
Test Suite 'InstallCommandSpec' started at 2024-02-17 19:09:14.207.
Test Case '-[MasKitTests.InstallCommandSpec install_command__installs_apps]' started.
Test Case '-[MasKitTests.InstallCommandSpec install_command__installs_apps]' passed (0.003 seconds).
Test Suite 'InstallCommandSpec' passed at 2024-02-17 19:09:14.211.
	 Executed 1 test, with 0 failures (0 unexpected) in 0.003 (0.003) seconds
Test Suite 'ListCommandSpec' started at 2024-02-17 19:09:14.211.
Test Case '-[MasKitTests.ListCommandSpec list_command__lists_apps]' started.
Error: No installed apps found
Test Case '-[MasKitTests.ListCommandSpec list_command__lists_apps]' passed (0.109 seconds).
Test Suite 'ListCommandSpec' passed at 2024-02-17 19:09:14.320.
	 Executed 1 test, with 0 failures (0 unexpected) in 0.109 (0.109) seconds
Test Suite 'LuckyCommandSpec' started at 2024-02-17 19:09:14.320.
Test Case '-[MasKitTests.LuckyCommandSpec lucky_command__installs_the_first_app_matching_a_search]' started.
CoreData: fault: Unable to create token NSXPCConnection.  NSXPCStoreServerEndpointFactory 0x60000272d1d0 -newEndpoint returned nil
CoreData: error: Failed to create NSXPCConnection
CoreData: fault: Unable to create token NSXPCConnection.  NSXPCStoreServerEndpointFactory 0x60000272d1d0 -newEndpoint returned nil
CoreData: error: Failed to create NSXPCConnection
CoreData: fault: Unable to create token NSXPCConnection.  NSXPCStoreServerEndpointFactory 0x60000272d1d0 -newEndpoint returned nil
CoreData: error: Failed to create NSXPCConnection
CoreData: fault: Unable to create token NSXPCConnection.  NSXPCStoreServerEndpointFactory 0x60000272d1d0 -newEndpoint returned nil
CoreData: error: Failed to create NSXPCConnection
CoreData: fault: Unable to create token NSXPCConnection.  NSXPCStoreServerEndpointFactory 0x60000272d1d0 -newEndpoint returned nil
CoreData: error: Failed to create NSXPCConnection
CoreData: fault: Unable to create token NSXPCConnection.  NSXPCStoreServerEndpointFactory 0x60000272d1d0 -newEndpoint returned nil
CoreData: error: Failed to create NSXPCConnection
2024-02-17 19:09:14.473 xctest[9957:41072] CoreData: XPC: sendMessage: failed #0
CoreData: fault: Unable to create token NSXPCConnection.  NSXPCStoreServerEndpointFactory 0x60000272d1d0 -newEndpoint returned nil
CoreData: error: Failed to create NSXPCConnection
CoreData: fault: Unable to create token NSXPCConnection.  NSXPCStoreServerEndpointFactory 0x60000[272](https://github.com/mas-cli/mas/actions/runs/7943403809/job/21688393382#step:5:273)d1d0 -newEndpoint returned nil
CoreData: error: Failed to create NSXPCConnection
2024-02-17 19:09:14.478 xctest[9957:41072] CoreData: XPC: sendMessage: failed #1
CoreData: fault: Unable to create token NSXPCConnection.  NSXPCStoreServerEndpointFactory 0x60000272d1d0 -newEndpoint returned nil
CoreData: error: Failed to create NSXPCConnection
CoreData: fault: Unable to create token NSXPCConnection.  NSXPCStoreServerEndpointFactory 0x60000272d1d0 -newEndpoint returned nil
CoreData: error: Failed to create NSXPCConnection
2024-02-17 19:09:17.665 xctest[9957:41072] CoreData: XPC: sendMessage: failed #2
2024-02-17 19:09:17.665 xctest[9957:41072] CoreData: XPC: Unable to sendMessage: to server
CoreData: fault: Unable to create token NSXPCConnection.  NSXPCStoreServerEndpointFactory 0x60000272d1d0 -newEndpoint returned nil

@phatblat
Copy link
Member Author

phatblat commented Feb 18, 2024

I'm not getting the same CoreData logs, but when running tests from this branch locally, it stops as MasKitTests.LuckyCommandSpec lucky_command__installs_the_first_app_matching_a_search with a Mac App Store login dialog waiting for a password.

Test Suite 'LuckyCommandSpec' started at 2024-02-17 20:14:32.782.
Test Case '-[MasKitTests.LuckyCommandSpec lucky_command__installs_the_first_app_matching_a_search]' started.

@rgoldberg
Copy link
Contributor

@phatblat I assume that the test failure is from the change to LuckyCommandSpec.swift in cfc2bef. Can you revert that to see if it fixes the test?

@phatblat
Copy link
Member Author

Yep, that was it. This test was disabled because it isn't properly mocked.

describe("lucky command") {
    xit("installs the first app matching a search")

Stalls test when a MAS auth dialog stalls tests. Need more mocking.
Resolves unused protocol method lint warnings by moving updated implementations back to StoreSearch. Added `country` to MasStoreSearch, set to fixed fvalue for tests.
@phatblat phatblat merged commit 21ed1e6 into main Feb 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

πŸ› [BUG] mas confuses macOS and iOS/iPadOS apps
3 participants