Skip to content

release: extract + test select_dist_profile/3 (App Store profile selection)#34

Merged
GenericJam merged 1 commit into
masterfrom
test/resolve-dist-profile
Jul 7, 2026
Merged

release: extract + test select_dist_profile/3 (App Store profile selection)#34
GenericJam merged 1 commit into
masterfrom
test/resolve-dist-profile

Conversation

@GenericJam

Copy link
Copy Markdown
Owner

Why

resolve_dist_profile/3 (used by mix mob.release for App Store signing) mixed the ~/Library/.../Provisioning Profiles dir scan and user-facing IO.puts with 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 explicit uuid. That logic was untested (an ex_crap pilot 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/wildcard IO.puts stay 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 --strict clean.
  • 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

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>
@GenericJam GenericJam merged commit bc9754c into master Jul 7, 2026
3 checks passed
@GenericJam GenericJam deleted the test/resolve-dist-profile branch July 7, 2026 23:46
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.

1 participant