Skip to content

release.sh doesn't bump APP_IOS_BUILD_NUMBER, so consecutive releases reuse the same iOS build number #513

Closed

Description

@thinkclay

What

APP_IOS_BUILD_NUMBER is hardcoded in apps/scaffald/eas.json (production profile env) and consumed by app.config.ts:47:

(process.env.APP_IOS_BUILD_NUMBER || `${derivedVersionCode}`).toString()

scripts/release.sh bumps only apps/scaffald/package.json — it never touches eas.json (zero references). So the build number only moves when someone remembers to edit it by hand.

Evidence from today's build list:

build 11202  v1.16.1  FINISHED   ← bumped manually while cutting 1.16.1
build 11201  v1.16.0  ERRORED
build 11201  v1.15.0  FINISHED   ← same build number, different release

v1.15.0 and the v1.16.0 attempt both went out as 11201.

Why it matters

Apple scopes build-number uniqueness to the version string, so 1.15.0/11201 and 1.16.0/11201 do not actually collide at submission — this was not what broke v1.16.0 (that was #512). But it's a live trap in two ways:

  1. Any second build of the same version collides. A respin of 1.16.1 with the number still at 11202 is rejected by App Store Connect at submission — after a full build has been paid for.
  2. Build numbers stop being a monotonic identifier. Two different commits shipping as "11201" makes it impossible to map a TestFlight build back to a commit from the build number alone, which is the thing the one-tag-one-build convention in RELEASE-PROCESS.md is trying to guarantee.

Suggested fix

Have release.sh bump APP_IOS_BUILD_NUMBER in eas.json in the same commit as the version bump — it already writes package.json with node -e, so the same approach works. Monotonic increment is enough; it does not need to encode the version.

Alternative: drop the hardcoded env var entirely and let app.config.ts fall back to derivedVersionCode, if that derivation is already unique per release. Worth checking what derivedVersionCode computes before choosing — if it derives from the version string it may be the better source of truth and one less thing to hand-maintain.

Found while cutting v1.16.1 (see #512 for why that release existed).

Activity

  1. added a commit that references this issue on Sep 1, 2026
    7140861
  2. thinkclay commented on Sep 1, 2026

    @thinkclay
    ContributorAuthor

    Fixed in #682, and the fix is not the one this issue proposed — worth recording why.

    The build list shows the derivation was right until it wasn't:

    Version Shipped Derived
    1.10.2 11002 11002 match
    1.12.0 11200 11200 match
    1.12.0 11201 — respin — the pin was added here
    1.14.0 11201 11400 frozen
    1.15.0 11201 11500 frozen
    1.16.0 11201 11600 frozen
    1.16.1 11202 11601 frozen

    So APP_IOS_BUILD_NUMBER was not a config someone forgot to maintain — it was a one-off override for the 1.12.0 respin that was left in eas.json, where it then applied to every release after it. Android never had this problem because it never had a pin.

    This issue suggested having release.sh bump the pin. That adds a step that can be forgotten, which is the failure mode already in evidence. Unpinning removes the step: the package.json bump release.sh already does moves the build number by itself. The env var stays as the per-build respin override it was meant to be.

    On the issue's own open question — "worth checking what derivedVersionCode computes before choosing" — the derivation is unique per release and monotonic, and Android had been relying on it all along.

    Two things found while fixing it:

    The derivation cannot be extracted to a module. I tried; Expo transpiles app.config.ts to a single app.config.js and cannot resolve a relative import out of it, so every build fails with Cannot find module './version-code'. The note at the top of that file only warned about package imports. It now covers relative ones too, and the tests import app.config.ts itself rather than a copy.

    The scheme has an undocumented bound: two digits each for minor and patch, so 1.100.0 and 2.0.0 both encode to 20000. That now throws at config evaluation instead of emitting a duplicate that is only caught at submission.

    The guard was verified by re-adding the pin — it fails with expected [ 'production' ] to deeply equal []. RELEASE-PROCESS.md had nothing about build numbers at all, which is part of how this survived four releases; it does now.

    app-v1.17.0 was moved to include the fix (nothing had been built from it). At the tag: ios.buildNumber 11700, android.versionCode 11700, above 11203.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions