Skip to content

Fix Custom Entitlement Computation SPM installation test#6770

Merged
ajpallares merged 2 commits into
mainfrom
pallares/fix-cec-spm-installation-scheme
May 12, 2026
Merged

Fix Custom Entitlement Computation SPM installation test#6770
ajpallares merged 2 commits into
mainfrom
pallares/fix-cec-spm-installation-scheme

Conversation

@ajpallares

@ajpallares ajpallares commented May 12, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the Custom Entitlement Computation SPM step in the installation-tests-all-but-carthage CircleCI job, broken since #6764 bumped fastlane from 2.233.1 to 2.234.0.

Root cause

The SPMIntegration scheme has an empty <BuildAction> (it's test-only with no host app), so xcodebuild -showBuildSettings -scheme SPMIntegration returns no BUILT_PRODUCTS_DIR. fastlane 2.234.0 (fastlane/fastlane#22231) added a nil-guard in Scan::DetectValues.default_derived_data that now leaves derived_data_path unset in this case, so xcodebuild test writes the .xcresult to the default ~/Library/Developer/Xcode/DerivedData/... and scan can't find it. The test passes but scan errors with:

[!] Cannot find .xcresult in derived data which is needed to determine test results.

Fix

Set derived_data_path explicitly in the Scanfile. This short-circuits default_derived_data before it hits the new nil-guard, restoring 2.233.1 behavior.

The value (scan_derived_data) matches the convention already used in fastlane/Fastfile for the other test-only test bundles in this repo (BackendIntegrationTests, v3LoadShedderIntegration, v4LoadShedderIntegration).

Test plan

  • CircleCI installation-tests-all-but-carthage passes the Installation Test: Custom Entitlement Computation SPM step (pipeline #37656).

Note

Low Risk
Low risk change limited to Fastlane test configuration; it only affects where derived data is written so scan can find .xcresult for a test-only scheme.

Overview
Fixes the SPMCustomEntitlementComputationInstallation Fastlane scan run by explicitly setting derived_data_path in its Scanfile, ensuring .xcresult output is discoverable for a test-only scheme after the fastlane 2.234.0 behavior change.

Reviewed by Cursor Bugbot for commit 4eee87c. Bugbot is set up for automated code reviews on this repo. Configure here.

The `SPMIntegration` scheme in `SPMCustomEntitlementComputationInstallation` had
an empty `<BuildAction>` and a dangling `<LaunchAction>` reference to a
non-existent `SPMInstallation.app` target. That meant
`xcodebuild -showBuildSettings -scheme SPMIntegration` returned no settings
at all (no `BUILT_PRODUCTS_DIR`, no `SUPPORTED_PLATFORMS`).

Until fastlane 2.233.1 this was masked: scan silently fell back to
`File.expand_path("../../..", nil)` as `derived_data_path`, which happened
to be a writable path on CI, so the test ran and scan found the
`.xcresult`. fastlane 2.234.0 (PR fastlane/fastlane#22231) added an
explicit nil-guard in `Scan::DetectValues.default_derived_data`, so
`derived_data_path` is now left unset. `xcodebuild test` then uses its
default `~/Library/Developer/Xcode/DerivedData/...`, scan can't find the
result bundle there, and the installation test fails with
"Cannot find .xcresult in derived data which is needed to determine test
results" even though the test itself passes.

Fix the scheme to match the pattern already used by other test-only
schemes in the repo (e.g. `BackendIntegrationTests.xcscheme`):

- Add a `<BuildActionEntry buildForTesting="YES" .../>` for the
  `SPMInstallationTests.xctest` target so the scheme has a real buildable.
- Replace the dangling `SPMInstallation.app` reference in
  `<LaunchAction><MacroExpansion>` with the test bundle (the app target
  doesn't exist in this project).
- Declare `SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"` on the test
  target so `xcodebuild -showBuildSettings -scheme` resolves cleanly
  regardless of Xcode version.
- Drop the now-unnecessary Scanfile workaround
  (`skip_build(true)` + accompanying comment) — the scheme is no longer
  "only setup for testing, not building".

Co-authored-by: Cursor <cursoragent@cursor.com>
@ajpallares

Copy link
Copy Markdown
Member Author

@RCGitBot please test installation-tests-all-but-carthage

@github-actions

Copy link
Copy Markdown

🚀 Triggered installation-tests-all-but-carthagePipeline #37647

The previous commit added the test bundle to the scheme's <BuildAction>
to fix `xcodebuild -showBuildSettings` returning empty settings. That
worked in theory, but in practice CI showed that once xcodebuild has a
buildable in the scheme it enforces scheme-level destination validation
against the test target's effective platforms, and rejects iOS Simulator
destinations:

    xcodebuild: error: Unable to find a destination matching the
    provided destination specifier:
            { platform:iOS Simulator, id:... }
    Available destinations for the "SPMIntegration" scheme:
            { platform:visionOS Simulator, ...Designed for [iPad,iPhone]... }

The empty <BuildAction> in the original scheme was effectively the
escape hatch that let fastlane pass an iOS Simulator destination and
have it accepted. Removing that escape hatch broke the build.

Revert the scheme and project.pbxproj changes back to main and instead
fix the real symptom: tell `fastlane scan` where to put / find derived
data. Once `derived_data_path` is set, `Scan::DetectValues
.default_derived_data` short-circuits before the
`BUILT_PRODUCTS_DIR is nil` early-return introduced in
fastlane/fastlane#22231 (fastlane 2.234.0), and the `.xcresult` lookup
works the same way it did under 2.233.1.

Use the same value (`scan_derived_data`) that the BackendIntegrationTests
and v3/v4 LoadShedderIntegration lanes already use in `fastlane/Fastfile`.

Co-authored-by: Cursor <cursoragent@cursor.com>
@ajpallares ajpallares changed the title Fix Custom Entitlement Computation SPM installation test scheme Fix Custom Entitlement Computation SPM installation test scan May 12, 2026
@ajpallares

Copy link
Copy Markdown
Member Author

@RCGitBot please test installation-tests-all-but-carthage

@github-actions

Copy link
Copy Markdown

🚀 Triggered installation-tests-all-but-carthagePipeline #37656

@ajpallares ajpallares changed the title Fix Custom Entitlement Computation SPM installation test scan Fix Custom Entitlement Computation SPM installation test May 12, 2026
@ajpallares ajpallares marked this pull request as ready for review May 12, 2026 17:42
@ajpallares ajpallares requested a review from a team as a code owner May 12, 2026 17:42
@ajpallares ajpallares requested a review from fire-at-will May 12, 2026 17:42

@facumenzella facumenzella left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks legit 🆗

@ajpallares ajpallares merged commit 1fbee23 into main May 12, 2026
17 of 19 checks passed
@ajpallares ajpallares deleted the pallares/fix-cec-spm-installation-scheme branch May 12, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants