Skip to content

fix(release): unpin APP_IOS_BUILD_NUMBER so the build number tracks the version - #682

Merged
thinkclay merged 1 commit into
mainfrom
fix/ios-build-number
Sep 1, 2026
Merged

thinkclay merged 1 commit into
mainfrom
fix/ios-build-number

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

Closes #513.

What was actually going on

The build number is derived from the app version in app.config.ts — 1.10.2 → 11002 — and Android has always used that derivation. iOS stopped, because APP_IOS_BUILD_NUMBER was pinned in eas.json's production profile.

The build list says exactly when and why:

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

The pin was added for a real need — Apple scopes build-number uniqueness to the version string, so respinning one version must change the number. Then it stayed, and three releases inherited it.

So the fix isn't the one the issue suggested

#513 proposed teaching release.sh to bump the pin in eas.json. That adds a step that can be forgotten, which is the failure mode we already have.

Unpinning removes the step instead: the package.json bump release.sh already does moves the build number by itself. The env var survives as what it was meant to be — a per-build override for a respin, passed on the command line:

APP_IOS_BUILD_NUMBER=11701 pnpm --filter scaffald-app eas:build:prod:ios

Verified against the real config, not by reading it

expo config                          → version 1.17.0
                                       ios.buildNumber 11700
                                       android.versionCode 11700

APP_IOS_BUILD_NUMBER=11701 expo config → ios.buildNumber 11701

11700 > 11203, the highest number ever shipped, so nothing goes backwards.

Two things found on the way

The derivation cannot live in its own module. I tried extracting it to version-code.ts — Expo transpiles app.config.ts into a single app.config.js and cannot resolve a relative import out of it, so every build dies with Cannot find module './version-code'. The note at the top of that file only warned about package imports; it now says relative ones fail too. The tests import app.config.ts itself, so the rule is pinned without being duplicated.

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 rather than emitting a duplicate — a duplicate is only discovered at submission, after a build has been paid for.

The guard was checked by breaking it

Re-adding the pin fails the test with the offending profile named:

✗ the respin override is not pinned by any eas.json profile
  AssertionError: expected [ 'production' ] to deeply equal []

7/7 in apps/scaffald/tests/build-number.test.ts. RELEASE-PROCESS.md said nothing about build numbers at all, which is part of how this survived four releases; it does now.

typecheck 12/12 · test:unit 7/7 --skip-nx-cache · lint 10/10

Note on the app-v1.17.0 tag

That tag predates this fix, so a build cut from it would still use the pinned 11203. Flagged separately — it needs a decision, not a silent choice.

🤖 Generated with Claude Code

…he version

Closes #513.

The build number is derived from the app version in app.config.ts — 1.10.2
gives 11002 — and Android has always used that derivation. iOS stopped,
because `APP_IOS_BUILD_NUMBER` was pinned in eas.json's production profile.

The build list says exactly when and why:

  1.10.2  shipped 11002  derived 11002  match
  1.12.0  shipped 11200  derived 11200  match
  1.12.0  shipped 11201  respin — the pin was added here
  1.14.0  shipped 11201  derived 11400  FROZEN
  1.15.0  shipped 11201  derived 11500  FROZEN
  1.16.0  shipped 11201  derived 11600  FROZEN
  1.16.1  shipped 11202  derived 11601  FROZEN

The pin was added to respin 1.12.0, which is a real need — Apple scopes
build-number uniqueness to the version string, so a second build of one
version must change it. Then it stayed, and three releases inherited it.

So the fix is not to teach release.sh to bump the pin, as the issue suggested.
It is to stop pinning: the version bump release.sh already does moves the
build number on its own, and there is no new step to forget. The env var
survives as what it was meant to be — a per-build override for a respin,
passed on the command line and nowhere else.

Verified against the real config rather than by reading it:

  expo config → version 1.17.0, ios.buildNumber 11700, android.versionCode 11700
  APP_IOS_BUILD_NUMBER=11701 expo config → ios.buildNumber 11701

11700 is above 11203, the highest ever shipped, so nothing goes backwards.

Two things found on the way:

The derivation cannot be extracted to a module. Expo transpiles app.config.ts
to a single app.config.js and cannot resolve a relative import out of it —
`Cannot find module './version-code'` fails every build. I tried it, it broke,
and the note now says so, because the comment at the top of that file only
warned about package imports. The tests import app.config.ts itself instead,
so the rule is pinned without being copied.

The scheme has a bound nobody had written down: 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 rather than emitting a duplicate that is only caught at submission,
after a build has been paid for.

The guard test was checked by re-adding the pin: it fails with
`expected [ 'production' ] to deeply equal []`.

RELEASE-PROCESS.md said nothing about build numbers at all, which is part of
how this survived. It does now.

typecheck 12/12, test:unit 7/7 --skip-nx-cache, lint 10/10.
@thinkclay
thinkclay merged commit 7140861 into main Sep 1, 2026
3 checks passed
@thinkclay
thinkclay deleted the fix/ios-build-number branch September 1, 2026 17:20
thinkclay added a commit that referenced this pull request Sep 1, 2026
…override (#684)

Three corrections to what I wrote in #682, two of them mine to own.

**The build command did not exist.** #682 told people to respin with
`pnpm --filter scaffald-app eas:build:prod:ios`. There is no such script. The
production path is `pnpm ship:ios` — which RELEASE-PROCESS.md already said
correctly forty lines further down, so I introduced an inconsistency into a
doc that was right.

**The override advice was unverified.** I wrote `APP_IOS_BUILD_NUMBER=11701
pnpm ship:ios` as though exporting the variable reaches the build. It reaches
`app.config.ts` wherever that file is *evaluated*, and an EAS cloud build
evaluates it again on the worker, which does not inherit a local shell. I have
not verified that a locally exported value reaches the binary, so the doc no
longer claims it does.

What is proven end to end is the version bump: app-v1.17.0 built on EAS as
1.17.0 / 11700. So respinning is now documented as "bump the patch" — same
mechanism, already demonstrated, and it keeps one-tag-one-build intact, which
a same-version respin quietly breaks. The override is documented with its real
scope and with `eas env:create` as the cloud path, plus an instruction to
delete it afterwards, since an override left anywhere persistent is precisely
how #513 happened.

**ITMS-90863 is expected.** Apple emails it after every iOS delivery:
ExpoModulesCore Swift symbols that do not resolve against the macOS runtime.
Delivery succeeds; it blocks nothing. It fires because supportsTablet makes
the app eligible for Apple silicon Macs by default, which is an App Store
Connect setting with no representation in this repo. Documented so the next
one is recognised rather than re-investigated, with a pointer to #683 for the
decision — and an explicit "do not set supportsTablet: false to silence it",
which would drop real iPad support to quieten a warning about a platform we do
not ship to.

Verified after editing: build-number tests 7/7, and `expo config` still
resolves 1.17.0 / 11700 — the comment sits in app.config.ts, so a bad edit
there breaks every build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant