fix(mas): stop CFBundleVersion drifting from the release version - #43
Open
julia-kafarska wants to merge 1 commit into
Open
fix(mas): stop CFBundleVersion drifting from the release version#43julia-kafarska wants to merge 1 commit into
julia-kafarska wants to merge 1 commit into
Conversation
electron-builder.json hardcoded buildVersion, which sets macOS CFBundleVersion. npm version only edits package.json, so the hardcoded value went stale on every release: 2.1.2 shipped with CFBundleVersion 2.1.1, and App Store Connect rejects an upload whose CFBundleVersion is not higher than the last accepted one — a 409 that a version bump appears to fix but doesn't. This had already happened once before; d7a7f76's own message notes the values "had drifted" (2.0.1 vs 2.0.2). Remove the field. Unset, electron-builder defaults it to the package.json version, so the build number tracks the marketing version and can't drift. Document the tradeoff in mac-app-store.md, including the one legitimate use — a four-component buildVersion to re-upload under a version App Store Connect has already seen, without burning a marketing version. Verified: the rebuilt universal pkg reports CFBundleVersion 2.1.2. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while building the 2.1.2 MAS package: it would have been rejected by App Store Connect with the same 409 that rejected the previous upload, despite the version having been bumped.
Cause
electron-builder.jsonhardcoded"buildVersion": "2.1.1", which sets macOSCFBundleVersion.npm versiononly editspackage.json, so the hardcoded value goes stale the moment a release is cut. The 2.1.2 build came out as:App Store Connect requires
CFBundleVersionto be strictly higher than the last accepted upload. Since 2.1.1 had already been accepted, the 2.1.2 package would have 409'd identically — the kind of failure where bumping the version looks like the fix but changes nothing.This has happened before: d7a7f76's own commit message notes the two values "had drifted" (2.0.1 vs 2.0.2) and realigned them by hand. Hand-maintaining a second version number that must track the first is the bug.
Fix
Remove the field. Left unset, electron-builder defaults
buildVersionto thepackage.jsonversion, so the build number tracks the marketing version automatically and cannot drift.Documented in
mac-app-store.md, including the one legitimate use: a re-upload under a version App Store Connect has already seen (a rejected binary, say) doesn't need to burn a marketing version — set a temporary four-component build number like2.1.2.1and remove it once accepted. Plus the one-liner to check the value before uploading.The comment couldn't live in
electron-builder.jsonitself — it's schema-validated and rejects unknown keys, including_comment-style ones.Verification
Rebuilt the universal MAS package after the change:
verify:masfully green, and the crash logging from #41 is confirmed present in the shippedapp.asar.Note on the published 2.1.2
The already-published direct-download macOS builds carry
CFBundleVersion2.1.1 withCFBundleShortVersionString2.1.2. That's cosmetic for Developer ID distribution — Finder and the app both surface the short version string, and updates key off the GitHub release tag — so it isn't worth re-cutting. It self-corrects on the next release.🤖 Generated with Claude Code