Skip to content

feat: the CI tests what a pull request changes; labels only add (#405) - #406

Merged
ocots merged 1 commit into
mainfrom
feat/405-ci-scope
Nov 7, 2026
Merged

ocots merged 1 commit into
mainfrom
feat/405-ci-scope

Conversation

@ocots

@ocots ocots commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Written by Claude (Claude Code) at the request of ocots.

Closes #405. Refs #310, #327.

What

tools/ci/scope.py computes environments × problems from the files a pull request changes, and the scope labels only add to it. The rules are read from the repository, not written as a list of paths:

  • the environments are the directories of test/suite/ with a Project.toml, without the opt-in ones (OPT_IN of test/runtests.jl);
  • ext/<M>Models/<p>.jl gives M and comparison for p; another file of ext/<M>Models/ gives M and comparison for every problem;
  • ext/<E>.jl gives the environments whose Project.toml holds every trigger of E ([extensions] of Project.toml);
  • a file of ext/MetaData/ or ext/Descriptions/ named after a problem gives every environment for that problem (now including ext/MetaData/references/<p>.toml, which ran everything before);
  • test/suite/<env>/** gives env;
  • test/common/<f>.jl gives the environments whose tests name <f>, directly or through test/common/; every environment if test/runtests.jl names it (options.jl, run_environment.jl and what it includes);
  • test/cron/**, test/robustness/**, tools/**, docs/** and Markdown outside ext/: core only;
  • anything else, and every fallback of [Tests] Test only the problems a pull request changes #327 (removed or renamed file, unreadable or truncated list, release, push): everything.

Labels: test <M> backend and test comparison add an environment (with the problems of the automatic scope, every problem if it has none: one product, see the comment on #405); test all problems widens to every problem; test everything (new label) runs everything; test convergence unchanged. The job summary has one row per file: its environments, problems and why.

test/README.md (section Continuous integration, with the table of the rules) and the comments of CI.yml are updated. Nothing changes on the Julia side.

Done when (#405)

  • scope.py computes environments × problems with the rules; unit tests for every rule and fallback, on a fixture repository, shown to fail on broken rules (below).
  • Labels add; test everything runs everything (the label itself is to be created on the repository: see below).
  • The job summary shows, for each file, its environments and problems.
  • Shown on recent pull requests (below), instead of on this one (it changes CI.yml, so it runs everything, as the rules say).
  • test/README.md and the comments of CI.yml up to date.

Tests

python3 -m unittest discover -s tools/ci/test -p 'test_*.py'
Ran 47 tests in 4.310s
OK

Three rules broken on purpose (not committed), then restored:

== mutation: no comparison for a modeling
FAIL: test_all_problems_label, test_convergence_label, test_environment_label_adds,
      test_problem_of_a_modeling, test_shared_file_of_a_modeling, test_union, test_narrowed
FAILED (failures=7)
== mutation: no transitive include
FAIL: test_shared_test_file, test_shared_test_file_of_the_dispatcher
FAILED (failures=2)
== mutation: labels restrict
FAIL: test_environment_label_adds, test_environment_label_never_restricts
FAILED (failures=2)

The new script on the files of recent pull requests (status from the API):

PR Files Before Now
#400 (scalarized equivalence) 2 everything comparison
#402 (schemes by features) 6 everything everything (a removed workflow)
#396 (#371) 11 everything everything (a removed test file)
#395 (#377) 96 everything everything (src/)
#380 (references) 40 everything everything (Project.toml)

And on single files of this repository: ext/JuMPModels/beam.jl → JuMP comparison problem=beam; ext/JuMPModels/schemes/build.jl → JuMP comparison; ext/OptimalControlModels.jl → OptimalControl OptimalControlScalarized comparison; test/common/methods.jl → JuMP OptimalControl OptimalControlScalarized; test/common/status.jl → everything; docs/make.jl → core.

To do before merging

  • Create the label test everything on the repository (not done: an action on the repository, waiting for ocots).

No runner label: the CI tooling tests run in the scope job without it, and nothing changes on the Julia side.

Main checkout git status --short: empty before and after.

Conventions: ct-conventions v0.10.0, ct-agents v0.4.0.

🤖 Generated with Claude Code

Each changed file gives environments and problems, read from the repository
(test environments, extension triggers, the includes of test/common/), and the
run is their union. Scope labels add environments instead of restricting the
run; `test everything` runs everything. The job summary shows the decision
file by file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

[CI] Test only what a pull request changes: environments and problems; labels only add

1 participant