Skip to content

fix: Flaky iOS CI test runs - #1458

Merged
sbarrio merged 3 commits into
developfrom
sbarrio/fix/ios-ci-flaky-test-builds
Oct 1, 2026
Merged

sbarrio merged 3 commits into
developfrom
sbarrio/fix/ios-ci-flaky-test-builds

Conversation

@sbarrio

@sbarrio sbarrio commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

Two things:

  • 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".
  • The macOS runners are persistent and build every branch at the same
    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)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

sbarrio and others added 2 commits October 1, 2026 12:18
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>
@sbarrio sbarrio changed the title fix: Import Foundation explicitly in iOS test mocks fix: Flaky iOS CI test runs Oct 1, 2026
@sbarrio
sbarrio marked this pull request as ready for review October 1, 2026 10:51
@sbarrio
sbarrio requested a review from a team as a code owner October 1, 2026 10:51
Copilot AI balanced review requested due to automatic review settings October 1, 2026 10:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 Medium severity

Open (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.

Comment thread .gitlab-ci.yml
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'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Changes at c09862e

* Copyright 2019-2020 Datadog, Inc.
*/

import Foundation

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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 ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Copilot AI balanced review requested due to automatic review settings October 1, 2026 12:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The changes consistently address both identified sources of flaky iOS builds without introducing unresolved issues.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)

@sbarrio
sbarrio merged commit 625d24f into develop Oct 1, 2026
16 checks passed
@sbarrio
sbarrio deleted the sbarrio/fix/ios-ci-flaky-test-builds branch October 1, 2026 13:13
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