Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
ci(ios-release): hold approved App Store versions until the prod deploy (#8951)
Peter Chinman8def543a67ec
diff --git a/.github/workflows/export-ci-telemetry.yml b/.github/workflows/export-ci-telemetry.ymlindex dae2594535..c717571810 100644--- a/.github/workflows/export-ci-telemetry.yml+++ b/.github/workflows/export-ci-telemetry.yml@@ -50,6 +50,7 @@ name: Export CI telemetry- cloud storage code check- conventions code check- deploy pulumi service+ - iOS App Store Publish- iOS Preview- infra code checkpermissions:diff --git a/.github/workflows/ios-app-store-publish.yml b/.github/workflows/ios-app-store-publish.ymlnew file mode 100644index 0000000000..2b16ecc4bd--- /dev/null+++ b/.github/workflows/ios-app-store-publish.yml@@ -0,0 +1,103 @@+# DO NOT EDIT — regenerate with `cargo x workflows` (from the repository root).+# Source: tooling/xtask/crates/xtask_workflows/src/workflows/ios_app_store_publish.rs+name: iOS App Store Publish+'on':+ workflow_call:+ secrets:+ IOS_RELEASE_DOPPLER_TOKEN:+ description: Doppler service token for ios-release/prd+ required: true+ workflow_dispatch: {}+jobs:+ publish:+ name: Release the approved iOS version on the App Store+ runs-on: namespace-profile-linux-tiny-no-cache+ permissions:+ contents: read+ timeout-minutes: 10+ steps:+ - name: Require a release tag+ run: |+ if [[ "$GITHUB_REF_TYPE" != "tag" ]]; then+ echo "Run this from the deployed release tag (\"Use workflow from\": the tag), not ${GITHUB_REF_NAME}:" \+ "a branch can commit another PR's held version whose web bundle has not deployed." \+ "To retry a failed publish, re-run the failed job in the Deploy Production Release run." >&2+ exit 1+ fi+ shell: bash+ - name: Checkout+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd+ with:+ clean: 'false'+ persist-credentials: 'false'+ - name: Setup Bun+ uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6+ with:+ bun-version: '1.3.13'+ - name: Fetch App Store Connect credentials from Doppler+ run: |+ set -euo pipefail+ # Fetch the App Store Connect credentials from Doppler (ios-release/prd) —+ # the same shape as the DMG workflow's notarization step — and hand them to+ # later steps the way the iOS scripts expect them:+ # APPLE_API_KEY / APPLE_API_ISSUER exported via GITHUB_ENV+ # ~/.appstoreconnect/private_keys/AuthKey_<ID>.p8 the private key, where+ # altool, tauri (APPLE_API_KEY_PATH default) and ios-app-store.mjs look+ # With IOS_DISTRIBUTION_CERTIFICATE=1 the optional Apple Distribution .p12 is+ # decoded to $RUNNER_TEMP and exported as APPLE_DISTRIBUTION_CERTIFICATE_PATH+ # / _PASSWORD for the signing step.+ if [ -z "${DOPPLER_TOKEN:-}" ]; then+ echo "DOPPLER_TOKEN is empty: the IOS_RELEASE_DOPPLER_TOKEN secret is missing, or this is a fork PR (secrets are not available to forks; a maintainer must run the release from a branch in this repository, or add skip-ios-update if the change is non-breaking)." >&2+ exit 1+ fi++ umask 077+ secrets=$(mktemp)+ trap 'rm -f "$secrets"' EXIT+ curl --fail --silent --show-error --retry 3 \+ --header "Authorization: Bearer $DOPPLER_TOKEN" \+ 'https://api.doppler.com/v3/configs/config/secrets/download?project=ios-release&config=prd&format=json' \+ > "$secrets"++ required() {+ jq -er --arg name "$1" '.[$name] | strings | select(length > 0)' "$secrets" \+ || { echo "ios-release/prd is missing $1" >&2; exit 1; }+ }+ key_id=$(required APPLE_API_KEY_ID)+ issuer=$(required APPLE_API_ISSUER)++ key_dir="$HOME/.appstoreconnect/private_keys"+ mkdir -p "$key_dir"+ key_path="$key_dir/AuthKey_${key_id}.p8"+ required APPLE_API_PRIVATE_KEY > "$key_path"+ echo "::add-mask::$issuer"+ {+ echo "APPLE_API_KEY=$key_id"+ echo "APPLE_API_ISSUER=$issuer"+ } >> "$GITHUB_ENV"+ echo "Wrote App Store Connect API key $key_id to $key_path"++ if [ "${IOS_DISTRIBUTION_CERTIFICATE:-}" = "1" ]; then+ certificate=$(jq -r '.APPLE_DISTRIBUTION_CERTIFICATE_BASE64 // empty' "$secrets")+ if [ -z "$certificate" ]; then+ echo "No APPLE_DISTRIBUTION_CERTIFICATE_BASE64 in ios-release/prd; the build will" \+ "rely on Xcode cloud signing via the API key."+ exit 0+ fi+ certificate_path="$RUNNER_TEMP/apple-distribution.p12"+ printf '%s' "$certificate" | base64 --decode > "$certificate_path" 2>/dev/null \+ || printf '%s' "$certificate" | base64 -D > "$certificate_path"+ password=$(jq -r '.APPLE_DISTRIBUTION_CERTIFICATE_PASSWORD // empty' "$secrets")+ [ -z "$password" ] || echo "::add-mask::$password"+ {+ echo "APPLE_DISTRIBUTION_CERTIFICATE_PATH=$certificate_path"+ echo "APPLE_DISTRIBUTION_CERTIFICATE_PASSWORD=$password"+ } >> "$GITHUB_ENV"+ echo "Wrote Apple Distribution certificate to $certificate_path"+ fi+ shell: bash+ env:+ DOPPLER_TOKEN: ${{ secrets.IOS_RELEASE_DOPPLER_TOKEN }}+ - name: Release the committed version if Apple approved it+ run: bun scripts/ios-app-store.mjs publish+ working-directory: apps/webdiff --git a/.github/workflows/ios-app-store-release.yml b/.github/workflows/ios-app-store-release.ymlindex 5d060f469b..f164c52457 100644--- a/.github/workflows/ios-app-store-release.yml+++ b/.github/workflows/ios-app-store-release.yml@@ -67,7 +67,7 @@ jobs:# natively, and the team bumps that version when a cache change must ship, so# the bump — not every edit under crates/client — is the native signal. The# release stamps uploaded builds with the hash, the merge gate compares the- # live build's stamp against the merge result's, and the drift / head guards+ # approved build's stamp against the merge result's, and the drift / head guards# compare commits with it. Must match nativeTreeHash() in# apps/web/scripts/ios-app-store.mjs and the iOS Native Check's change# detection (web_app_check_main/ios_native_check.rs).@@ -220,7 +220,7 @@ jobs:# every other check on the head commit passing. Pending checks are waited on# (the label often lands right after a push); anything failing stops the# release before the long build. Our own checks are excluded: the native- # check is expected to be red until the release is live.+ # check is expected to be red until Apple approves the release.pr_json=$(gh pr view "$PR_NUMBER" --repo "$GH_REPO" --json isDraft,headRefOid)if [[ "$(jq -r '.isDraft' <<<"$pr_json")" == "true" ]]; thenecho "PR #${PR_NUMBER} is a draft; mark it ready for review before adding ios-update." >&2@@ -454,7 +454,7 @@ jobs:# natively, and the team bumps that version when a cache change must ship, so# the bump — not every edit under crates/client — is the native signal. The# release stamps uploaded builds with the hash, the merge gate compares the- # live build's stamp against the merge result's, and the drift / head guards+ # approved build's stamp against the merge result's, and the drift / head guards# compare commits with it. Must match nativeTreeHash() in# apps/web/scripts/ios-app-store.mjs and the iOS Native Check's change# detection (web_app_check_main/ios_native_check.rs).@@ -668,11 +668,12 @@ jobs:const SUCCESS_BODY = [`📱 iOS ${version} (build ${build}) was uploaded to TestFlight and submitted for App Review.`,'',- 'When Apple approves it, the version releases to the App Store automatically,',- 'the **iOS Release Watch** workflow re-runs the **iOS Native Check** on this PR',- 'within half an hour of that, and the PR becomes mergeable. To merge it the',- 'moment that happens, click **Enable auto-merge** on this PR now (squash).',- 'After merge, the next prod deploy applies the iOS native build floor committed in `min-native-build.json`, prompting older installs to update.',+ 'When Apple approves it, the **iOS Release Watch** workflow re-runs the',+ '**iOS Native Check** on this PR within half an hour, and the PR becomes',+ 'mergeable. To merge it the moment that happens, click **Enable auto-merge**',+ 'on this PR now (squash). Apple holds the approved version until the next',+ 'prod deploy releases it on the App Store and applies the iOS native build floor',+ 'committed in `min-native-build.json`, prompting older installs to update.','',`[Workflow run](${runUrl})`,].join('\n');diff --git a/.github/workflows/ios-release-drift.yml b/.github/workflows/ios-release-drift.ymlindex aa117f1626..2c9982759b 100644--- a/.github/workflows/ios-release-drift.yml+++ b/.github/workflows/ios-release-drift.yml@@ -46,7 +46,7 @@ jobs:# natively, and the team bumps that version when a cache change must ship, so# the bump — not every edit under crates/client — is the native signal. The# release stamps uploaded builds with the hash, the merge gate compares the- # live build's stamp against the merge result's, and the drift / head guards+ # approved build's stamp against the merge result's, and the drift / head guards# compare commits with it. Must match nativeTreeHash() in# apps/web/scripts/ios-app-store.mjs and the iOS Native Check's change# detection (web_app_check_main/ios_native_check.rs).@@ -232,6 +232,8 @@ jobs:bump='cd apps/web && doppler run --project ios-release --config prd -- just ios-bump'if [[ "$WITHDRAW_OUTCOME" != "success" ]]; thenbody="🚨 Native changes were pushed to this PR after its App Store release started, but withdrawing the App Review submission **failed** (see the [workflow run](${RUN_URL})). If a submission is pending, remove it from review in App Store Connect by hand so the stale build cannot go live. The \`ios-update\` label was removed; when the PR is ready again, bump (\`${bump}\`), commit, push, and re-add \`ios-update\`."+ elif [[ -n "$HELD" ]]; then+ body="📱 Native changes were pushed to this PR after Apple had already approved iOS ${HELD}. That build is held for release, so it will not go live on its own, but it blocks the next submission: remove it in App Store Connect (Developer Reject). Then bump (\`${bump}\`), commit, push, and re-add \`ios-update\`. The label was removed."elif [[ -n "$LIVE" ]]; thenbody="🚨 Native changes were pushed to this PR after Apple had already approved iOS ${LIVE}, so that build is (or is about to be) live with native code this PR no longer matches. Bump (\`${bump}\`), commit, re-add the \`ios-update\` label, and ship the follow-up as soon as possible. The label was removed."else@@ -240,6 +242,7 @@ jobs:gh pr comment "$PR_NUMBER" --repo "$GH_REPO" --body "$body"shell: bashenv:+ HELD: ${{ steps.withdraw.outputs.held }}LIVE: ${{ steps.withdraw.outputs.live }}WITHDRAW_OUTCOME: ${{ steps.withdraw.outcome }}RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}diff --git a/.github/workflows/ios-release-watch.yml b/.github/workflows/ios-release-watch.ymlindex 0e095bafec..aef3774a0b 100644--- a/.github/workflows/ios-release-watch.yml+++ b/.github/workflows/ios-release-watch.yml@@ -11,7 +11,7 @@ permissions:pull-requests: writejobs:watch:- name: Re-run the iOS Native Check once the App Store release is live+ name: Re-run the iOS Native Check once Apple approves the App Store releaseruns-on: namespace-profile-linux-tiny-no-cacheenv:GH_TOKEN: ${{ github.token }}@@ -106,7 +106,7 @@ jobs:shell: bashenv:DOPPLER_TOKEN: ${{ secrets.IOS_RELEASE_DOPPLER_TOKEN }}- - name: Re-run the check on PRs whose release is live+ - name: Re-run the check on PRs whose release Apple approvedif: steps.prs.outputs.count != '0'run: |# --- native tree ------------------------------------------------------------@@ -127,7 +127,7 @@ jobs:# natively, and the team bumps that version when a cache change must ship, so# the bump — not every edit under crates/client — is the native signal. The# release stamps uploaded builds with the hash, the merge gate compares the- # live build's stamp against the merge result's, and the drift / head guards+ # approved build's stamp against the merge result's, and the drift / head guards# compare commits with it. Must match nativeTreeHash() in# apps/web/scripts/ios-app-store.mjs and the iOS Native Check's change# detection (web_app_check_main/ios_native_check.rs).@@ -182,11 +182,12 @@ jobs:# what the `iOS Release Drift` workflow does on push, except GitHub does# not run pull_request workflows on a PR that conflicts with main, so a# native push to such a PR only gets caught here.- # 2. Ask App Store Connect whether the iOS version + build committed at the- # PR head is live, built from the native tree the PR's merge result would- # have (`merge` is GitHub's test merge commit; the gate hashes the same).- # When it is, and the PR's latest `iOS Native Check` job (of the web app- # PR checks run) failed — it fails until the release is live — re-run that+ # 2. Ask App Store Connect whether Apple approved the iOS version + build+ # committed at the PR head (held for release, or live), built from the+ # native tree the PR's merge result would have (`merge` is GitHub's test+ # merge commit; the gate hashes the same). When it did, and the PR's latest+ # `iOS Native Check` job (of the web app PR checks run) failed — it fails+ # until Apple approves — re-run that# job so the gate, and the `Web App Status Check` that depends on it, go# green without anyone clicking "Re-run".#@@ -196,7 +197,7 @@ jobs:bump='cd apps/web && doppler run --project ios-release --config prd -- just ios-bump'check_pr() {- local pr=$1 number sha merge conf version build head_tree native_tree run run_id status run_url job conclusion job_id reruns outputs withdrawn live+ local pr=$1 number sha merge conf version build head_tree native_tree run run_id status run_url job conclusion job_id reruns outputs withdrawn held livenumber=$(jq -r '.number' <<<"$pr")sha=$(jq -r '.sha' <<<"$pr")merge=$(jq -r '.merge // empty' <<<"$pr")@@ -213,10 +214,13 @@ jobs:>"$RUNNER_TEMP/withdraw-${number}.log" 2>&1 || truesed 's/^/ /' "$RUNNER_TEMP/withdraw-${number}.log"withdrawn=$(sed -n 's/^withdrawn=//p' "$outputs")+ held=$(sed -n 's/^held=//p' "$outputs")live=$(sed -n 's/^live=//p' "$outputs")- if [[ "$withdrawn" == "true" || -n "$live" ]]; then+ if [[ "$withdrawn" == "true" || -n "$held" || -n "$live" ]]; thengh pr edit "$number" --remove-label ios-update- if [[ -n "$live" ]]; then+ if [[ -n "$held" ]]; then+ gh pr comment "$number" --body "📱 Native changes were pushed to this PR after Apple had already approved iOS ${held}. That build is held for release, so it will not go live on its own, but it blocks the next submission: remove it in App Store Connect (Developer Reject). Then bump (\`${bump}\`), commit, push, and re-add \`ios-update\`. The label was removed."+ elif [[ -n "$live" ]]; thengh pr comment "$number" --body "🚨 Native changes were pushed to this PR after Apple had already approved iOS ${live}, so that build is (or is about to be) live with native code this PR no longer matches. Bump (\`${bump}\`), commit, re-add the \`ios-update\` label, and ship the follow-up as soon as possible. The label was removed."elsegh pr comment "$number" --body "📱 Native code changed after this PR's App Store release started (the push-time drift check could not run — does the PR conflict with \`main\`?), so the pending App Review submission was withdrawn and the \`ios-update\` label removed. When the PR is ready again, bump (\`${bump}\`; the marketing version stays, the build number moves), commit, push, and re-add \`ios-update\`."@@ -225,7 +229,7 @@ jobs:return 0fi- # 2. Live check against the merge result.+ # 2. Approval check against the merge result.if [[ -z "$merge" ]]; thenecho "PR #${number}: no merge commit (conflicts with main?); cannot check the merge result"return 0@@ -234,14 +238,14 @@ jobs:native_tree=$(native_tree_hash "$merge")echo "PR #${number}: iOS ${version} (build ${build}) at ${sha:0:10}, merge-result native tree ${native_tree:0:10}"- if ! bun scripts/ios-app-store.mjs status --require-live \+ if ! bun scripts/ios-app-store.mjs status --require-approved \--version "$version" --build "$build" --native-tree "$native_tree" \>"$RUNNER_TEMP/status-${number}.log" 2>&1; then- echo " not live yet:"+ echo " not approved yet:"sed 's/^/ /' "$RUNNER_TEMP/status-${number}.log"return 0fi- echo " live on the App Store"+ echo " approved by Apple"run=$(gh run list --workflow web-app-check-main.yml --commit "$sha" \--json databaseId,status,url --limit 1 --jq '.[0] // empty')@@ -284,7 +288,7 @@ jobs:fiecho " re-running iOS Native Check (job ${job_id} of run ${run_id}; ${reruns} automatic re-runs so far)"gh run rerun --job "$job_id"- gh pr comment "$number" --body "📱 iOS ${version} (build ${build}) is live on the App Store. Re-ran the **iOS Native Check** ([run](${run_url})); this PR can merge once it passes."+ gh pr comment "$number" --body "📱 Apple approved iOS ${version} (build ${build}). Re-ran the **iOS Native Check** ([run](${run_url})); this PR can merge once it passes, and the next prod deploy releases it on the App Store."}# One PR's API hiccup must not stop the others from being checked thisdiff --git a/.github/workflows/release-production.yml b/.github/workflows/release-production.ymlindex 4c10e95061..6a61605ac7 100644--- a/.github/workflows/release-production.yml+++ b/.github/workflows/release-production.yml@@ -57,6 +57,20 @@ jobs:AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}+ # Releases the iOS version Apple approved for the native changes in this+ # release; it is held until now. It waits for the web deploy, so the native+ # build never goes live while prod still serves the previous web bundle (a+ # release request cannot be cancelled). Nothing depends on it: an App Store+ # Connect failure must not hold back the prod deploy.+ publish-ios:+ name: Publish iOS App Store Version+ needs: [deploy]+ permissions:+ contents: read+ uses: ./.github/workflows/ios-app-store-publish.yml+ secrets:+ IOS_RELEASE_DOPPLER_TOKEN: ${{ secrets.IOS_RELEASE_DOPPLER_TOKEN }}+build:if: github.event_name == 'release'name: Build Web Appdiff --git a/.github/workflows/web-app-check-main.yml b/.github/workflows/web-app-check-main.ymlindex d40c12d6f0..e0a10b4b93 100644--- a/.github/workflows/web-app-check-main.yml+++ b/.github/workflows/web-app-check-main.yml@@ -676,7 +676,7 @@ jobs:env:DOPPLER_TOKEN: ${{ secrets.IOS_RELEASE_DOPPLER_TOKEN }}- id: live- name: Require the App Store release to be live+ name: Require Apple's approval of the App Store releaseif: (steps.native-filter.outputs.ios_native == 'true' || steps.cache-wasm.outputs.bumped == 'true') && steps.labels.outputs.skip != 'true'run: |# --- native tree ------------------------------------------------------------@@ -697,7 +697,7 @@ jobs:# natively, and the team bumps that version when a cache change must ship, so# the bump — not every edit under crates/client — is the native signal. The# release stamps uploaded builds with the hash, the merge gate compares the- # live build's stamp against the merge result's, and the drift / head guards+ # approved build's stamp against the merge result's, and the drift / head guards# compare commits with it. Must match nativeTreeHash() in# apps/web/scripts/ios-app-store.mjs and the iOS Native Check's change# detection (web_app_check_main/ios_native_check.rs).@@ -775,13 +775,14 @@ jobs:}# ------------------------------------------------------------------------------set -euo pipefail- # The gate proper: the committed version + build must be live, built from the- # native code of the PR's current merge result.+ # The gate proper: Apple must have approved the committed version + build+ # (held for release or live), built from the native code of the PR's current+ # merge result.merge=$(pr_merge_commit)native_tree_fetch "$merge"native_tree=$(native_tree_hash "$merge")echo "Merge result ${merge:0:10}: native tree ${native_tree}"- bun scripts/ios-app-store.mjs status --require-live --native-tree "$native_tree"+ bun scripts/ios-app-store.mjs status --require-approved --native-tree "$native_tree"shell: bashenv:GH_TOKEN: ${{ github.token }}@@ -837,7 +838,7 @@ jobs:lines.push('### iOS release check could not complete', '',`Failed step: **${failed.map(([id]) => names[id] ?? id).join(', ')}**.`, '',`See the [workflow logs](${runUrl}) for the error, fix it, then rerun the check.`,- 'This failure does not establish whether the App Store release is live.');+ 'This failure does not establish whether Apple approved the App Store release.');} else if (!native && detectionComplete) {lines.push('### iOS release not required', '', 'This PR no longer changes native iOS code.');} else if (steps.labels?.outputs?.skip === 'true') {@@ -845,16 +846,15 @@ jobs:'The `skip-ios-update` label bypasses this check. App Store availability has not been verified.');} else if (release) {const name = `iOS ${release.version} (build ${release.build})`;- if (release.kind === 'live') {- lines.push(`### ${name} is live and verified`, '',- 'The App Store build matches this PR’s current merge result. The iOS release requirement is satisfied; other checks and approvals still apply.');+ if (release.kind === 'approved') {+ lines.push(`### ${name} is approved and verified`, '',+ 'Apple approved the App Store build, and it matches this PR’s current merge result. The iOS release requirement is satisfied; other checks and approvals still apply.');+ if (release.state) lines.push('', `App Store state: \`${release.state}\`.`);} else {- lines.push(`### ${name} must be live before this PR can merge`, '', release.reason);+ lines.push(`### ${name} must be approved before this PR can merge`, '', release.reason);if (release.state) lines.push('', `App Store state: \`${release.state}\`.`);if (release.kind === 'waiting') {- lines.push('', release.state === 'PENDING_DEVELOPER_RELEASE'- ? 'Release the approved version in App Store Connect.'- : 'Wait for Apple to approve and make the release available.');+ lines.push('', 'Wait for Apple to approve the release.');} else if (release.kind === 'mismatch') {lines.push('', 'Bump the release numbers, commit, push, then remove and re-add `ios-update` to release the current native code. Use `--no-min` for a release that does not need a higher native build floor.');} else {@@ -862,9 +862,9 @@ jobs:? 'The `ios-update` label is already present. Follow the **iOS App Store Release** run; if it failed, fix the reported problem, then remove and re-add the label to retry. Resolve any rejection or metadata issue in App Store Connect first.': 'Once the other checks pass and the PR is ready, add **`ios-update`** to build, upload, and submit it for App Review.');}- lines.push('', 'After release, **iOS Release Watch** reruns this check within 30 minutes. You can also rerun it manually. Optionally enable **auto-merge** to merge once all requirements pass.');+ lines.push('', 'After approval, **iOS Release Watch** reruns this check within 30 minutes. You can also rerun it manually. Optionally enable **auto-merge** to merge once all requirements pass.');}- lines.push('', `The next prod web deploy will use minimum supported iOS build **${release.floor}**, as committed in this PR.`,+ lines.push('', `The next prod deploy releases ${name} on the App Store and makes the web bundle require iOS build **${release.floor}** or later, as committed in this PR.`,'', `[App Store Connect](${release.distributionUrl})`);} else {// No structured result means verification never completed; never infer andiff --git a/apps/web/docs/ios-releases.md b/apps/web/docs/ios-releases.mdindex b0bf3f5aeb..1aeb431b56 100644--- a/apps/web/docs/ios-releases.md+++ b/apps/web/docs/ios-releases.md@@ -16,11 +16,13 @@ Play as the source of truth — is described in `docs/development/android.md`.)Web bundles ship to installed apps over the air (see`tauri/macro_bundle_updater_plugin`), but native code — anything under`apps/web/tauri/` — only reaches users through the App Store. A bundle that-depends on new native code must therefore never be deployed before the-matching native build is downloadable, and users on older native builds must-be pushed to update before they receive that bundle.+depends on new native code must therefore only reach native builds that have+it, and users on older native builds must be pushed to update instead of+receiving that bundle. Apple must approve the matching native build before+its PR merges; Apple then holds it until the prod deploy that ships the+bundle releases it on the App Store.-Four generated workflows (plus a gate job in the web app PR checks) and a+Generated workflows (plus a gate job in the web app PR checks) and achecked-in `min-native-build.json` enforce this end to end.Keep the iOS app named `macro` and retain its unbadged icon assets in@@ -35,7 +37,8 @@ icon and app-name branding are Android-only.ruleset change is needed. If the PR touches the iOS native code (see"What counts as native code" below) it requires:- the iOS release numbers to be bumped relative to `main`, and- - that exact version + build to be **live on the App Store**.+ - Apple to have **approved** that exact version + build (held for+ release, or already live).Until both hold, the check fails and the PR cannot merge. On same-repoPRs, the gate maintains one status comment with the version/build, current@@ -72,7 +75,8 @@ icon and app-name branding are Android-only.the PR head on the Namespace macOS runner inside the Nix dev shell (likethe `ios-preview` label), uploads it to TestFlight, waits for App StoreConnect processing + export compliance, and submits it for App Review- (release type: automatic after approval). It comments the outcome+ (release type: manual, so Apple's approval holds it as "Pending+ Developer Release" until step 5). It comments the outcomeon the PR. To merge the moment Apple approves, click **Enableauto-merge** (squash) on the PR: GitHub then merges it as soon as`iOS Native Check` passes. (The workflow doesn't enable auto-merge@@ -89,25 +93,44 @@ icon and app-name branding are Android-only.resolve the conflicts and re-add it. On a mergeable PR that workflowinstead comments that the release started, with the version in flightand a link to the run.-4. Wait for Apple to approve. The version releases automatically, and the- **`iOS Release Watch`** workflow (`.github/workflows/ios-release-watch.yml`,- every 30 minutes) notices: for each open PR labeled `ios-update` it asks- App Store Connect whether the version + build at the PR head is live and,- when it is, re-runs the PR's failed `iOS Native Check` job and comments. The+4. Wait for Apple to approve. The **`iOS Release Watch`** workflow+ (`.github/workflows/ios-release-watch.yml`, every 30 minutes) notices: for+ each open PR labeled `ios-update` it asks App Store Connect whether Apple+ approved the version + build at the PR head and, when it did, re-runs the+ PR's failed `iOS Native Check` job and comments. Thegate turns green on its own and the PR merges if auto-merge is on.(Re-running the job by hand works too. The watcher stops after twoautomatic re-runs — counted by its own comments on the PR — so a checkfailing for another reason doesn't retry forever, and GitHub refuses tore-run runs older than 30 days: after a review that long, push a commit toget a fresh run.)-5. The next prod web deploy (`just build-prod`) reads both platform floors- from `min-native-build.json` into `MIN_NATIVE_BUILD_ANDROID` /- `MIN_NATIVE_BUILD_IOS`, so `dist/bundle-manifest.json` carries- `minNativeBuilds.ios` = the new build number. Installed apps on older- native builds stop applying OTA bundles and show the "update from the- App Store" prompt instead (`NativeUpdateRequired` in- `src/lib/tauri/TauriProvider.tsx`). The Android floor is independent:- `just android-bump` raises it; see `docs/development/android.md`.+5. The next prod deploy (`.github/workflows/release-production.yml`) ships+ the web bundle, then releases the App Store version:+ - The web build (`just build-prod`) reads both platform floors from+ `min-native-build.json` into `MIN_NATIVE_BUILD_ANDROID` /+ `MIN_NATIVE_BUILD_IOS`, so `dist/bundle-manifest.json` carries+ `minNativeBuilds.ios` = the new build number. Installed apps on older+ native builds stop applying OTA bundles and show the "update from the+ App Store" prompt instead (`NativeUpdateRequired` in+ `src/lib/tauri/TauriProvider.tsx`). The Android floor is independent:+ `just android-bump` raises it; see `docs/development/android.md`.+ - Once the web deploy succeeds, the **`iOS App Store Publish`** workflow+ (`.github/workflows/ios-app-store-publish.yml`) runs+ `ios-app-store.mjs publish`, which releases the version + build+ committed at the deployed commit if it is held for release. A held+ version whose PR is not in the deploy (approved, not merged yet) stays+ held, and an already-live one is left alone. A failed web deploy skips+ the publish, so the native build never goes live ahead of its bundle;+ a failed publish leaves the deploy alone. To retry, re-run the failed+ job in the `Deploy Production Release` run, or release the version in+ App Store Connect. A manual dispatch must run from the deployed release+ tag (**Use workflow from** → the tag) and refuses a branch: `main` may+ already commit another native PR's held version, whose bundle has not+ deployed.++ Because the App Store release starts after the web deploy, older+ installs can see the update prompt shortly before the App Store offers+ the update. They keep running their current bundle meanwhile.The bump is deliberately a local command rather than something the labelworkflow pushes: a `GITHUB_TOKEN` push never re-triggers required checks, so@@ -161,8 +184,8 @@ Two things:`crates/client` as native, the gate uses the version the team alreadybumps when a cache change must ship: a PR that moves it (compared withthe base branch on the merge ref) is a native PR, and the version is part- of the provenance hash, so a build is only "live" for the version it was- built with. The Android gate and release apply the same rule through+ of the provenance hash, so a build only satisfies the gate for the+ version it was built with. The Android gate and release apply the same rule through`scripts/android-native.mjs`.The hash recipe is defined once, in `scripts/ios_native_tree.sh` next to the@@ -193,7 +216,7 @@ code" is defined above. The checks:compares `main`'s native tree with the PR's branch point instead: if`main`'s native code hasn't moved, merging can only carry the PR's own,whatever files the conflicts are in, and the release goes ahead.-- **Live check** (the gate): the live build's stamp must equal the native+- **Approval check** (the gate): the approved build's stamp must equal the nativetree of the PR's **current merge result** (fetched through the API, so are-run of the job evaluates today's `main`, not the one the run startedwith).@@ -207,15 +230,17 @@ code" is defined above. The checks:result's hash, so that release has to be bumped and redone after merging`main`.- **One version in flight**: App Store Connect allows one iOS version in- review at a time, so the second PR's `submit` fails naming the version- that blocks it. Once that one ships (or is removed from review in App- Store Connect), remove and re-add `ios-update`; the uploaded build is- reused. A rejected or abandoned submission blocks everyone until someone- removes it from review.+ flight at a time, from review until release, so the second PR's `submit`+ fails naming the version that blocks it. An approved version stays in+ flight until the next prod deploy releases it. Once that one ships (or is+ removed in App Store Connect), remove and re-add `ios-update`; the+ uploaded build is reused. A rejected or abandoned submission blocks+ everyone until someone removes it from review.In practice: native PRs ship through Apple one at a time, each with its ownnumber, and the first to release wins its number; the others are told to-re-bump at the earliest check that can know.+re-bump at the earliest check that can know. The next native PR can submit+only after the prod deploy that releases the previous one.## Pushing to a PR after the label@@ -226,7 +251,7 @@ release only starts on a PR that is ready to merge. Pushes afterwards:stays green, and the reviewed build's embedded web bundle is replaced overthe air after the merge like every other OTA update.- **Native commits** make the uploaded build stale, and a stale build Apple- approves would go straight to the App Store. The+ approves would block the PR's next submission. The**`iOS Release Drift`** workflow (`.github/workflows/ios-release-drift.yml`)runs on every push to a labeled PR and, when `apps/web/tauri` changed,cancels any release run still building, withdraws the PR's submission from@@ -241,9 +266,13 @@ release only starts on a PR that is ready to merge. Pushes afterwards:(the marketing version stays, the build number moves), commit, push, andre-add the label; `submit` takes the withdrawn version record over, so noApp Store Connect visit is needed. If Apple had already approved the stale- build (with automatic release that means it is live or minutes away),- nothing can be withdrawn: the comment says so, and the follow-up release- should ship as soon as possible.+ build, nothing can be withdrawn. It is held for release, so it never goes+ live on its own (the prod deploy only releases the version + build+ committed on `main`), but it blocks the next submission: the comment asks+ you to remove it in App Store Connect (Developer Reject) before re-adding+ the label. A version created before releases were held may still release+ on approval; the comment then says it is going live, and the follow-up+ release should ship as soon as possible.## Credentials note@@ -252,7 +281,8 @@ result with the same App Manager key the release uses, on every same-repoPR with native changes (fork PRs get no secrets and fail the gate closed).A collaborator branch could therefore drive App Store Connect with thatkey. If that matters, give the gate a second, Developer-role key in Doppler-(reads suffice for `status`); the watcher's `withdraw` needs App Manager.+(reads suffice for `status`); the watcher's `withdraw` and the prod+deploy's `publish` need App Manager.## Manual / TestFlight-only releases@@ -266,7 +296,10 @@ it from the Nix dev shell like any other iOS build. See the header of`scripts/ios-release.sh` for the credentials it needs (`doppler run --projectios-release --config prd -- just ios-release` covers them), and`scripts/ios-app-store.mjs` for the underlying App Store Connect commands-(`wait-build`, `submit`, `status`).+(`wait-build`, `submit`, `status`, `publish`). `submit` holds the approved+version for release; `publish` releases only the committed version + build,+so a held version whose build number was moved by a hand release must be+released from App Store Connect.`just ios-build` and `just ios-release` export frontend traces and logs to theproduction OTLP proxydiff --git a/apps/web/scripts/ios-app-store.mjs b/apps/web/scripts/ios-app-store.mjsindex 5ff7eac1da..a87858e8ca 100644--- a/apps/web/scripts/ios-app-store.mjs+++ b/apps/web/scripts/ios-app-store.mjs@@ -11,17 +11,24 @@// is caught rather than papered over.//// submit Attach the processed build to an App Store version (created-// on demand with releaseType AFTER_APPROVAL), fill in empty-// "What's New" texts, and submit it for App Review. Safe to-// re-run: an already-submitted version is a no-op success.+// on demand with releaseType MANUAL, so Apple's approval holds+// it in Pending Developer Release), fill in empty "What's New"+// texts, and submit it for App Review. Safe to re-run: an+// already-submitted version is a no-op success.//-// status Report the App Store state of a version. With --require-live-// it exits non-zero unless exactly this version+build is live-// on the App Store, built from --native-tree (or this checkout's-// native code) — the gate the `iOS Native Check` job runs on-// PRs with native iOS changes. Writes a JSON gate_result to+// status Report the App Store state of a version. With+// --require-approved it exits non-zero unless Apple approved+// exactly this version+build (held for release, or already+// live), built from --native-tree (or this checkout's native+// code) — the gate the `iOS Native Check` job runs on PRs with+// native iOS changes. Writes a JSON gate_result to// GITHUB_OUTPUT only after evaluating the App Store response.//+// publish Release this version+build to the App Store if it is held+// for release (Pending Developer Release). The prod deploy runs+// it; any other state (already live, not approved, a different+// build attached) is reported and left alone.+//// Auth (same values as ios-release.sh):// APPLE_API_KEY App Store Connect API Key ID// APPLE_API_ISSUER Issuer ID@@ -40,7 +47,8 @@// Usage:// bun scripts/ios-app-store.mjs wait-build [--timeout-minutes 30]// bun scripts/ios-app-store.mjs submit [--whats-new "release notes"]-// bun scripts/ios-app-store.mjs status [--require-live] [--require-unused-build]+// bun scripts/ios-app-store.mjs status [--require-approved] [--require-unused-build]+// bun scripts/ios-app-store.mjs publish// bun scripts/ios-app-store.mjs release-info// bun scripts/ios-app-store.mjs withdraw --pr <number>// bun scripts/ios-app-store.mjs prepare-signing@@ -67,8 +75,8 @@// --require-unused-build, before the release builds) fails when a build at// or above ours exists with a different stamp — another PR or a hand release — and// reports `uploaded=true` (GITHUB_OUTPUT) when it is our own upload, so a-// release retry skips the build. The live check (--require-live) requires the-// live build's stamp to match this checkout's native tree — in the merge gate+// release retry skips the build. The approval check (--require-approved)+// requires the approved build's stamp to match this checkout's native tree — in the merge gate// that checkout is the PR's merge result, so native code that landed on main// after the release also fails it (the shipped build lacks it).@@ -102,8 +110,13 @@ const SUBMITTED_STATES = new Set([...LIVE_STATES,]);-// Past review: Apple approved the version and nothing can withdraw it any-// more — with release type "after approval" it is minutes from live.+// How `submit` creates versions: Apple's approval holds them in+// PENDING_DEVELOPER_RELEASE until `publish` (the prod deploy) releases them.+const RELEASE_TYPE = "MANUAL";+const HELD_STATE = "PENDING_DEVELOPER_RELEASE";++// Past review: Apple approved the version and its review submission can no+// longer be withdrawn. A held version only goes live once released.const APPROVED_STATES = new Set(["ACCEPTED","PENDING_APPLE_RELEASE",@@ -112,6 +125,18 @@ const APPROVED_STATES = new Set(["PROCESSING_FOR_APP_STORE",]);+// What the merge gate accepts: an approved version that reaches the App Store+// with nothing left but the prod deploy's `publish` (held) or nothing at all+// (releasing, live). Not ACCEPTED: another item of the submission was+// rejected, and the version cannot publish until that is resolved. Not+// PENDING_APPLE_RELEASE: Apple holds it until an unreleased iOS version ships.+const MERGEABLE_STATES = new Set([+ HELD_STATE,+ "PROCESSING_FOR_DISTRIBUTION",+ "PROCESSING_FOR_APP_STORE",+ ...LIVE_STATES,+]);+// Versions that shipped and were superseded or pulled — never in flight.const RETIRED_STATES = new Set(["REPLACED_WITH_NEW_VERSION",@@ -128,7 +153,7 @@ const WITHDRAWABLE_SUBMISSION_STATES = new Set(["UNRESOLVED_ISSUES",]);-const BOOLEAN_FLAGS = new Set(["require-live", "require-unused-build"]);+const BOOLEAN_FLAGS = new Set(["require-approved", "require-unused-build"]);/// "The native code": every tracked blob under this directory except what/// never reaches the iOS binary — anything Android-only or desktop-only by@@ -174,9 +199,9 @@ function parseArgs(argv) {}const [command, ...rest] = process.argv.slice(2);-if (!["wait-build", "submit", "status", "release-info", "withdraw", "prepare-signing"].includes(command ?? "")) {+if (!["wait-build", "submit", "status", "publish", "release-info", "withdraw", "prepare-signing"].includes(command ?? "")) {console.error(- "Usage: ios-app-store.mjs <wait-build|submit|status|release-info|withdraw|prepare-signing> [flags]",+ "Usage: ios-app-store.mjs <wait-build|submit|status|publish|release-info|withdraw|prepare-signing> [flags]",);exit(2);}@@ -632,8 +657,9 @@ async function inFlightVersionForPr(pr) {/// `withdraw --pr N`: remove PR N's in-flight submission from review (native/// code changed after the release, so that build must never go live)./// GITHUB_OUTPUT gets withdrawn=true|false and, if the PR's version is past-/// the point of withdrawal — approved by Apple or already shipped —-/// live=<version> (<build>) so the caller can warn loudly. With+/// the point of withdrawal, held=<version> (<build>) when Apple approved it+/// and it awaits release, or live=<version> (<build>) when it is shipping or+/// shipped, so the caller can say what to do. With/// --unless-tree <hash> (the watcher's drift check) a build whose stamp still/// matches the PR's native code is left alone in every state, in-flight or/// live: nothing drifted, so nothing to withdraw or warn about.@@ -661,7 +687,16 @@ async function withdraw() {const withdrawn = await cancelOpenSubmission();setGitHubOutput("withdrawn", withdrawn ? "true" : "false");if (!withdrawn) {- if (APPROVED_STATES.has(state)) {+ if (state === HELD_STATE) {+ const held = `${mine.record.attributes.versionString} (${mine.buildNumber})`;+ console.error(+ `PR #${pr}'s version ${held} is ${state}: Apple has approved it, so the ` ++ "submission can no longer be withdrawn, but it stays off the App Store until " ++ "released. It blocks the next submission until it is removed in App Store " ++ `Connect (Developer Reject).\n${distributionUrl}`,+ );+ setGitHubOutput("held", held);+ } else if (APPROVED_STATES.has(state)) {const live = `${mine.record.attributes.versionString} (${mine.buildNumber})`;console.error(`PR #${pr}'s version ${live} is ${state}: Apple has approved it and the ` +@@ -785,9 +820,10 @@ the ios-update label to pick it up.\n${distributionUrl}`);}console.error(`Could not create App Store version ${version}: App Store Connect allows one iOSversion in flight at a time, and these are: ${inFlight.join(", ")}.-Wait for it to ship (another native PR's release) or remove it from review in App-Store Connect, then remove and re-add the ios-update label — the uploaded build-${build} is reused, only the submission is retried.+Wait for it to ship (another native PR's release; an approved one ships with the+next prod deploy) or remove it in App Store Connect (remove from review, or+Developer Reject once approved), then remove and re-add the ios-update label —+the uploaded build ${build} is reused, only the submission is retried.${distributionUrl}`);}@@ -824,12 +860,21 @@ async function submit() {`${attachedNumber}; withdrawing it to resubmit with build ${build}.`,);if (!(await cancelOpenSubmission())) {- console.error(- `App Store version ${version} (build ${attachedNumber}) is ${state}: past the point ` +- "where a submission can be withdrawn, so that build will ship. Bump " +- "(`just ios-bump`), commit, and re-add the ios-update label to release " +- `build ${build} as the follow-up.\n${distributionUrl}`,- );+ if (state === HELD_STATE) {+ console.error(+ `App Store version ${version} (build ${attachedNumber}) is ${state}: Apple ` ++ "approved this PR's stale build, so the submission can no longer be withdrawn. " ++ "Remove it in App Store Connect (Developer Reject), then remove and re-add the " ++ `ios-update label — the uploaded build ${build} is reused.\n${distributionUrl}`,+ );+ } else {+ console.error(+ `App Store version ${version} (build ${attachedNumber}) is ${state}: past the point ` ++ "where a submission can be withdrawn, so that build will ship. Bump " ++ "(`just ios-bump`), commit, and re-add the ios-update label to release " ++ `build ${build} as the follow-up.\n${distributionUrl}`,+ );+ }exit(1);}} else if (LIVE_STATES.has(state)) {@@ -846,9 +891,10 @@ async function submit() {`not this PR's build ${build}` +(stamp?.pr ? ` (uploaded for PR #${stamp.pr})` : " (uploaded outside the release flow)") +". App Store Connect allows one version in flight at a time: wait for it to " +- "ship (then `just ios-bump` moves the version) or remove it from review in App " +- `Store Connect, then remove and re-add the ios-update label — the uploaded build ${build} ` +- `is reused.\n${distributionUrl}`,+ "ship (an approved one ships with the next prod deploy; then `just ios-bump` moves " ++ "the version) or remove it in App Store Connect (remove from review, or Developer " ++ "Reject once approved), then remove and re-add the ios-update label — the uploaded " ++ `build ${build} is reused.\n${distributionUrl}`,);exit(1);}@@ -892,9 +938,9 @@ async function submit() {attributes: {platform: "IOS",versionString: version,- // Release to the App Store as soon as Apple approves — the- // merge gate (`status --require-live`) waits for exactly that.- releaseType: "AFTER_APPROVAL",+ // Hold the approved version until the prod deploy that ships+ // its web bundle runs `publish`.+ releaseType: RELEASE_TYPE,},relationships: {app: { data: { type: "apps", id: app.id } },@@ -908,6 +954,22 @@ async function submit() {console.log(`Reusing App Store version ${version} (state ${versionState(versionRecord)}).`,);+ // Records created before releases were held still release on approval.+ if (versionRecord.attributes.releaseType !== RELEASE_TYPE) {+ versionRecord = (+ await api(`/v1/appStoreVersions/${versionRecord.id}`, {+ method: "PATCH",+ body: {+ data: {+ type: "appStoreVersions",+ id: versionRecord.id,+ attributes: { releaseType: RELEASE_TYPE },+ },+ },+ })+ ).data;+ console.log(`Set App Store version ${version} to release manually.`);+ }}await api(`/v1/appStoreVersions/${versionRecord.id}/relationships/build`, {@@ -1042,10 +1104,10 @@ async function submit() {}async function status() {- const requireLive = args["require-live"] === true;- // The collision check is a pre-build check: once our version is live it is- // the latest release, and later TestFlight uploads (another PR's) are- // irrelevant — the live version + build + stamp below is the proof.+ const requireApproved = args["require-approved"] === true;+ // The collision check is a pre-build check: once our version is approved+ // it is the next release, and later TestFlight uploads (another PR's) are+ // irrelevant — the approved version + build + stamp below is the proof.if (args["require-unused-build"] === true) {await requireUnusedBuild();}@@ -1061,15 +1123,15 @@ async function status() {report(kind, reason, state);console.error(`${reason}-This PR changes native iOS code, so iOS ${version} (build ${build}) must be-live on the App Store before merging (after the merge, the next prod deploy-applies the iOS native build floor committed in min-native-build.json and-prompts older installs to update):+This PR changes native iOS code, so Apple must approve iOS ${version} (build ${build})+before merging (after the merge, the next prod deploy releases it on the App Store+and applies the iOS native build floor committed in min-native-build.json,+prompting older installs to update):- Not started yet? Add the \`ios-update\` label to the PR to build, upload,and submit it for review.- - Submitted? Wait for Apple to approve and release it. The \`iOS Release- Watch\` workflow re-runs this check within half an hour of the release- (or re-run it yourself).+ - Submitted? Wait for Apple to approve it. The \`iOS Release Watch\`+ workflow re-runs this check within half an hour of the approval (or+ re-run it yourself).- If these tauri changes don't break the native/web contract, add the\`skip-ios-update\` label instead.${distributionUrl}`);@@ -1078,7 +1140,7 @@ ${distributionUrl}`);if (!versionRecord) {console.log(`No App Store version ${version} exists for ${bundleId}.`);- if (requireLive) {+ if (requireApproved) {fail(`App Store version ${version} has not been created.`);}return;@@ -1091,7 +1153,7 @@ ${distributionUrl}`);`App Store version ${version}: state ${state}, ` +`build ${attachedBuildNumber ?? "not attached"}.`,);- if (!requireLive) {+ if (!requireApproved) {return;}@@ -1103,17 +1165,25 @@ ${distributionUrl}`);"mismatch", state,);}- if (!LIVE_STATES.has(state)) {+ if (!MERGEABLE_STATES.has(state)) {fail(- `App Store version ${version} is not live yet (state ${state}).`,+ `App Store version ${version} is not held for release or live yet (state ${state}).`,SUBMITTED_STATES.has(state) ? "waiting" : "release-required",state,);}+ // A held stale build blocks the follow-up submission until it is removed.+ const heldNote = state === HELD_STATE+ ? "First remove the approved version in App Store Connect (Developer Reject): it is " ++ "held for release and App Store Connect allows one version in flight."+ : null;+ const withHeldNote = (reason) => [reason, heldNote].filter(Boolean).join(" ");if (attachedBuildNumber !== build) {fail(- `App Store version ${version} is live but was built from build ` +- `${attachedBuildNumber ?? "unknown"}, not this PR's build ${build}.`,+ withHeldNote(+ `App Store version ${version} was approved with build ` ++ `${attachedBuildNumber ?? "unknown"}, not this PR's build ${build}.`,+ ),"mismatch", state,);}@@ -1121,33 +1191,81 @@ ${distributionUrl}`);const ours = nativeTreeHash();if (!ours) {console.error(- "Could not compute this checkout's native tree; the live build could not be verified. " ++ "Could not compute this checkout's native tree; the approved build could not be verified. " +"Check the Git checkout and rerun the check.",);exit(1);}if (stamp !== ours) {- report("mismatch", "The live build does not match this PR's current merge result.", state);- console.error(`App Store version ${version} (${build}) is live, but that build was not built from+ report("mismatch", withHeldNote("The approved build does not match this PR's current merge result."), state);+ console.error(`App Store version ${version} (${build}) is approved (${state}), but that build was not built fromthe native code this merge would produce: its stamp is ${stamp ?? "missing (uploaded outside the release flow)"},the merge result's native tree (${NATIVE_TREE_PATH}) is ${ours}.Either native commits were pushed to this PR after the release, native code landed-on main since the release (so the merge would contain code the shipped build lacks),+on main since the release (so the merge would contain code the approved build lacks),or another PR / a hand release shipped the same version + build number. Merging mainalone cannot fix it: bump again, commit, and re-add the ios-update label so what willactually be merged gets released:cd apps/web && doppler run --project ios-release --config prd -- just ios-bump-${distributionUrl}`);+${heldNote ? `${heldNote}\n` : ""}${distributionUrl}`);exit(1);}- report("live", "The exact version, build, and native code are live and verified.", state);- console.log(`App Store version ${version} (${build}) is live, built from this native tree.`);+ report("approved", "Apple approved the exact version, build, and native code.", state);+ console.log(`App Store version ${version} (${build}) is approved (${state}), built from this native tree.`);+}++/// `publish`: release this version + build (by default the committed one) to+/// the App Store if Apple approved it and it is held for release. The prod+/// deploy runs this without waiting on it. Nothing else is released: a held+/// version with another build belongs to a PR that this commit doesn't+/// contain.+async function publish() {+ const versionRecord = await findAppStoreVersion();+ if (!versionRecord) {+ console.log(`No App Store version ${version} exists; nothing to release.`);+ return;+ }+ const state = versionState(versionRecord);+ const attached = await api(`/v1/appStoreVersions/${versionRecord.id}/build`);+ const attachedNumber = attached.data?.attributes.version ?? null;+ if (state !== HELD_STATE) {+ console.log(+ `App Store version ${version} (build ${attachedNumber ?? "none"}) is ${state}; ` ++ "nothing to release.",+ );+ return;+ }+ if (attachedNumber !== build) {+ console.log(+ `App Store version ${version} is held for release with build ${attachedNumber ?? "none"}, ` ++ `not build ${build}; leaving it alone.\n${distributionUrl}`,+ );+ return;+ }+ await api("/v1/appStoreVersionReleaseRequests", {+ method: "POST",+ body: {+ data: {+ type: "appStoreVersionReleaseRequests",+ relationships: {+ appStoreVersion: { data: { type: "appStoreVersions", id: versionRecord.id } },+ },+ },+ },+ });+ const released = await findAppStoreVersion();+ console.log(+ `Released App Store version ${version} (${build}); it is now ` ++ `${versionState(released)}.\n${distributionUrl}`,+ );}if (command === "wait-build") {await waitBuild();} else if (command === "submit") {await submit();+} else if (command === "publish") {+ await publish();} else if (command === "release-info") {await releaseInfo();} else if (command === "withdraw") {diff --git a/apps/web/scripts/ios-app-store.test.mjs b/apps/web/scripts/ios-app-store.test.mjsindex 3ca07bc8ba..1db935fc81 100644--- a/apps/web/scripts/ios-app-store.test.mjs+++ b/apps/web/scripts/ios-app-store.test.mjs@@ -13,75 +13,124 @@ const { privateKey } = generateKeyPairSync('ec', { namedCurve: 'prime256v1' });// Preload replaces fetch before the actual CLI runs; no Apple request or real// credential is used. Unknown endpoints fail immediately instead of networking.+// A release request moves the version on, as App Store Connect does.const preload = `-globalThis.fetch = async (url) => {+let released = false;+globalThis.fetch = async (url, init) => {const path = new URL(url).pathname;const state = process.env.TEST_STATE;if (state === 'API_ERROR') return new Response('fixture error', { status: 403 });let data;if (path === '/v1/apps') data = [{ id: 'app' }];else if (path === '/v1/apps/app/appStoreVersions') data = state === 'MISSING' ? []- : [{ id: 'version', attributes: { appVersionState: state } }];+ : [{ id: 'version', attributes: {+ appVersionState: released ? 'PROCESSING_FOR_DISTRIBUTION' : state,+ } }];else if (path === '/v1/appStoreVersions/version/build') data = {id: 'build', attributes: { version: process.env.TEST_BUILD ?? '188' },};else if (path === '/v1/builds/build/betaBuildLocalizations') data = [{ attributes: {whatsNew: 'native tree ' + process.env.TEST_TREE + ' for PR #123',} }];+ else if (path === '/v1/appStoreVersionReleaseRequests' && init?.method === 'POST') {+ released = true;+ data = { id: 'release' };+ }else throw new Error('Unexpected endpoint: ' + url);return Response.json({ data });};`;+function runCli(args, env, { missingGit = false } = {}) {+ const dir = mkdtempSync(path.join(tmpdir(), 'ios-app-store-'));+ try {+ const fixture = path.join(dir, 'fetch.mjs');+ const output = path.join(dir, 'outputs');+ writeFileSync(fixture, preload);+ writeFileSync(output, '');+ const child = spawnSync(process.execPath, [+ '--import', pathToFileURL(fixture).href, script, ...args,+ ], {+ env: {+ ...process.env, GITHUB_OUTPUT: output,+ APPLE_API_KEY: 'fixture', APPLE_API_ISSUER: 'fixture',+ APPLE_API_KEY_P8: privateKey.export({ type: 'pkcs8', format: 'pem' }),+ ...env,+ ...(missingGit ? { GIT_DIR: path.join(dir, 'missing.git') } : {}),+ }, encoding: 'utf8', timeout: 10000,+ });+ return { child, outputs: readFileSync(output, 'utf8') };+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+}+for (const [state, expected, attachedBuild, stamp, nativeTree = tree] of [['MISSING', 'release-required', '188', tree],['IN_REVIEW', 'waiting', '188', tree],- ['PENDING_DEVELOPER_RELEASE', 'waiting', '188', tree],+ ['ACCEPTED', 'waiting', '188', tree],+ ['PENDING_APPLE_RELEASE', 'waiting', '188', tree],+ ['PENDING_DEVELOPER_RELEASE', 'approved', '188', tree],+ ['PROCESSING_FOR_DISTRIBUTION', 'approved', '188', tree],+ ['PENDING_DEVELOPER_RELEASE', 'mismatch', '187', tree],+ ['PENDING_DEVELOPER_RELEASE', 'mismatch', '188', 'b'.repeat(40)],['REJECTED', 'release-required', '188', tree],['REPLACED_WITH_NEW_VERSION', 'mismatch', '188', tree],- ['READY_FOR_DISTRIBUTION', 'live', '188', tree],+ ['READY_FOR_DISTRIBUTION', 'approved', '188', tree],['READY_FOR_DISTRIBUTION', 'mismatch', '187', tree],['READY_FOR_DISTRIBUTION', 'mismatch', '188', 'b'.repeat(40)],['READY_FOR_DISTRIBUTION', null, '188', tree, null],['API_ERROR', null, '188', tree],]) {await test(`status reports ${expected} for ${state}, build ${attachedBuild}, tree ${stamp[0]}`, () => {- const dir = mkdtempSync(path.join(tmpdir(), 'ios-gate-status-'));- try {- const fixture = path.join(dir, 'fetch.mjs');- const output = path.join(dir, 'outputs');- writeFileSync(fixture, preload);- writeFileSync(output, '');- const child = spawnSync(process.execPath, [- '--import', pathToFileURL(fixture).href, script, 'status', '--require-live',- '--version', '2.0.10', '--build', '188',- ...(nativeTree ? ['--native-tree', nativeTree] : []),- ], {- env: {- ...process.env, GITHUB_OUTPUT: output,- APPLE_API_KEY: 'fixture', APPLE_API_ISSUER: 'fixture',- APPLE_API_KEY_P8: privateKey.export({ type: 'pkcs8', format: 'pem' }),- TEST_STATE: state, TEST_BUILD: attachedBuild, TEST_TREE: stamp,- ...(!nativeTree ? { GIT_DIR: path.join(dir, 'missing.git') } : {}),- }, encoding: 'utf8', timeout: 10000,- });- assert.equal(child.status, expected === 'live' ? 0 : 1, child.stderr);- const text = readFileSync(output, 'utf8');- if (!expected) {- assert.equal(text, '', 'failed verification must not emit an App Store conclusion');- if (!nativeTree) {- assert.match(child.stderr, /Could not compute.*native tree/);- assert.doesNotMatch(child.stderr, /bump|ios-update|release again/i);- }- } else {- const result = JSON.parse(text.trim().slice('gate_result='.length));- assert.equal(result.kind, expected);- assert.equal(result.version, '2.0.10');- assert.equal(result.build, '188');- assert.equal(result.floor, JSON.parse(readFileSync(new URL('../min-native-build.json', import.meta.url))).ios);+ const { child, outputs } = runCli([+ 'status', '--require-approved', '--version', '2.0.10', '--build', '188',+ ...(nativeTree ? ['--native-tree', nativeTree] : []),+ ], {+ TEST_STATE: state, TEST_BUILD: attachedBuild, TEST_TREE: stamp,+ }, { missingGit: !nativeTree });+ assert.equal(child.status, expected === 'approved' ? 0 : 1, child.stderr);+ if (!expected) {+ assert.equal(outputs, '', 'failed verification must not emit an App Store conclusion');+ if (!nativeTree) {+ assert.match(child.stderr, /Could not compute.*native tree/);+ assert.doesNotMatch(child.stderr, /bump|ios-update|release again/i);}- } finally {- rmSync(dir, { recursive: true, force: true });+ } else {+ const result = JSON.parse(outputs.trim().slice('gate_result='.length));+ assert.equal(result.kind, expected);+ assert.equal(result.state, state === 'MISSING' ? null : state);+ assert.equal(result.version, '2.0.10');+ assert.equal(result.build, '188');+ assert.equal(result.floor, JSON.parse(readFileSync(new URL('../min-native-build.json', import.meta.url))).ios);}});}++for (const [state, attachedBuild, releases] of [+ ['PENDING_DEVELOPER_RELEASE', '188', true],+ ['PENDING_DEVELOPER_RELEASE', '187', false],+ ['IN_REVIEW', '188', false],+ ['ACCEPTED', '188', false],+ ['READY_FOR_DISTRIBUTION', '188', false],+ ['MISSING', '188', false],+]) {+ await test(`publish ${releases ? 'releases' : 'leaves'} ${state} with build ${attachedBuild}`, () => {+ const { child } = runCli(['publish', '--version', '2.0.10', '--build', '188'], {+ TEST_STATE: state, TEST_BUILD: attachedBuild, TEST_TREE: tree,+ });+ assert.equal(child.status, 0, child.stderr);+ if (releases) {+ assert.match(child.stdout, /Released App Store version 2\.0\.10 \(188\); it is now PROCESSING_FOR_DISTRIBUTION/);+ } else {+ assert.doesNotMatch(child.stdout, /Released/);+ }+ });+}++await test('publish fails when App Store Connect does', () => {+ const { child } = runCli(['publish', '--version', '2.0.10', '--build', '188'], {+ TEST_STATE: 'API_ERROR',+ });+ assert.equal(child.status, 1);+});diff --git a/docs/architecture/email.md b/docs/architecture/email.mdindex e4c70f74a1..25c1909868 100644--- a/docs/architecture/email.md+++ b/docs/architecture/email.md@@ -604,8 +604,8 @@ draft.Deploy schema/migrations and all generation-aware backend writers beforereleasing this frontend, including before applying `ios-update`: that workflow-embeds the PR's frontend with production endpoints and releases automatically-after Apple approval. See the [iOS release flow](../../apps/web/docs/ios-releases.md).+embeds the PR's frontend with production endpoints, and once Apple approves it+the next prod deploy releases it. See the [iOS release flow](../../apps/web/docs/ios-releases.md).The outbox is unconditional; there is no feature flag orlegacy send fallback. Old deployed writers do not enforce the new generationprecondition. Verify cache failure, offline/reload, lost HTTP response, concurrentdiff --git a/docs/development/android.md b/docs/development/android.mdindex 35c32ce8d7..66c32d9d66 100644--- a/docs/development/android.md+++ b/docs/development/android.md@@ -131,8 +131,9 @@ its fingerprint to production associations before testing Play-installed links.### Releasing to Google Play from a pull requestAndroid releases are driven from pull requests, like iOS (see-`apps/web/docs/ios-releases.md`); they are not tied to the production-deployment cycle. Three generated workflows plus the `Android Native Check`+`apps/web/docs/ios-releases.md`). Unlike iOS, whose approved version is held+until the prod deploy, they are not tied to the production deployment cycle.+Three generated workflows plus the `Android Native Check`job of the web app PR checks enforce it:**`Android Native Check`** runs on every PR against `main`. Its native treediff --git a/docs/development/infrastructure.md b/docs/development/infrastructure.mdindex ee45ec7b16..87e8e7a96f 100644--- a/docs/development/infrastructure.md+++ b/docs/development/infrastructure.md@@ -161,7 +161,7 @@ local resources.| Trigger | What runs || --- | --- || Push to `main` | `deploy_on_push.yml`: builds nix binaries and Lambdas, runs migrations on the in-VPC runner, then `pulumi up` on dev for every service in `.github/services-config.json` |-| Published GitHub release | `release-production.yml`: the same flow against prod, then workers, website, and web app |+| Published GitHub release | `release-production.yml`: the same flow against prod, then workers, website, and web app; once the web app is deployed, `ios-app-store-publish.yml` releases the held iOS App Store version || Pull request touching a mapped stack | `pulumi_preview_pr.yml` previews against dev and comments; `code_check_infra.yml` runs Biome and `tsc` || Manual | `deploy-pulumi-stack.yml`, `deploy-service-generic.yml`, `migrate-macro-db.yml` |diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows.rs b/tooling/xtask/crates/xtask_workflows/src/workflows.rsindex b16d0598d9..20df6be8c0 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows.rs@@ -43,6 +43,7 @@ mod deploy_web_app;mod deploy_website;mod ensure_daytona_snapshot;mod export_ci_telemetry;+mod ios_app_store_publish;mod ios_app_store_release;mod ios_preview;mod ios_release_drift;@@ -324,6 +325,11 @@ const WORKFLOWS: &[WorkflowFile] = &[file_name: "ios-app-store-release.yml",render_yaml: || render_gh_workflow(ios_app_store_release::ios_app_store_release)(),},+ WorkflowFile {+ slug: "ios_app_store_publish",+ file_name: "ios-app-store-publish.yml",+ render_yaml: || render_gh_workflow(ios_app_store_publish::ios_app_store_publish)(),+ },WorkflowFile {slug: "native_check_label",file_name: "native-check-label.yml",diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/export_ci_telemetry.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/export_ci_telemetry.rsindex 729b87ecc0..253d4073ae 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/export_ci_telemetry.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/export_ci_telemetry.rs@@ -50,6 +50,7 @@ const OBSERVED_WORKFLOWS: &[&str] = &["cloud storage code check","conventions code check","deploy pulumi service",+ "iOS App Store Publish","iOS Preview","infra code check",];diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/ios_app_store_publish.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/ios_app_store_publish.rsnew file mode 100644index 0000000000..eb716ac06f--- /dev/null+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/ios_app_store_publish.rs@@ -0,0 +1,90 @@+//! `iOS App Store Publish` — releases the committed iOS version on the App+//! Store. [`super::ios_app_store_release`] submits versions with release type+//! "manual", so Apple's approval holds them in Pending Developer Release+//! until this runs. `release-production` calls it once the web deploy that+//! ships the matching bundle has succeeded, without making the deploy wait+//! on it.+//!+//! `ios-app-store.mjs publish` releases only the version + build committed at+//! the deployed commit, and only from that held state: a version approved+//! for a PR that has not merged yet stays held, and an already-live version+//! is left alone. To retry a failed release, re-run the failed job in the+//! `Deploy Production Release` run, which keeps its release tag. A manual+//! dispatch must also run from that tag: from a branch (`main` by default)+//! the committed version may be another native PR's, held for a deploy that+//! hasn't happened, so the run refuses a branch.++use std::collections::HashMap;++use gh_workflow::{+ Event, Job, Level, Permissions, Run, Step, Use, Workflow, WorkflowCall, WorkflowCallSecret,+ WorkflowDispatch,+};++use crate::workflows::{runners, steps, vars};++/// Build the workflow.+pub fn ios_app_store_publish() -> Workflow {+ Workflow::new("iOS App Store Publish")+ .on(Event::default()+ .workflow_call(WorkflowCall::default().secrets(HashMap::from([(+ "IOS_RELEASE_DOPPLER_TOKEN".to_string(),+ WorkflowCallSecret {+ description: "Doppler service token for ios-release/prd".into(),+ required: true,+ },+ )])))+ .workflow_dispatch(WorkflowDispatch::default()))+ .add_job("publish", publish_job())+}++fn publish_job() -> Job {+ Job::default()+ .name("Release the approved iOS version on the App Store")+ .runs_on(runners::Runner::TinyNoCache.to_string())+ .timeout_minutes(10u32)+ .permissions(Permissions::default().contents(Level::Read))+ .add_step(require_release_tag())+ .add_step(steps::checkout(false, false))+ .add_step(setup_bun())+ .add_step(fetch_credentials())+ .add_step(publish())+}++/// A called run inherits the prod deploy's release tag; a dispatched one runs+/// at whatever ref was picked (see the module docs).+fn require_release_tag() -> Step<Run> {+ Step::new("Require a release tag")+ .run(indoc::indoc! {r#"+ if [[ "$GITHUB_REF_TYPE" != "tag" ]]; then+ echo "Run this from the deployed release tag (\"Use workflow from\": the tag), not ${GITHUB_REF_NAME}:" \+ "a branch can commit another PR's held version whose web bundle has not deployed." \+ "To retry a failed publish, re-run the failed job in the Deploy Production Release run." >&2+ exit 1+ fi+ "#})+ .shell("bash")+}++fn setup_bun() -> Step<Use> {+ Step::new("Setup Bun")+ .uses(+ "oven-sh",+ "setup-bun",+ "0c5077e51419868618aeaa5fe8019c62421857d6",+ ) // v2.2.0+ .add_with(("bun-version", "1.3.13"))+}++fn fetch_credentials() -> Step<Run> {+ Step::new("Fetch App Store Connect credentials from Doppler")+ .run(include_str!("scripts/ios_app_store_connect_credentials.sh"))+ .shell("bash")+ .add_env(("DOPPLER_TOKEN", vars::IOS_RELEASE_DOPPLER_TOKEN))+}++fn publish() -> Step<Run> {+ Step::new("Release the committed version if Apple approved it")+ .run("bun scripts/ios-app-store.mjs publish")+ .working_directory(xtask_paths::repo_dir!("apps/web"))+}diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/ios_app_store_release.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/ios_app_store_release.rsindex 6de8523641..239f484ad8 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/ios_app_store_release.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/ios_app_store_release.rs@@ -2,7 +2,8 @@//! native (Tauri) changes and this workflow builds the iOS app from the PR//! head, uploads it to TestFlight, and submits it for App Review — the release//! the `iOS Native Check` merge gate (a job of [`super::web_app_check_main`]) then waits on-//! ([`super::ios_release_watch`] re-runs the gate once Apple releases it).+//! ([`super::ios_release_watch`] re-runs the gate once Apple approves it).+//! The approved version is held until the next prod deploy releases it.//! The success comment tells the author to enable GitHub auto-merge on the//! PR if they want it merged the moment Apple approves. The workflow does not//! enable it itself: that would need a user token (a merge set up by the@@ -262,11 +263,12 @@ fn pr_comment() -> Step<Use> {const SUCCESS_BODY = [`📱 iOS ${version} (build ${build}) was uploaded to TestFlight and submitted for App Review.`,'',- 'When Apple approves it, the version releases to the App Store automatically,',- 'the **iOS Release Watch** workflow re-runs the **iOS Native Check** on this PR',- 'within half an hour of that, and the PR becomes mergeable. To merge it the',- 'moment that happens, click **Enable auto-merge** on this PR now (squash).',- 'After merge, the next prod deploy applies the iOS native build floor committed in `min-native-build.json`, prompting older installs to update.',+ 'When Apple approves it, the **iOS Release Watch** workflow re-runs the',+ '**iOS Native Check** on this PR within half an hour, and the PR becomes',+ 'mergeable. To merge it the moment that happens, click **Enable auto-merge**',+ 'on this PR now (squash). Apple holds the approved version until the next',+ 'prod deploy releases it on the App Store and applies the iOS native build floor',+ 'committed in `min-native-build.json`, prompting older installs to update.','',`[Workflow run](${runUrl})`,].join('\n');diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/ios_release_drift.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/ios_release_drift.rsindex 1eea060df4..de9f154e52 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/ios_release_drift.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/ios_release_drift.rs@@ -2,9 +2,9 @@//! `ios-update` label, i.e. a PR whose iOS build is (or is about to be) in//! App Review. Web-only pushes are fine: the embedded web bundle is replaced//! over the air after the merge. Native pushes make the uploaded build-//! stale, and with release type "after approval" a stale build Apple approves-//! goes straight to the App Store — so when `apps/web/tauri` changed this-//! workflow:+//! stale, and a stale build Apple approves blocks the PR's next submission+//! (App Store Connect allows one version in flight) — so when+//! `apps/web/tauri` changed this workflow://!//! 1. cancels any [`super::ios_app_store_release`] run still building the//! old head and waits for it to stop,@@ -17,8 +17,10 @@//! keeps the marketing version and `submit` takes the withdrawn version//! record over.//!-//! If Apple had already approved or released the stale build there is-//! nothing to withdraw; the comment then says so loudly.+//! If Apple had already approved the stale build there is nothing to+//! withdraw. Held for release, it stays off the App Store but must be removed+//! in App Store Connect before the next submission; already releasing, it+//! needs a follow-up release. The comment says which.use gh_workflow::{Event, Expression, Job, Level, Permissions, PullRequest, PullRequestType, Run, Step, Use,@@ -162,6 +164,8 @@ fn comment() -> Step<Run> {bump='cd apps/web && doppler run --project ios-release --config prd -- just ios-bump'if [[ "$WITHDRAW_OUTCOME" != "success" ]]; thenbody="🚨 Native changes were pushed to this PR after its App Store release started, but withdrawing the App Review submission **failed** (see the [workflow run](${RUN_URL})). If a submission is pending, remove it from review in App Store Connect by hand so the stale build cannot go live. The \`ios-update\` label was removed; when the PR is ready again, bump (\`${bump}\`), commit, push, and re-add \`ios-update\`."+ elif [[ -n "$HELD" ]]; then+ body="📱 Native changes were pushed to this PR after Apple had already approved iOS ${HELD}. That build is held for release, so it will not go live on its own, but it blocks the next submission: remove it in App Store Connect (Developer Reject). Then bump (\`${bump}\`), commit, push, and re-add \`ios-update\`. The label was removed."elif [[ -n "$LIVE" ]]; thenbody="🚨 Native changes were pushed to this PR after Apple had already approved iOS ${LIVE}, so that build is (or is about to be) live with native code this PR no longer matches. Bump (\`${bump}\`), commit, re-add the \`ios-update\` label, and ship the follow-up as soon as possible. The label was removed."else@@ -171,6 +175,7 @@ fn comment() -> Step<Run> {"#}).if_condition(after_withdraw()).shell("bash")+ .add_env(("HELD", "${{ steps.withdraw.outputs.held }}")).add_env(("LIVE", "${{ steps.withdraw.outputs.live }}")).add_env(("WITHDRAW_OUTCOME", "${{ steps.withdraw.outcome }}")).add_env((diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/ios_release_watch.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/ios_release_watch.rsindex 4f91b5d311..9b5e1625f5 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/ios_release_watch.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/ios_release_watch.rs@@ -1,12 +1,12 @@//! `iOS Release Watch` — half-hourly cron closing the loop of the `iOS//! Native Check` gate (a job of [`super::web_app_check_main`]): that check-//! fails on a PR with breaking native changes until the matching iOS version-//! is live on the App Store, and nothing on GitHub's side notices when Apple-//! releases it. This workflow looks at every open PR labeled `ios-update`-//! (the label that started the [`super::ios_app_store_release`] run), asks-//! App Store Connect whether the version + build committed at the PR head is-//! live (built from the native tree of the PR's merge result, like the gate-//! checks), and when it is, re-runs the PR's failed `iOS Native Check` job so+//! fails on a PR with breaking native changes until Apple approves the+//! matching iOS version, and nothing on GitHub's side notices when Apple+//! does. This workflow looks at every open PR labeled `ios-update` (the label+//! that started the [`super::ios_app_store_release`] run), asks App Store+//! Connect whether Apple approved the version + build committed at the PR+//! head (built from the native tree of the PR's merge result, like the gate+//! checks), and when it did, re-runs the PR's failed `iOS Native Check` job so//! the gate turns green on its own. Re-running an existing job is how this//! stays within GitHub's rule that events created with the workflow token//! never start workflows.@@ -46,7 +46,7 @@ pub fn ios_release_watch() -> Workflow {fn watch_job() -> Job {Job::default()- .name("Re-run the iOS Native Check once the App Store release is live")+ .name("Re-run the iOS Native Check once Apple approves the App Store release").runs_on(runners::Runner::TinyNoCache.to_string()).timeout_minutes(15u32).add_env(("GH_TOKEN", "${{ github.token }}"))@@ -55,7 +55,7 @@ fn watch_job() -> Job {.add_step(steps::checkout(false, false).if_condition(gated())).add_step(setup_bun()).add_step(fetch_credentials())- .add_step(rerun_live_checks())+ .add_step(rerun_approved_checks())}fn gated() -> Expression {@@ -97,8 +97,8 @@ fn fetch_credentials() -> Step<Run> {.add_env(("DOPPLER_TOKEN", vars::IOS_RELEASE_DOPPLER_TOKEN))}-fn rerun_live_checks() -> Step<Run> {- Step::new("Re-run the check on PRs whose release is live")+fn rerun_approved_checks() -> Step<Run> {+ Step::new("Re-run the check on PRs whose release Apple approved").run(concat!(include_str!("scripts/ios_native_tree.sh"),include_str!("scripts/ios_release_watch.sh")diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_check_comment.js b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_check_comment.jsindex f20b18d804..c45bd07ab7 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_check_comment.js+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_check_comment.js@@ -39,7 +39,7 @@ if (failed.length && !release) {lines.push('### iOS release check could not complete', '',`Failed step: **${failed.map(([id]) => names[id] ?? id).join(', ')}**.`, '',`See the [workflow logs](${runUrl}) for the error, fix it, then rerun the check.`,- 'This failure does not establish whether the App Store release is live.');+ 'This failure does not establish whether Apple approved the App Store release.');} else if (!native && detectionComplete) {lines.push('### iOS release not required', '', 'This PR no longer changes native iOS code.');} else if (steps.labels?.outputs?.skip === 'true') {@@ -47,16 +47,15 @@ if (failed.length && !release) {'The `skip-ios-update` label bypasses this check. App Store availability has not been verified.');} else if (release) {const name = `iOS ${release.version} (build ${release.build})`;- if (release.kind === 'live') {- lines.push(`### ${name} is live and verified`, '',- 'The App Store build matches this PR’s current merge result. The iOS release requirement is satisfied; other checks and approvals still apply.');+ if (release.kind === 'approved') {+ lines.push(`### ${name} is approved and verified`, '',+ 'Apple approved the App Store build, and it matches this PR’s current merge result. The iOS release requirement is satisfied; other checks and approvals still apply.');+ if (release.state) lines.push('', `App Store state: \`${release.state}\`.`);} else {- lines.push(`### ${name} must be live before this PR can merge`, '', release.reason);+ lines.push(`### ${name} must be approved before this PR can merge`, '', release.reason);if (release.state) lines.push('', `App Store state: \`${release.state}\`.`);if (release.kind === 'waiting') {- lines.push('', release.state === 'PENDING_DEVELOPER_RELEASE'- ? 'Release the approved version in App Store Connect.'- : 'Wait for Apple to approve and make the release available.');+ lines.push('', 'Wait for Apple to approve the release.');} else if (release.kind === 'mismatch') {lines.push('', 'Bump the release numbers, commit, push, then remove and re-add `ios-update` to release the current native code. Use `--no-min` for a release that does not need a higher native build floor.');} else {@@ -64,9 +63,9 @@ if (failed.length && !release) {? 'The `ios-update` label is already present. Follow the **iOS App Store Release** run; if it failed, fix the reported problem, then remove and re-add the label to retry. Resolve any rejection or metadata issue in App Store Connect first.': 'Once the other checks pass and the PR is ready, add **`ios-update`** to build, upload, and submit it for App Review.');}- lines.push('', 'After release, **iOS Release Watch** reruns this check within 30 minutes. You can also rerun it manually. Optionally enable **auto-merge** to merge once all requirements pass.');+ lines.push('', 'After approval, **iOS Release Watch** reruns this check within 30 minutes. You can also rerun it manually. Optionally enable **auto-merge** to merge once all requirements pass.');}- lines.push('', `The next prod web deploy will use minimum supported iOS build **${release.floor}**, as committed in this PR.`,+ lines.push('', `The next prod deploy releases ${name} on the App Store and makes the web bundle require iOS build **${release.floor}** or later, as committed in this PR.`,'', `[App Store Connect](${release.distributionUrl})`);} else {// No structured result means verification never completed; never infer andiff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_check_comment.test.cjs b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_check_comment.test.cjsindex bbce116887..965183fe8c 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_check_comment.test.cjs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_check_comment.test.cjs@@ -38,7 +38,7 @@ test('expected release requirement includes instructions and the committed floor} });assert.equal(writes.length, 1);assert.equal(writes[0].type, 'create');- assert.match(writes[0].body, /2\.0\.10 \(build 188\) must be live/);+ assert.match(writes[0].body, /2\.0\.10 \(build 188\) must be approved/);assert.match(writes[0].body, /add \*\*`ios-update`\*\*/);assert.match(writes[0].body, /build \*\*185\*\*/);assert.match(writes[0].body, /runs\/456\/attempts\/2/);@@ -50,28 +50,24 @@ test('infrastructure failures never claim that the release is missing', async ()const { writes } = await run({ steps: { ...native, [id]: { outcome: 'failure' } } });assert.match(writes[0].body, /could not complete/);assert.match(writes[0].body, /does not establish whether/);- assert.doesNotMatch(writes[0].body, /must be live before/);+ assert.doesNotMatch(writes[0].body, /must be approved before/);}});-test('waiting and live results update the existing bot comment', async () => {- for (const kind of ['waiting', 'live']) {+test('waiting and approved results update the existing bot comment', async () => {+ for (const [kind, state] of [['waiting', 'IN_REVIEW'], ['approved', 'PENDING_DEVELOPER_RELEASE']]) {const { writes } = await run({ comments: [{ id: 99, user: { login: 'github-actions[bot]' }, body: marker }],- steps: { ...native, live: { outcome: kind === 'live' ? 'success' : 'failure', outputs: {- gate_result: JSON.stringify({ ...release, kind, reason: 'In review.', state: 'IN_REVIEW' }),+ steps: { ...native, live: { outcome: kind === 'approved' ? 'success' : 'failure', outputs: {+ gate_result: JSON.stringify({ ...release, kind, reason: 'In review.', state }),} } },});assert.equal(writes[0].type, 'update');assert.equal(writes[0].comment_id, 99);- assert.match(writes[0].body, kind === 'live' ? /live and verified/ : /Wait for Apple/);+ assert.match(writes[0].body, kind === 'approved' ? /approved and verified/ : /Wait for Apple/);}});-test('manual release and mismatched build need action rather than waiting', async () => {- const waiting = await run({ steps: { ...native, live: { outputs: { gate_result: JSON.stringify({- ...release, kind: 'waiting', state: 'PENDING_DEVELOPER_RELEASE', reason: 'Approved.',- }) } } } });- assert.match(waiting.writes[0].body, /Release the approved version in App Store Connect/);+test('mismatched build needs action rather than waiting', async () => {const mismatch = await run({ steps: { ...native, live: { outputs: { gate_result: JSON.stringify({...release, kind: 'mismatch', reason: 'Wrong native tree.',}) } } } });diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_check_live.sh b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_check_live.shindex 13b5a7c53c..b68b844103 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_check_live.sh+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_check_live.sh@@ -1,8 +1,9 @@set -euo pipefail-# The gate proper: the committed version + build must be live, built from the-# native code of the PR's current merge result.+# The gate proper: Apple must have approved the committed version + build+# (held for release or live), built from the native code of the PR's current+# merge result.merge=$(pr_merge_commit)native_tree_fetch "$merge"native_tree=$(native_tree_hash "$merge")echo "Merge result ${merge:0:10}: native tree ${native_tree}"-bun scripts/ios-app-store.mjs status --require-live --native-tree "$native_tree"+bun scripts/ios-app-store.mjs status --require-approved --native-tree "$native_tree"diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_tree.sh b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_tree.shindex 562d6d09b6..ad077a9a78 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_tree.sh+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_native_tree.sh@@ -16,7 +16,7 @@# natively, and the team bumps that version when a cache change must ship, so# the bump — not every edit under crates/client — is the native signal. The# release stamps uploaded builds with the hash, the merge gate compares the-# live build's stamp against the merge result's, and the drift / head guards+# approved build's stamp against the merge result's, and the drift / head guards# compare commits with it. Must match nativeTreeHash() in# apps/web/scripts/ios-app-store.mjs and the iOS Native Check's change# detection (web_app_check_main/ios_native_check.rs).diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_release_preconditions.sh b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_release_preconditions.shindex d2fafde121..9729e1a953 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_release_preconditions.sh+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_release_preconditions.sh@@ -4,7 +4,7 @@ set -euo pipefail# every other check on the head commit passing. Pending checks are waited on# (the label often lands right after a push); anything failing stops the# release before the long build. Our own checks are excluded: the native-# check is expected to be red until the release is live.+# check is expected to be red until Apple approves the release.pr_json=$(gh pr view "$PR_NUMBER" --repo "$GH_REPO" --json isDraft,headRefOid)if [[ "$(jq -r '.isDraft' <<<"$pr_json")" == "true" ]]; thenecho "PR #${PR_NUMBER} is a draft; mark it ready for review before adding ios-update." >&2diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_release_watch.sh b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_release_watch.shindex 5fee3c4e83..479910e010 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_release_watch.sh+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/scripts/ios_release_watch.sh@@ -6,11 +6,12 @@ set -euo pipefail# what the `iOS Release Drift` workflow does on push, except GitHub does# not run pull_request workflows on a PR that conflicts with main, so a# native push to such a PR only gets caught here.-# 2. Ask App Store Connect whether the iOS version + build committed at the-# PR head is live, built from the native tree the PR's merge result would-# have (`merge` is GitHub's test merge commit; the gate hashes the same).-# When it is, and the PR's latest `iOS Native Check` job (of the web app-# PR checks run) failed — it fails until the release is live — re-run that+# 2. Ask App Store Connect whether Apple approved the iOS version + build+# committed at the PR head (held for release, or live), built from the+# native tree the PR's merge result would have (`merge` is GitHub's test+# merge commit; the gate hashes the same). When it did, and the PR's latest+# `iOS Native Check` job (of the web app PR checks run) failed — it fails+# until Apple approves — re-run that# job so the gate, and the `Web App Status Check` that depends on it, go# green without anyone clicking "Re-run".#@@ -20,7 +21,7 @@ conf_path="apps/web/tauri/src-tauri/tauri.ios.conf.json"bump='cd apps/web && doppler run --project ios-release --config prd -- just ios-bump'check_pr() {- local pr=$1 number sha merge conf version build head_tree native_tree run run_id status run_url job conclusion job_id reruns outputs withdrawn live+ local pr=$1 number sha merge conf version build head_tree native_tree run run_id status run_url job conclusion job_id reruns outputs withdrawn held livenumber=$(jq -r '.number' <<<"$pr")sha=$(jq -r '.sha' <<<"$pr")merge=$(jq -r '.merge // empty' <<<"$pr")@@ -37,10 +38,13 @@ check_pr() {>"$RUNNER_TEMP/withdraw-${number}.log" 2>&1 || truesed 's/^/ /' "$RUNNER_TEMP/withdraw-${number}.log"withdrawn=$(sed -n 's/^withdrawn=//p' "$outputs")+ held=$(sed -n 's/^held=//p' "$outputs")live=$(sed -n 's/^live=//p' "$outputs")- if [[ "$withdrawn" == "true" || -n "$live" ]]; then+ if [[ "$withdrawn" == "true" || -n "$held" || -n "$live" ]]; thengh pr edit "$number" --remove-label ios-update- if [[ -n "$live" ]]; then+ if [[ -n "$held" ]]; then+ gh pr comment "$number" --body "📱 Native changes were pushed to this PR after Apple had already approved iOS ${held}. That build is held for release, so it will not go live on its own, but it blocks the next submission: remove it in App Store Connect (Developer Reject). Then bump (\`${bump}\`), commit, push, and re-add \`ios-update\`. The label was removed."+ elif [[ -n "$live" ]]; thengh pr comment "$number" --body "🚨 Native changes were pushed to this PR after Apple had already approved iOS ${live}, so that build is (or is about to be) live with native code this PR no longer matches. Bump (\`${bump}\`), commit, re-add the \`ios-update\` label, and ship the follow-up as soon as possible. The label was removed."elsegh pr comment "$number" --body "📱 Native code changed after this PR's App Store release started (the push-time drift check could not run — does the PR conflict with \`main\`?), so the pending App Review submission was withdrawn and the \`ios-update\` label removed. When the PR is ready again, bump (\`${bump}\`; the marketing version stays, the build number moves), commit, push, and re-add \`ios-update\`."@@ -49,7 +53,7 @@ check_pr() {return 0fi- # 2. Live check against the merge result.+ # 2. Approval check against the merge result.if [[ -z "$merge" ]]; thenecho "PR #${number}: no merge commit (conflicts with main?); cannot check the merge result"return 0@@ -58,14 +62,14 @@ check_pr() {native_tree=$(native_tree_hash "$merge")echo "PR #${number}: iOS ${version} (build ${build}) at ${sha:0:10}, merge-result native tree ${native_tree:0:10}"- if ! bun scripts/ios-app-store.mjs status --require-live \+ if ! bun scripts/ios-app-store.mjs status --require-approved \--version "$version" --build "$build" --native-tree "$native_tree" \>"$RUNNER_TEMP/status-${number}.log" 2>&1; then- echo " not live yet:"+ echo " not approved yet:"sed 's/^/ /' "$RUNNER_TEMP/status-${number}.log"return 0fi- echo " live on the App Store"+ echo " approved by Apple"run=$(gh run list --workflow web-app-check-main.yml --commit "$sha" \--json databaseId,status,url --limit 1 --jq '.[0] // empty')@@ -108,7 +112,7 @@ check_pr() {fiecho " re-running iOS Native Check (job ${job_id} of run ${run_id}; ${reruns} automatic re-runs so far)"gh run rerun --job "$job_id"- gh pr comment "$number" --body "📱 iOS ${version} (build ${build}) is live on the App Store. Re-ran the **iOS Native Check** ([run](${run_url})); this PR can merge once it passes."+ gh pr comment "$number" --body "📱 Apple approved iOS ${version} (build ${build}). Re-ran the **iOS Native Check** ([run](${run_url})); this PR can merge once it passes, and the next prod deploy releases it on the App Store."}# One PR's API hiccup must not stop the others from being checked thisdiff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/ios_native_check.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/ios_native_check.rsindex ad264f6e96..4d18f0bdde 100644--- a/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/ios_native_check.rs+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/web_app_check_main/ios_native_check.rs@@ -3,7 +3,8 @@//! (the required status check) covers it without a ruleset change. Web//! bundles ship over the air, but native changes only reach users through//! the App Store, so a PR whose bundle depends on new native code must not-//! merge before that native build is actually downloadable. The gate:+//! merge before Apple has approved that native build; the prod deploy that+//! ships the bundle releases it (`ios-app-store.mjs publish`). The gate://!//! 1. Detects native changes: a path filter over `apps/web/tauri/**`,//! minus what never reaches the iOS binary (anything Android-only by@@ -18,14 +19,14 @@//! file outside it, i.e. everything.//! 2. Verifies the PR bumped the iOS release numbers (`just ios-bump`)://! marketing version, build number, and `min-native-build.json`.-//! 3. Asks the App Store Connect API whether exactly that version + build is-//! live on the App Store, built from the native tree this PR's current-//! merge result has (fetched through the API, so native code that landed-//! on main after the release also fails it, even on a re-run: the-//! shipped build lacks it), and fails with instructions otherwise — add the-//! `ios-update` label to run the `iOS App Store Release` workflow and-//! wait for Apple's approval; `iOS Release Watch` re-runs this job once-//! the release is live.+//! 3. Asks the App Store Connect API whether Apple approved exactly that+//! version + build (held for release, or live), built from the native+//! tree this PR's current merge result has (fetched through the API, so+//! native code that landed on main after the release also fails it, even+//! on a re-run: the approved build lacks it), and fails with instructions+//! otherwise — add the `ios-update` label to run the `iOS App Store+//! Release` workflow and wait for Apple's approval; `iOS Release Watch`+//! re-runs this job once Apple approves.//!//! The App Store Connect key comes from Doppler (`ios-release/prd` via the//! `IOS_RELEASE_DOPPLER_TOKEN` secret), shared with the release workflow.@@ -76,7 +77,7 @@ pub(super) fn job() -> Job {.add_step(setup_bun()).add_step(verify_bump()).add_step(fetch_credentials())- .add_step(require_live_version())+ .add_step(require_approved_version()).add_step(skip_notice()).add_step(pr_comment())}@@ -218,14 +219,14 @@ fn fetch_credentials() -> Step<Run> {.add_env(("DOPPLER_TOKEN", vars::IOS_RELEASE_DOPPLER_TOKEN))}-/// Compares the live build's stamp against the native tree of the PR's+/// Compares the approved build's stamp against the native tree of the PR's/// *current* merge result — exactly what the floor derived from this build/// claims ships. Asked through the API rather than taken from the checkout:/// a re-run (the watcher's, the label workflow's, a human's) checks out the/// merge commit as of the run's original event, which may predate native/// code landing on main.-fn require_live_version() -> Step<Run> {- Step::new("Require the App Store release to be live")+fn require_approved_version() -> Step<Run> {+ Step::new("Require Apple's approval of the App Store release").run(concat!(include_str!("../scripts/ios_native_tree.sh"),include_str!("../scripts/pr_merge_commit.sh"),