ci: route only the pull request's own files that main's changes reach
Summary
Follow-up to #14987. After "merge main" into a green head, the delta step (#14659) routed diff(H1, merge): everything main gained since the pull request last synced. Main's own runs judge those files. Charging them to the pull request failed #14961 and #14960 on main's cmuxUITests/ edits. #14987 only skipped the delta when it got large.
After a merge of main, the question left for this run is whether the pull request's code works against new main. scripts/ci/delta_since_green.py now routes:
- the pull request's own files (
diff(merge^1, merge)) whose CI areas meet the areas of main's changes since H1. Areas come fromdetect_ci_change_areas.py, loaded from the checkout. That copy is the base's, because a pull request that editsscripts/ci/keeps its whole diff. Its areas already include the macOS and CLI package closures. - plus the pull request's files that H1's run never saw: the resolution commit, a merge's edits to both sides, and a merge that kept the pull request's side of a file only main edited. Before, that last case skipped the delta.
It never routes a file that only main changed:
- Empty intersection: nothing routes. The app still compiles (
macos=true, all else off) when the pull request has app code. - Uncertain areas: if the router can't load or a closure can't be derived, the whole pull request diff routes, as before.
That covers #14987's size rule and its cmuxUITests/ rule, so both are removed.
ci.yml's detect step keeps diffing against merge^1. It limits the changed-file list and the -U0 diffs for cmuxTests/ and app code to the delta's files. The delta step now outputs files and compile_macos instead of base_sha. Its timeout goes from 3 to 5 minutes, because it now classifies main's changes, as the detector used to. A timeout routes the whole diff.
Does it save work in the common case?
Mostly not yet, but it no longer overcounts. Replaying #14961 (green head ff7939d5f7, merge ef8c94c28f) routes 15 of its 15 files. Before this PR, the delta routed 40 files, 25 of them main's. Main's 40 files include scripts/ci/ and .github/actions/ edits, which force every area. After a day of main that is typical, so the intersection keeps nearly the whole pull request diff. The saving shows up when main's changes since H1 stay out of the pull request's areas: web-only against app-only, docs, or a merge of a small slice of main. A follow-up could stop main's CI-policy edits from counting as every area here, since those are judged by main's runs too.
Testing
python3 -m unittest tests/test_ci_delta_since_green.py: 34 tests pass. New cases:- files in main's area route (intersect)
- an empty intersection compiles only, or compiles nothing without app code
- uncertain areas on either side keep the whole diff
- a 14-file pull request against a one-file main delta that edits a UI test routes only its 12 app files, never main's file
- the resolution commit routes
- a kept-ours merge routes that file
detector_classifierreads real areas from this repository, and returns None without a router
tests/test_ci_change_areas.pygets three detect-step cases, run against the step script:- the file list is limited to the delta's files, and a file only main changed never routes
- the changed-line diffs are limited the same way
- an empty delta compiles only
- I also ran the six detect-step tests in that file directly (pytest isn't installed locally); all pass.
Changelog
none
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
Summary by cubic
Changes the delta CI step so it routes only the pull request’s own files whose CI areas intersect the areas main changed since the last green head, instead of routing everything main gained. Main’s files are no longer charged to the pull request, fixing the failures caused by main’s cmuxUITests/ edits and removing the size and UI-test skip rules from #14987.
Routing details
- Routes the pull request’s files in areas main touched, plus files the green run never saw (the resolution commit, merge edits to both sides, and kept-ours files).
- With an empty intersection the macOS app still compiles when the pull request has app code.
- If areas can’t be classified, the whole pull request diff routes as before.
ci.ymlnow diffs against the merge base and limits the changed-file list and changed-line diffs to the delta’s files; the delta step outputsfilesandcompile_macosinstead ofbase_sha.