ci: stop routing-policy PRs that add a guard test from compiling macOS
Problem
When a PR edits CI routing policy, ci.yml classifies the PR's product files with the trusted base router, which copies a handful of files from the base commit. Two gaps made those PRs compile the macOS app for nothing:
- Test references came only from the base workflows. A
tests/file counts as macOS-neutral only when a workflow names it in Linux jobs alone. A guard test the PR adds is named only by the PR's ownci-guards.yml, so the base router treated it as macOS-relevant. That scheduled compile admission and a Release build. - No Xcode project or package manifests. The trusted copy logged
Could not derive macOS local-package dependency closure; keeping Packages/iOS macOS-relevant: … trusted-ci-router/cmux.xcodeproj/project.pbxproj.
Observed on #13703 (run 35753992765): the product files were one iOS script and one new guard test. changes resolved macos=true release_build=true, and compile admission spent 34+ min in "Compile app-host test product". That run also missed every cache because it is a fork PR, which #13717 addresses separately.
Resulting behavior
- Merged references:
load_macos_job_test_referencesnow merges the PR head's references whenCMUX_CI_HEAD_TEST_REFERENCE_ROOTis set. ci.yml sets it to the workspace for the trusted-router invocation. A path that either the base or the head names in a macOS job stays macOS-relevant, and if the head can't be read, only the base is used. - Project and manifests: the trusted copy now also receives the base
cmux.xcodeproj/project.pbxprojand everyPackages/*/*/Package.swift. - #13703 replayed locally:
macos=true release_build=truebecomesmacos=false release_build=false. That used the new detector, base workflows as the trusted root, and the PR's checkout as head.
Validation and remaining gap
- New test
test_trusted_router_reads_new_guard_tests_from_the_pr_headcovers three cases: the base alone keeps the new test macOS-relevant; merging head Linux references makes it guard-only; and a head macOS job naming it keeps it macOS-relevant. - All of
tests/test_ci_change_areas.pypasses locally (withRUNNER_TEMPset, as CI does), along withtest_ci_linux_guard_routing.py,test_ci_release_guard_structure.pyandtest_ci_self_hosted_guard.sh. - Remaining gap: the trusted router runs the base detector, so the reference merge only takes effect for PRs opened after this lands. This PR's own run still uses the old behavior.
Part of #13095.
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Stops routing-policy PRs that add a guard test from compiling the macOS app for nothing, since the trusted base router previously treated the new tests/ file as macOS-relevant and lacked the Xcode project and package manifests needed to derive the local-package closure.
- Merges the PR head's workflow test references when
CMUX_CI_HEAD_TEST_REFERENCE_ROOTis set; a path named in a macOS job by either side stays macOS-relevant. - Copies the base
cmux.xcodeproj/project.pbxprojand allPackages/*/*/Package.swiftinto the trusted router's workspace. - Adds a test covering base-only, merged-head, and head-macOS-named cases; the existing CI area tests pass.
- Only takes effect for PRs opened after this lands, since routing-policy PRs are classified by the base detector.
Part of #13095.
Summary by CodeRabbit
-
Bug Fixes
- Improved change detection for CI routing policies and package updates.
- CI now more accurately identifies macOS-relevant changes, reducing unnecessary checks while ensuring affected changes are validated.
- Routing decisions now account for workflow and guard-test updates introduced in the current change.
-
Tests
- Added coverage for classifying newly introduced CI guard tests and workflow references.