Repository navigation
fix(ios): unlink kits dropped from $RNMParticleSPMKits - #455
Merged
Merged
Conversation
pod install added the listed kits to the app target but never removed one. Taking a kit off $RNMParticleSPMKits left it linked, and switching to another major version of a kit, such as mParticle-Braze-14 to mParticle-Braze-17, kept the old repository, because both share the product name mParticle-Braze. Now each pod install points a listed product at its configured package, unlinks any product from ios/mparticle_spm_kits.json that is not listed, and removes those package references once no target links them. It prints each change. Packages from other URLs, such as hand-added ones or kits given by url:, are never removed or replaced: if one already provides a listed kit's product, pod install stops and says so. Listing two kits with the same product also stops pod install, instead of switching between them on each run; a kit listed twice is linked once. scripts/ios/mparticle_spm_test.rb covers removal, switching, repeat installs, hand-added packages and other targets' references, and runs in the SPM CI leg. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
RNMPRoktPlaceholderTests is compiled into the sample's test target but was never in the -only-testing list, so neither iOS leg ran it, though the next major release changes how placeholders resolve. Both legs now run it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No blocking issues were identified, and focused regression coverage supports the reconciliation behavior and package safeguards.
No open issues 🎉
What changed in this PR
Aligns iOS Swift Package Manager kit links with $RNMParticleSPMKits, following the move to SPM by default.
Changes:
- Removes unlisted managed kits and relinks changed packages while protecting unmanaged packages.
- Adds regression tests and enables helper and embedded-placement tests in CI.
- Documents removal behavior and configuration errors.
| File | Description |
|---|---|
| scripts/ios/mparticle_spm_test.rb | Tests kit reconciliation, safeguards, and repeat-install stability. |
| README.md | Explains package cleanup and troubleshooting. |
| ios/mparticle_spm.rb | Reconciles kit links and removes unused managed references. |
| .github/workflows/pull-request.yml | Runs helper and placeholder tests. |
Review effort: Balanced
nickolas-dimitrakas
approved these changes
Oct 20, 2026
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
Apps that take the mParticle SDK from Swift Package Manager choose their integration kits in one list in their iOS dependency file. Today, changing that list only ever adds: a kit taken off the list stays in the app, and moving a kit to another major version keeps the old one. The app then ships a kit its team removed, or the wrong version of it, with no warning. Separately, the automated tests for embedded placements never ran on pull requests, although the next major release changes how those placements are found. Once this lands, the standard kits an app links follow the list as it changes, and those tests run on every pull request.
Programme
Follow-up to a post-merge review of react-native-mparticle#436, which made Swift Package Manager the iOS default for the next major release.
What changes
Before:
pod installadded each kit listed in$RNMParticleSPMKitsto the app target and never removed one. TakingmParticle-Roktoff the list left it linked. SwitchingmParticle-Braze-14tomParticle-Braze-17added the new repository but kept linking the old one, because both provide the productmParticle-Braze.After: each
pod installpoints every listed product at its configured package, unlinks any kit fromios/mparticle_spm_kits.jsonthat the list does not include, and removes that package reference once no target links it. Each change is printed. Packages from any other URL are never removed or replaced: if one already provides a listed kit's product, such as a fork added by hand,pod installstops and says so. Listing two kits with the same product also stopspod install; a kit listed twice is linked once. A secondpod installleaves the project byte-identical. CI now runs these tests in the SPM leg, and both iOS legs run the embedded-placement tests (RNMPRoktPlaceholderTests).The README's "What
pod installchanges" paragraph and two troubleshooting entries moved with it. The changelog is generated from commit titles at release, so it is not edited here.Start with
link_packagesinios/mparticle_spm.rb, thenscripts/ios/mparticle_spm_test.rb. CheckMANAGED_URLSfirst: only the core and the kit table's URLs are ever unlinked or re-pointed. Deliberately left alone: a kit given byurl:that is taken off the list stays linked, because it cannot be told apart from a package added by hand (documented in the README); the opt-out path still only warns; and makingiOS Sample App (SPM)a required check is a repository setting, not part of this pull request.Linked work
Related: react-native-mparticle#436, the change these fixes follow up.
Rollout
Path: merging publishes nothing. The fix ships in the next major release of the npm package, the first with Swift Package Manager as the default; no published version contains the defect. The CI change applies to pull requests as soon as this merges.
Feature flags: none.
Turning it off: revert this pull request before the release; after it, the next release, since a published version cannot be recalled. Apps that already ran
pod installkeep the project edits it made, which appear in their own project diff.What we watch: the
iOS Sample App (SPM)check, which now runs the helper tests and the placeholder tests and passes locally today; any failure there blocks the merge. After the release, new GitHub issues aboutpod installremoving a package; one report of a package removed that should have stayed means a patch release. Settled when the release has been out for a month without one.Risks
pod install; the migration guide already tells apps to list kits rather than add them by hand, and each removal prints a line naming the kit; seen inpod installoutput and the project diff the app commits.pod installstops with an error naming the fork instead, covered by a test; seen as apod installfailure with that message.pod install; the error and a README entry say to list one; seen as apod installfailure.url:and then taken off the list stays linked; not addressed, because it cannot be told apart from a package added by hand, and the README says to remove it in Xcode; seen as no removal line inpod installoutput and the kit still under the app target's frameworks.Risk class: low.
Who
Written by: an automated coding agent (Claude Code), from a post-merge review of #436 that the maintainer handed over.
Code reviewed before opening: a separate automated review agent, on 20 October 2026. It found that a hand-added package with a listed kit's product would be silently replaced, that a kit listed twice failed
pod install, and that reference removals were not printed; all three were fixed and are covered by tests.Design reviewed before opening: no one.
Decision this implements: the post-merge review findings on #436 of 20 October 2026 (not public).
Checked: on 20 October 2026, the new Ruby tests failed on
mainfor kit removal and switching, and all 7 pass with this change. A realpod installon the sample app in Swift Package Manager mode, stepping the kit list throughmParticle-Rokt,mParticle-Braze-14,mParticle-Braze-17, none andmParticle-Rokttwice, printed each change, and the last run left the project byte-identical. The sample's native tests in Swift Package Manager mode on an iOS 18.6 simulator with Xcode 27: 55 ran, none failed; the placeholder suite passed 14 and skipped 1, its legacy-architecture-only test. Also 39 JavaScript tests, both TypeScript checks, ESLint and Trunk.Not checked: the CocoaPods leg of the native tests, which CI runs; CocoaPods 1.16 (local and CI runs both used 1.15.2, because the sample's Gemfile keeps
xcodeprojbelow 1.26); an Expoprebuildwithout--clean, which goes through the samepod installhook.Size
Hand-written: 196 added and 5 removed lines in 4 files, 128 of them the new test.
Generated: none.
Notes for reviewers
Files:
ios/mparticle_spm.rb(the fix),scripts/ios/mparticle_spm_test.rb(new minitest suite, run fromsample/withbundle exec ruby ../scripts/ios/mparticle_spm_test.rb; not shipped in the npm package),.github/workflows/pull-request.yml(Ruby test step in the SPM leg;RNMPRoktPlaceholderTestsadded to-only-testing),README.md.pod installoutput on the sample, one run per kit list:🤖 Generated with Claude Code