Skip to content

port: CI hang fixes and workspace-switch condition waits - #914

Closed
nickolas-dimitrakas wants to merge 1 commit into
workstation/swift-migrationfrom
port/ci-and-concurrency-fixes-to-swift-migration
Closed

nickolas-dimitrakas wants to merge 1 commit into
workstation/swift-migrationfrom
port/ci-and-concurrency-fixes-to-swift-migration

Conversation

@nickolas-dimitrakas

Copy link
Copy Markdown
Contributor

Draft. Ports the subset of the main-line CI/test fixes that this branch is missing. Not a copy of #878 — see what was deliberately left out.

Why

CI on PRs targeting this branch is failing and slow. From run 33552140564 (PR #907):

Job Failure
native-unit-tests (tvOS, mParticle-Apple-SDK) crash in testSwitchWorkspaceKitsWithStop
native-unit-tests (iOS, mParticle-Apple-SDK) crash in testActiveKitsRegistryThreadSafety

And the workspace tests are burning ~100 seconds of pure fixed delay per run:

testSwitchWorkspaceOptions          30.118s
testSwitchWorkspaceSideloadedKits   30.108s
testSwitchWorkspaceKitsWithoutStop  20.147s
testSwitchWorkspaceKitsNoConfigs    20.078s

None of the main-line fixes for this had reached this branch.

What this ports

CI workflows — the #867 fixes: -parallel-testing-enabled NO (the Swift scheme was cloning simulators and starving the daemons one test blocks on), simctl bootstatus, a per-test timeout, plus the SPM resolve watchdog and job timeouts in build-kits. Taken from main after confirming this branch had no independent changes to those files.

Five workspace-switch tests — converted from nested 10-second dispatch_after chains to MPWaitForCondition, which spins the main run loop until the SDK is actually ready. dispatch_after and WORKSPACE_SWITCHING_DELAY are now gone from MParticleTests. Where a test asserts an outcome that arrives via the flush on the main queue, the wait includes that outcome so it cannot race the flush.

These were converted against this branch's own test bodies, not by copying main's file — that would have clobbered the migration-specific resetRegistry, kitContainer_PRIVATE and registeredKits.anyObject work here.

MPRoktTests teardown — stop the partial mock before releasing the object it wraps, rather than after.

Deliberately not ported

The kitsRegistry lock fix does not apply here. The migration moved the registry into MPKitContainer.swift, where registryLock and registry are both static and every accessor takes the lock — registeredKits returns a locked copy, removeRegisteredKit: mutates under the lock. This branch's registry locking is sounder than main's; porting the fix would have been patching a defect that isn't here.

The Rokt async timeouts and teardown drain are already present, and drainPendingAsyncWork is a two-pass drain — more thorough than the main-line version.

Honest limits

The teardown ordering change is unvalidated. MPRoktTests on this branch runs 10/10 clean locally both with and without it, so I have no local evidence it does anything. It is correct on its own terms — releasing a mocked object while its partial mock is installed is a real ordering bug — but I am not claiming it fixes anything observed.

testActiveKitsRegistryThreadSafety is not addressed. It crashes on this branch's CI too, and since the Swift registry here is correctly locked, the cause differs from the main-line one I fixed. Still open, still needs its own investigation.

Local numbers are Xcode 26.3 / iOS 26; CI is Xcode 16.4 / iOS 18. The workspace-test failures did not reproduce locally at all, so the conversion is justified by the CI evidence above plus the identical fix working on main, not by a local before/after.

🤖 Generated with Claude Code

Ports the subset of the main-line fixes that workstation/swift-migration is
actually missing.

- .github/workflows: the #867 simulator and SPM-hang fixes, taken from main
  after confirming this branch had no independent changes to those files.
- MParticleTests: the five workspace-switch tests were still built on nested
  10-second dispatch_after chains. Converted to MPWaitForCondition against this
  branch's own assertions rather than copying main's version, which would have
  clobbered the migration-specific registeredKits/resetRegistry work here.
- MPRoktTests: stop the partial mock before releasing the object it wraps.

Deliberately not ported: the kitsRegistry lock fix. It does not apply here. The
migration moved the registry into MPKitContainer.swift where registryLock and
registry are both static and every accessor takes the lock, so registeredKits
already returns a locked copy and removeRegisteredKit: already mutates under the
lock. This branch's registry locking is sounder than main's. The Rokt async
timeouts and teardown drain are likewise already present here, in a two-pass
form more thorough than the main-line version.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

🐦 Swift Migration Progress

Production implementation code at 5b6c5ad29eb4 compared with 2cd6e533eb24.

Area Goal Progress Base This PR Swift SLOC Objective-C remaining Change
Core SDK Short term — in scope ████▍░░░░░ 44.08% 44.08% 6,545 8,302 ➖ 0.00 pp
Core SDK Long term — all Objective-C ███▏░░░░░░ 31.70% 31.70% 6,545 14,103 ➖ 0.00 pp
SDK kit infrastructure Short term — in scope ███▌░░░░░░ 34.93% 34.93% 1,510 2,813 ➖ 0.00 pp
SDK kit infrastructure Long term — all Objective-C ███▎░░░░░░ 32.07% 32.07% 1,510 3,199 ➖ 0.00 pp
Standalone kits Short term — in scope ▏░░░░░░░░░ 1.06% 1.06% 152 14,218 ➖ 0.00 pp
Standalone kits Long term — all Objective-C ▏░░░░░░░░░ 1.06% 1.06% 152 14,218 ➖ 0.00 pp

Objective-C retained by design: Core SDK 5,801 · SDK kit infrastructure 386 · Standalone kits 0.

This PR's code movement

Area Swift lines added Objective-C lines removed
Core SDK 0 0
SDK kit infrastructure 0 0
Standalone kits 0 0
How this is measured
  • Current composition uses production source lines of code (SLOC) from cloc; comments and blank lines are excluded.
  • Short term — in scope excludes the Objective-C the migration will not delete, so 100% is the end of this project: every in-scope implementation gone.
  • Long term — all Objective-C keeps the full denominator. Reaching 100% there means the public API itself becomes Swift, which is a breaking change reserved for a future major release.
  • The gap between the two rows is the retained public/kit contract, runtime-identity, and boundary-glue surface listed in Tools/swift-migration-retained-objc.txt.
  • Retained wrappers keep their Objective-C interface but still shed logic to Swift. That thinning moves the long-term row and the retained figure, not the short-term row.
  • Both revisions are measured with the manifest from the head revision, so a manifest edit does not by itself move the reported change. A retained file this pull request renamed or deleted still counts as retained at the base.
  • Pull request movement uses physical additions/deletions from git diff base...head --numstat; it counts retained files too and is intentionally separate from SLOC totals.
  • Core excludes SDK kit infrastructure and vendored libraries. Standalone kits include only files below Kits/**/Sources.
  • Tests, examples, headers, build outputs, vendored libraries, and the MParticle/Sources Swift overlay are excluded.
  • Objective-C++ (.mm) is included in the Objective-C figures and removed counts.

Generated with cloc 2.10. This report is informational and does not gate migration direction.

@nickolas-dimitrakas nickolas-dimitrakas self-assigned this Sep 1, 2026
@nickolas-dimitrakas

Copy link
Copy Markdown
Contributor Author

Superseded by #915port/ is not an allowed branch prefix (semantic branch name check requires build/chore/ci/docs/feat/fix/perf/refactor/revert/style/test/). Rebranched as fix/port-ci-and-concurrency-fixes-to-swift-migration, same commits, same description.

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

📦 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 2.36 MB 2.36 MB +N/A
Executable Impact 848 bytes 848 bytes +N/A
XCFramework Size 6.82 MB 6.82 MB +N/A

➡️ SDK size impact change is minimal.

Raw measurements

Target branch (workstation/swift-migration):

{"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":2500,"with_sdk_executable_size_bytes":76312,"sdk_impact_kb":2416,"sdk_executable_impact_bytes":848,"xcframework_size_kb":6984}

This PR:

{"baseline_app_size_kb":84,"baseline_executable_size_bytes":75464,"with_sdk_app_size_kb":2500,"with_sdk_executable_size_bytes":76312,"sdk_impact_kb":2416,"sdk_executable_impact_bytes":848,"xcframework_size_kb":6984}

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