Repository navigation
fix: Flaky iOS CI test runs - #1458
Conversation
MockDatadogCore, RUMMocks and MockRUMMonitor use Date, URL and URLRequest but only imported the Datadog modules, relying on them to make Foundation visible. That stopped holding on the CI runners, breaking the core iOS test build with "cannot find type 'Date' in scope". Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The benchmark archive still uses shared default DerivedData, leaving one CI build path exposed to cross-branch contamination.
Review effort: Balanced
Findings: 1
What changed in this PR
Adds explicit Foundation imports and isolates DerivedData for primary iOS CI jobs.
Changes:
- Import Foundation in iOS test mocks.
- Configure project-local DerivedData for iOS tests and example builds.
| File | Description |
|---|---|
.gitlab-ci.yml |
Configures DerivedData for primary iOS jobs. |
packages/core/ios/Tests/RUMMocks.swift |
Imports Foundation explicitly. |
packages/core/ios/Tests/MockRUMMonitor.swift |
Imports Foundation explicitly. |
packages/core/ios/Tests/MockDatadogCore.swift |
Imports Foundation explicitly. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| DEVELOP_BRANCH: 'develop' | ||
| DEVELOPER_DIR: '/Applications/Xcode-16.4.0.app/Contents/Developer' | ||
| IOS_SIMULATOR_DESTINATION: 'platform=iOS Simulator,OS=18.5,name=iPhone 16 Pro Max' | ||
| IOS_DERIVED_DATA_PATH: '$CI_PROJECT_DIR/DerivedData' |
| * Copyright 2019-2020 Datadog, Inc. | ||
| */ | ||
|
|
||
| import Foundation |
There was a problem hiding this comment.
MockDatadogCore, RUMMocks and MockRUMMonitor use Date, URL and URLRequest but only imported the Datadog modules, relying on them to make Foundation visible. That stopped holding on the CI runners, breaking the core iOS test build with "cannot find type 'Date' in scope".
Do we know why that happened, was it related to the derived data path change ?
There was a problem hiding this comment.
I believe so, yes. It looks like this started happening with the first builds of the SPM migration PR.
Since the runners shared that folder, build artifacts from a previous build could affect the next one on the same runner.

What does this PR do?
Two things:
path, so each machine reused one DerivedData folder across all branches.
Build output from one branch (e.g. SwiftPM-built dd-sdk-ios from the SPM
migration) carried over into later builds of other branches, making the
iOS test jobs fail depending on which runner they landed on. We now point every xcodebuild call at $CI_PROJECT_DIR/DerivedData instead.
Motivation
CI should work across the board.
Additional notes
Failed runs:
https://mosaic.us1.ddbuild.io/change-request/16831880634330757378?owner=DataDog&repository=dd-sdk-reactnative&taskExecutionId=2097878171&taskId=gitlab&utm_content=gitlab_task_check&utm_source=github_pr_page
https://mosaic.us1.ddbuild.io/change-request/16831880634330757378?owner=DataDog&repository=dd-sdk-reactnative&taskExecutionId=2097877880&taskId=gitlab&utm_content=gitlab_task_check&utm_source=github_pr_page
Review checklist (to be filled by reviewers)