Skip to content

feat: RoktContracts POC Core Changes#675

Open
BrandonStalnaker wants to merge 12 commits intoworkstation/9.0-Releasefrom
feat/RoktContracts-POC
Open

feat: RoktContracts POC Core Changes#675
BrandonStalnaker wants to merge 12 commits intoworkstation/9.0-Releasefrom
feat/RoktContracts-POC

Conversation

@BrandonStalnaker
Copy link
Copy Markdown
Collaborator

@BrandonStalnaker BrandonStalnaker commented Mar 20, 2026

DRAFT

Background

  • Update to use RoktContracts for mParticle and the mParticle Rokt Integration.

What Has Changed

  • The mParticle versions of RoktContracts classes have been removed in internal and example code
  • The ObjC and Swift Example have been updated to use the local version of Core and the Rokt Integration

Checklist

  • I have performed a self-review of my own code.
  • I have made corresponding changes to the documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have tested this locally.

Reference Issue (For employees only. Ignore if you are an outside contributor)

@BrandonStalnaker BrandonStalnaker requested a review from a team as a code owner March 20, 2026 15:28
@BrandonStalnaker BrandonStalnaker marked this pull request as draft March 20, 2026 15:28
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

📦 SDK Size Impact Report

Measures how much the SDK adds to an app's size (with-SDK minus without-SDK).

Metric Target Branch This PR Change
App Bundle Impact 1.66 MB 1.73 MB +72 KB
Executable Impact 896 bytes 896 bytes +N/A
XCFramework Size 5.47 MB 6.30 MB +852 KB

⚠️ This change increases SDK size impact.

Raw measurements

Target branch (workstation/9.0-Release):

{"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1788,"with_sdk_executable_size_bytes":76360,"sdk_impact_kb":1704,"sdk_executable_impact_bytes":896,"xcframework_size_kb":5604}

This PR:

{"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":1860,"with_sdk_executable_size_bytes":76360,"sdk_impact_kb":1776,"sdk_executable_impact_bytes":896,"xcframework_size_kb":6456}

@BrandonStalnaker BrandonStalnaker self-assigned this Mar 31, 2026
@BrandonStalnaker
Copy link
Copy Markdown
Collaborator Author

build rokt wil sadly fail for this PR because the tests are using the workstation branch of mParticle Core. But, once the changes here are merged, it will no longer fail.

@BrandonStalnaker BrandonStalnaker marked this pull request as ready for review March 31, 2026 17:10
@cursor
Copy link
Copy Markdown

cursor bot commented Mar 31, 2026

PR Summary

High Risk
High risk because it changes public Rokt-facing APIs/types (MPRoktEvent, config, embedded views, placement options) and updates dependency wiring for CocoaPods/SPM/Xcode projects, which can break downstream integrations and builds.

Overview
Migrates the mParticle Rokt surface area to RoktContracts. Core and kit APIs now accept/pass through RoktContracts types (RoktEvent, RoktConfig, RoktEmbeddedView, RoktPlacementOptions) and the internal MPRoktEvent implementation is removed (events are no longer mapped; they are forwarded as-is).

Updates build/distribution plumbing to include RoktContracts. Adds RoktContracts as a dependency in the root Package.swift, core and kit podspecs, and the mParticle Xcode project; introduces a new SPM wrapper target (mParticle_Apple_SDK) that re-exports the ObjC module plus RoktContracts.

Refreshes examples/tests and local dev setup. Example apps and Rokt kit tests are updated to the new event/config APIs, Swift gets an Objective-C selector-based interop shim (MPRokt+SwiftInterop) for event subscription/select placement overloads, and the Example Podfile/SwiftExample project are adjusted to use local packages/pods; CI analyzer grep is tightened to avoid false positives.

Written by Cursor Bugbot for commit 433d788. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

# Align with monorepo mParticle-Apple-SDK.podspec (8.x). When using `pod :path`, CocoaPods
# resolves the local SDK; keep a loose constraint so `pod lib lint` and trunk releases stay valid.
s.ios.dependency 'mParticle-Apple-SDK', '>= 8.0'
s.ios.dependency 'RoktContracts', '~> 0.1'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pod dependency range is too broad

Medium Severity

The mParticle-Rokt pod now allows any mParticle-Apple-SDK version >= 8.0, which can resolve to older core releases that do not include the new RoktContracts-based API surface this kit now uses. This can produce dependency resolution that installs but breaks integration compatibility at build or runtime.

Fix in Cursor Fix in Web

# Fail if any *diagnostic* warnings remain after allowlist filters.
# Use ': warning:' (clang/Xcode style) — not bare 'warning', which false-positives on
# swiftc flags like -suppress-warnings in Swift package builds (e.g. RoktContracts).
bash -c '! (set -o pipefail && xcodebuild -project "mParticle-Apple-SDK.xcodeproj" -scheme "mParticle-Apple-SDK" -sdk iphonesimulator -configuration Debug -destination "platform=iOS Simulator,name=iPhone 16 Pro,OS=latest" clean analyze | grep -v "warning: The iOS Simulator deployment target" | grep -v "warning: Metadata extraction skipped" | grep -F -v "Repeated use of MParticle sharedInstance in one method; assign to a local variable once." | grep -F -v "warning: Run script build phase '"'"'Run Script'"'"' will be run during every build" | grep -B3 ": warning:")'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static analyzer warning gate now misses warnings

Low Severity

The warning detector now searches only for : warning:. Warnings emitted as warning: without a leading file-location prefix are no longer matched, so the analyzer step can succeed while genuine warnings remain in xcodebuild output.

Fix in Cursor Fix in Web

pod 'RoktUXHelper', :git => 'https://github.com/ROKT/rokt-ux-helper-ios.git', :tag => '0.8.3'

# Rokt iOS SDK 5.x (aligned with Kits/rokt/rokt/Package.swift). Use Git branch; not on CocoaPods trunk.
pod 'Rokt-Widget', :git => 'https://github.com/ROKT/rokt-sdk-ios.git', :branch => 'workstation/5.0.0'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example depends on temporary Git branch

Low Severity

The example now pins Rokt-Widget to a workstation branch and RoktUXHelper to a Git tag override. This introduces non-release dependency sources that can disappear or drift, making pod install for Example/Podfile fragile and intermittently failing for contributors and CI.

Additional Locations (1)
Fix in Cursor Fix in Web

if (mpEvent) {
onEvent(mpEvent);
}
onEvent(event);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nil event callback can crash kit

Medium Severity

events:onEvent: now unconditionally invokes onEvent(event) without checking whether onEvent is nil. The protocol declares onEvent as nullable, so a nil callback can be forwarded from MPRokt and cause a runtime crash when an event arrives.

Fix in Cursor Fix in Web

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.

4 participants