From f2d4d32bd043fc40ecac0bfacc24634a7bd29b77 Mon Sep 17 00:00:00 2001 From: brennanb2025 Date: Sun, 28 Jun 2026 11:31:44 -0700 Subject: [PATCH] fix(mobile): narrow closed-train states and degrade gracefully on API error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review follow-ups: - Drop IN_REVIEW / WAITING_FOR_REVIEW / PROCESSING_FOR_APP_STORE from the closed set. Those versions still accept TestFlight builds, so treating them as closed would auto-bump the marketing version mid-beta-iteration — the exact workflow this change is meant to preserve. Only approved/released/ removed states terminally close the train (the 90186 case). - Rescue API errors in version_train_closed? and assume open, so a transient ASC blip degrades to today's behavior instead of failing the release. Co-authored-by: Orca --- mobile/fastlane/Fastfile | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mobile/fastlane/Fastfile b/mobile/fastlane/Fastfile index 7ca9c61de65..96ab6a957c1 100644 --- a/mobile/fastlane/Fastfile +++ b/mobile/fastlane/Fastfile @@ -30,18 +30,15 @@ BUNDLE_ID = "com.stably.orca.mobile" TESTFLIGHT_GROUPS = ["peeps"].freeze DEFAULT_TESTFLIGHT_CHANGELOG = "Latest Orca Mobile updates and fixes.".freeze -# App Store version states in which the version "train" no longer accepts new -# TestFlight build uploads (altool rejects with 90186 "train ... is closed"). -# Once a version has been submitted/approved/released, builds must go under a -# higher marketing version. PROCESSING_FOR_APP_STORE / IN_REVIEW are included -# conservatively: a build is already committed to that train. +# App Store version states in which the version "train" is terminally closed to +# new TestFlight build uploads (altool rejects with 90186 "train ... is +# closed"). Only approved/released/removed states qualify: a version that is +# merely IN_REVIEW / WAITING_FOR_REVIEW / PROCESSING_FOR_APP_STORE still accepts +# TestFlight builds, so bumping on those would break normal beta iteration. CLOSED_APP_STORE_STATES = %w[ READY_FOR_SALE PENDING_DEVELOPER_RELEASE PENDING_APPLE_RELEASE - PROCESSING_FOR_APP_STORE - IN_REVIEW - WAITING_FOR_REVIEW REPLACED_WITH_NEW_VERSION REMOVED_FROM_SALE DEVELOPER_REMOVED_FROM_SALE @@ -91,6 +88,8 @@ end # Returns true when `version`'s App Store train is closed to new build uploads. # app_store_connect_api_key (set_spaceship_token: true, the default) has already # authenticated Spaceship::ConnectAPI globally, so no extra auth is needed here. +# On any API error, degrade to "open": the upload then either succeeds or fails +# with the same 90186 we have always seen — never worse than today's behavior. def version_train_closed?(version) app = Spaceship::ConnectAPI::App.find(BUNDLE_ID) return false unless app @@ -98,6 +97,9 @@ def version_train_closed?(version) app .get_app_store_versions(filter: { versionString: version }) .any? { |app_store_version| CLOSED_APP_STORE_STATES.include?(app_store_version.app_store_state) } +rescue StandardError => error + UI.important("Could not determine App Store state for #{version} (#{error.message}); assuming open.") + false end def testflight_changelog