release: extract + test select_dist_profile/3 (App Store profile selection)#34
Merged
Conversation
resolve_dist_profile/3 mixed the ~/Library profile-dir scan and user-facing IO
with the actual selection logic (dev-vs-App-Store filtering, exact-vs-wildcard
bundle matching, uuid narrowing) — easy to get wrong and untested (ex_crap
flagged it: CRAP 214). Extract the pure kernel select_dist_profile/3 over an
already-parsed profile list; the dir scan + IO stay in the caller. Behavior is
unchanged (the wrapper renders the same :none / {:multiple} messages).
Matrix test: excludes dev (ProvisionedDevices) + enterprise (ProvisionsAllDevices)
profiles, exact match, wildcard fallback, exact-over-wildcard preference, uuid
narrowing, uuid-miss, no-match, and the multiple-match case.
Co-Authored-By: Claude Opus 4.8 (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.
Why
resolve_dist_profile/3(used bymix mob.releasefor App Store signing) mixed the~/Library/.../Provisioning Profilesdir scan and user-facingIO.putswith the actual selection logic — which is the fiddly part: filtering dev/ad-hoc (ProvisionedDevices) and enterprise (ProvisionsAllDevices) profiles out, matching by bundle id (exact.<bundle_id>vs wildcard.*), and narrowing by explicituuid. That logic was untested (anex_crappilot flagged it, CRAP 214), and it's in the release-signing path we just extended with the ASC API key.What
Extract the pure kernel
select_dist_profile/3(@doc false) that operates on an already-parsed profile list and returns{:ok, profile} | :none | {:multiple, list}. The dir scan + parse + the auto-detect/wildcardIO.putsstay in the caller. Behavior is unchanged — the wrapper renders the same "no profile" / "multiple profiles" error messages.Matrix test (9 cases): excludes development + enterprise profiles, exact bundle match, wildcard fallback, exact-over-wildcard preference, uuid narrowing, uuid-miss →
:none, no bundle match →:none, and the multiple-exact-match case.Checks
mix compile --warnings-as-errors,mix format,mix credo --strictclean.release_test.exs: 16 pass (9 new). Full suite: no new failures (the 8 reds are pre-existing adopt/enable/hotpush async-pollution flakes, unrelated).Follows the repo's "extract the pure decision to a
def, test the matrix" doctrine.🤖 Generated with Claude Code