Skip to content

Migrate AD backends to a group env (test/AD/Project.toml)#339

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:migrate-ad-group-env
Jul 4, 2026
Merged

Migrate AD backends to a group env (test/AD/Project.toml)#339
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:migrate-ad-group-env

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

Note

Please ignore this PR until it has been reviewed by @ChrisRackauckas. Draft — opened by an automated agent.

What

Move the heavy optional AD backends Mooncake and Zygote (plus the AD-only quadrature helpers FiniteDiff, ForwardDiff) out of the root package's old-style [extras] + [targets].test and into a group-specific test/AD/Project.toml.

Why

Integrals.jl is a hybrid: it uses SciMLTesting folder-model test groups (test/test_groups.toml declares Core/AD/QA; test/runtests.jl is just run_tests()), but the root Project.toml still carries the old-style [extras] + [targets].test listing all test deps, including Mooncake/Zygote.

Because the root has [extras], the Downgrade CI lane resolves the root/test dependencies through the merged [extras] joint graph. Mooncake/Zygote are [weakdeps] that are also test-[extras], so the downgrade harness floor-checks each backend against that root graph. Min-version resolving the optional AD backend trees against the root is the fragile part of the downgrade lane (Resolver.jl --min on the joint optional-backend graph).

Moving the AD backends into their own group env means:

  • The root/Core downgrade no longer floor-resolves the Mooncake/Zygote/ForwardDiff backend graph at all — those names leave [extras], so intersect([weakdeps], [extras]) (the harness's per-backend floor-check set) drops from 13 entries to 10 (Mooncake, Zygote, ForwardDiff gone).
  • The AD backends' downgrade floors are still exercised — now inside test/AD/Project.toml, whose [compat] mirrors the root floors.
  • SciMLTesting folder-discovery auto-activates test/AD/Project.toml for the AD group (_run_group_folderactivate_group_env), developing the root package by path. No runtests.jl change needed.

Changes

  • New test/AD/Project.toml — group env with exactly the deps test/AD/*.jl uses (Integrals, Mooncake, Zygote, FiniteDiff, ForwardDiff, Cuba, Cubature, FastGaussQuadrature, Test, SafeTestsets, SciMLTesting), [sources] Integrals = {path = "../.."}, and [compat] mirroring the root floors (modeled on test/qa/Project.toml).
  • Root Project.toml — drop Mooncake, Zygote, FiniteDiff, ForwardDiff from [extras] and [targets].test. Mooncake/Zygote/ForwardDiff stay [weakdeps] (their [compat] entries stay, since they still gate extensions). FiniteDiff was a pure test dep (never a weakdep), so its now-dangling [compat] entry is removed too.

The cross-backend AD tests (test/AD/derivative_tests.jl, test/AD/nested_ad_tests.jl) are unchanged — they still cross-compare ForwardDiff / FiniteDiff / Zygote / Mooncake in a single environment. test/quadrule_tests.jl's only using Zygote is inside a #= ... =# block comment (a commented-out derivative example), so Core never actually needed Zygote.

Local validation

  • Downgrade (jdc-52 harness, mode=deps, julia=1): master floor-checks 13 weakdep extensions incl. Mooncake/Zygote/ForwardDiff (writes Manifest-Mooncake.toml/-Zygote.toml/-ForwardDiff.toml); this branch floor-checks 10 and produces no Mooncake/Zygote/ForwardDiff manifests. Base Manifest.toml contains none of them. Root downgrade Successfully resolved on both, but the AD joint graph is no longer in the root.
  • AD group env (Julia 1.12): activate test/AD + develop root + instantiate resolves Mooncake 0.5.36, Zygote 0.7.11, ForwardDiff 1.4.1, FiniteDiff 2.31.1; IntegralsMooncakeExt/IntegralsZygoteExt/IntegralsForwardDiffExt precompile.
  • Core group (GROUP=Core, Julia 1.12): all 8 top-level test files pass (1740 assertions), Testing Integrals tests passed, with no Mooncake/Zygote in the env.
  • AD group folder-discovery (Julia 1.10 lts): GROUP=AD auto-activates test/AD/Project.toml, develops Integrals by path, instantiates the AD backends.

🤖 Generated with Claude Code

The heavy optional AD backends (Mooncake, Zygote) were listed in the root
Project.toml old-style [extras] + [targets].test. Because the root has [extras],
the Downgrade CI lane resolves the root/test dependencies through the merged
[extras] joint graph, which drags the Mooncake/Zygote backend trees into the
root's minimum-version resolution. That joint graph is the fragile part of the
downgrade lane (Resolver.jl min-resolving all optional backends together).

Move the AD-only test dependencies into a group-specific test/AD/Project.toml so
the AD tests run in their own sub-environment (SciMLTesting folder-discovery
activates test/AD/Project.toml automatically for the AD group), while the
root/Core downgrade no longer floor-resolves the AD backend graph.

- test/AD/Project.toml: new group env with the exact deps test/AD/*.jl uses
  (Integrals, Mooncake, Zygote, FiniteDiff, ForwardDiff, Cuba, Cubature,
  FastGaussQuadrature, Test, SafeTestsets, SciMLTesting), [sources] Integrals =
  {path = "../.."}, and [compat] mirroring the root floors so downgrade coverage
  of the backends is preserved (now exercised in the AD env, not the root).
- Root Project.toml: drop Mooncake, Zygote, FiniteDiff, ForwardDiff from
  [extras] and [targets].test. Mooncake/Zygote/ForwardDiff remain [weakdeps]
  (their [compat] entries stay). FiniteDiff was a pure test dep (never a
  weakdep), so its now-dangling [compat] entry is removed as well.

The cross-backend AD tests (test/AD/derivative_tests.jl,
test/AD/nested_ad_tests.jl) are unchanged; they still cross-compare
ForwardDiff/FiniteDiff/Zygote/Mooncake in a single environment.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
@ChrisRackauckas ChrisRackauckas marked this pull request as ready for review July 4, 2026 12:00
@ChrisRackauckas ChrisRackauckas merged commit d4a55b2 into SciML:master Jul 4, 2026
10 of 11 checks passed
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.

2 participants