Verifying a build on App Store Connect
tools/testflight-verify.mjs: the API token, the endpoints it polls, build states, timeouts, the export compliance fallback, --exists mode and exit codes.

An upload that succeeds is not yet a build testers can install: Apple processes it first and may reject it. tools/testflight-verify.mjs waits for that outcome through the App Store Connect API, with no browser session, and sends a notification. The Clipper worker also uses it to ask whether a build number is already taken. Source: testflight-verify.mjs.

Usage

node tools/testflight-verify.mjs <build-number> [version] # wait and notify node tools/testflight-verify.mjs <build-number> <version> --exists # probe only NOTIFY=0 TIMEOUT_MIN=10 node tools/testflight-verify.mjs 2890.12.14 0.1.0

Arguments are positional: build, version, mode. --exists is read as the third argument, so the version must be given with it. The bundle id comes from app.json app.id.

The build number is normalised first: each dotted component is parsed as an integer, because "App Store Connect drops leading zeros in each component (2872.09.00 -> 2872.9.0)" (L19-L23).

Authentication

The script reads the key metadata file (p8 path, keyId, issuerId; see Signing and credentials) and builds a JSON Web Token for every request (L32-L39):

Part

Value

Header

alg: ES256, kid: <keyId>, typ: JWT

Claims

iss: <issuerId>, iat: now, exp: now + 900 (15 minutes), aud: appstoreconnect-v1

Signature

SHA-256 with the private key, ieee-p1363 encoding

A non 2xx answer throws App Store Connect <status> for <path>: <first 300 characters of the body>.

Endpoints

All on https://api.appstoreconnect.apple.com:

Request

Purpose

GET /v1/apps?filter[bundleId]=<id>&fields[apps]=bundleId

Find the app record. The result is matched exactly on bundleId; none found throws No App Store Connect record for <id> under the configured Mintter account

GET /v1/builds?filter[app]=<app id>&filter[version]=<build>&filter[preReleaseVersion.version]=<version>&include=buildBetaDetail&limit=1

The build and its beta detail. The version filter is added only when a version was given

PATCH /v1/builds/<id> with attributes: {usesNonExemptEncryption: false}

The export compliance fallback

The polling loop

Every 30 seconds (L68-L114) it reads processingState of the build (or NOT_VISIBLE_YET when Apple does not list it yet) and internalBuildState of the beta detail, and logs a line whenever the pair changes.

flowchart TD P["poll build"] --> S{"processingState"} S -->|"INVALID or FAILED"| R["notify rejection, exit 1"] S -->|"VALID"| I{"internalBuildState"} S -->|"other"| D{"past deadline?"} I -->|"IN_BETA_TESTING"| OK["notify available, exit 0"] I -->|"MISSING_EXPORT_COMPLIANCE"| C["PATCH once, poll again"] I -->|"EXPIRED or PROCESSING_EXCEPTION"| N["notify not testable, exit 1"] I -->|"other"| D C --> P D -->|"yes"| T["notify timeout, exit 1"] D -->|"no"| W["wait 30 s"] W --> P

    Deadline. TIMEOUT_MIN minutes from start, default 45.

    Export compliance. testflight.sh normally writes ITSAppUsesNonExemptEncryption into the build (Building and uploading to TestFlight). If Apple still reports MISSING_EXPORT_COMPLIANCE, the script declares exempt encryption through the API once. A second occurrence after declaring is a failure.

    Success means VALID and IN_BETA_TESTING. This is the point at which the worker's commit status turns green.

--exists mode

With --exists the script makes the app lookup and one build query, then exits 0 if a build with that number exists and 4 if not. The worker calls this before building: exit 4 reserves the number; exit 0 either means its own earlier upload (resume verification) or a number someone else used (allocate the next one). Any other exit code aborts the delivery.

Exit codes

Code

Meaning

0

Available to internal testers, or --exists found the build

1

Rejected, not testable, compliance still missing, timed out, or an uncaught API error

2

No build number argument

3

No key metadata file

4

--exists and no such build

Notification

notify(message) prints the message and, unless NOTIFY=0, pipes it to ~/.local/bin/fleet-notify --key seed-exact-testflight-<build> (L49-L55). The key deduplicates repeats for one build. If that program is not installed the script says so and continues. Messages:

    Seed Exact 0.1.0 (<build>) is on TestFlight and available to internal testers. Open TestFlight to update.

    ...: Apple rejected the build during processing (<state>). Check the email from App Store Connect.

    ... processed but is not testable (<state>).

    ...: still <state> after <n> min; giving up waiting.

User stories

The code described here exists to deliver these stories. Each story lists this page in its Trace (traceability).

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Connections0
Linked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentLinked document ยท Outgoing linkLinked documentVerifying a build on App Store ConnectVerifying a build on App โ€ฆ
Citations 0Children & links 9

Loading child documentsโ€ฆ

Connections show where other documents or comments link to this document.

Related documents

Loading connectionsโ€ฆ