Skip to content

fix(release): strip semver prerelease suffix from framework CFBundleVersion - #582

Open
dcalhoun wants to merge 1 commit into
trunkfrom
fix/release-xcframework-cfbundleversion-prerelease
Open

fix(release): strip semver prerelease suffix from framework CFBundleVersion#582
dcalhoun wants to merge 1 commit into
trunkfrom
fix/release-xcframework-cfbundleversion-prerelease

Conversation

@dcalhoun

@dcalhoun dcalhoun commented Aug 9, 2026

Copy link
Copy Markdown
Member

What?

CFBundleVersion in the GutenbergKitResources framework Info.plist was stamped with the raw package.json version, so prerelease versions produced an invalid value.

Why?

Alpha releases of GutenbergKit break WordPress-iOS's TestFlight upload. altool rejects the build:

This bundle is invalid. The value for key CFBundleVersion [0.19.0-alpha.0] in the Info.plist file must be a period-separated list of at most three non-negative integers. (90058)

CFBundleVersion has a stricter grammar than CFBundleShortVersionString: at most three period-separated non-negative integers. make release VERSION_TYPE=prerelease produces -alpha.N versions routinely, so every alpha reproduces this.

The suffix cannot be reshaped to fit — SemVer prerelease identifiers are alphanumeric by spec, so 0.19.0.alpha.0 is equally invalid. It has to be dropped.

Failing build: https://buildkite.com/automattic/wordpress-ios/builds/33627

How?

  • Derive BUNDLE_VERSION by stripping the prerelease (-…) and build-metadata (+…) suffixes, and stamp that into CFBundleVersion. CFBundleShortVersionString keeps the full version, which Apple accepts and which preserves the exact release in the shipped framework.
  • Assert Apple's grammar in verify_framework_plist. The gate previously only checked the plist matched package.json, so an illegal-but-matching value passed here and failed three hops downstream — precisely what the gate exists to prevent.

Reusing a core version across an alpha and its final release is safe: artifacts are identified by git SHA (package_xcframework.sh) and resolved by CDN URL plus SwiftPM checksum (Package.swift), never by this key.

Testing Instructions

  1. Set version in package.json to 0.19.0-alpha.0 (do not commit it — the artifact name is keyed on HEAD).
  2. Run make build-resources-xcframework.
  3. Confirm the build succeeds, then print the stamped values for every slice:
X=$(ls -d build/GutenbergKitResources-*.xcframework | head -1)
for s in "$X"/ios-*; do
  P="$s/GutenbergKitResources.framework/Info.plist"
  echo "$(basename "$s")"
  echo "  short:  $(plutil -extract CFBundleShortVersionString raw -o - "$P")"
  echo "  bundle: $(plutil -extract CFBundleVersion raw -o - "$P")"
done

Expected output — bundle drops the prerelease suffix, short keeps it:

ios-arm64
  short:  0.19.0-alpha.0
  bundle: 0.19.0
ios-arm64_x86_64-simulator
  short:  0.19.0-alpha.0
  bundle: 0.19.0
  1. Restore package.json to 0.19.0, rebuild, and confirm a non-prerelease version stamps 0.19.0 for both keys.

Accessibility Testing Instructions

N/A — no user-facing UI change.

🤖 Generated with Claude Code

…ersion

CFBundleVersion accepts at most three period-separated non-negative
integers, so a prerelease version like `0.19.0-alpha.0` is rejected by
altool with error 90058. Prerelease identifiers are alphanumeric by
spec, so no substitution satisfies both grammars — the suffix has to be
dropped.

Stamp CFBundleVersion with the `major.minor.patch` core while leaving
CFBundleShortVersionString on the full version, which Apple accepts and
which keeps the exact release visible in the shipped framework. Reusing
a core version across an alpha and its final release is safe: artifacts
are identified by git SHA and by CDN URL plus SwiftPM checksum, never by
this key.

Also assert Apple's grammar in verify_framework_plist. The gate only
checked that the plist matched package.json, so an illegal-but-matching
value passed here and failed three hops downstream in a consumer's
TestFlight upload — exactly what the gate exists to prevent.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the [Type] Bug An existing feature does not function as intended label Aug 9, 2026
@wpmobilebot

Copy link
Copy Markdown

XCFramework Build

This PR's XCFramework is available for testing. Add the following to your Package.swift:

.package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/582")

Built from 7226134

@dcalhoun
dcalhoun marked this pull request as ready for review August 9, 2026 21:18
@dcalhoun
dcalhoun requested a review from jkmassel August 9, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants