Skip to content

Un-break Mooncake DAE initialization observable AD test (fixes #1568) - #1576

Merged
ChrisRackauckas merged 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix/autozygote-wrapper-fixtures
Oct 3, 2026
Merged

ChrisRackauckas merged 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix/autozygote-wrapper-fixtures

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Sep 1, 2026 •

Copy link
Copy Markdown
Member

Ignore this PR until it has been reviewed by @ChrisRackauckas.

This PR's original AutoZygote fixture commit (b980883) was superseded on master by #1587; after merging master, the only net change is the Mooncake DAE fixture below (one file, test-only).

Adoption update: Mooncake DAE @test_broken flipped to @test (Fixes #1568)

This PR was adopted to close #1568. The branch was merged up to origin/master (93c3925e); the original _unwrap_parameter_gradient hunks were superseded on master by #1587 (_unwrap_parameter_cotangent), so the merge keeps master's helper. On top, one new test-only commit flips the stale Mooncake DAE initialization @test_broken to @test and peels the DespecializedParameters.params level with the same one-liner the ODE Mooncake fixture in this file already uses. No src change, no new dependency, no version bump.

Failing before (unmodified master file, Julia 1.12.7, Mooncake 0.5.61, MTK 11.45.3 / MTB 1.77.2, scratch env dev'ing this repo):

DAE Observable function AD |    2      2  46.1s   (separate row: 1 Broken)

i.e. DAE Observable function AD | 2 Pass 1 Broken. A focused probe of the same gradient call shows the gradient itself now succeeds (upstream chalk-lab/Mooncake.jl#1302, shipped in Mooncake 0.5.53) and only the stale accessor fails:

isol.prob.p type: SciMLBase.DespecializedParameters
gradient call succeeded
--- old accessor ---
old accessor failed: FieldError: FieldError(@NamedTuple{params}, :tunable)
--- new accessor ---
nonzero count: 1
only nonzero: 1.0

Passing after (same environment, only the fixture changed):

AutoDiff Observable Functions                | 2  2
AD Observable Functions for Initialization   | 4  4
DAE Observable function AD                   | 4  4
Adjoints with DAE                            | 2  2
NonlinearSolution scalar getindex under AD   | 2  2
Integer time-step indexing under AD          | 1  1

Zero Broken, zero Error across the whole file.

Verification (exact commands; $JOB is the job folder, scratch env copies test/downstream/Project.toml and devs the repo so the repo itself stays clean):

julia +1.12 --project=$JOB/scratch/dsenv -e 'using Pkg; Pkg.develop(path="$JOB/repo"); Pkg.instantiate()'
timeout 3300 julia +1.12 --project=$JOB/scratch/dsenv test/downstream/observables_autodiff.jl
julia +1.12 --project=@runic -e 'using Runic; exit(Runic.main(ARGS))' -- --check test/downstream/observables_autodiff.jl   # pass
typos test/downstream/observables_autodiff.jl   # pass

What was NOT verified: the full GROUP=DownstreamAD suite (only this file was run); GROUP=QA; docs build (test-only change, no public API touched); the Zygote loops in this file (ZYGOTE_BACKENDS is empty on Julia 1.12); GPU paths.

What a reviewer should push back on: whether the merge resolution (dropping this PR's original _unwrap_parameter_gradient in favor of master's _unwrap_parameter_cotangent) is the right call — they cover the same wrapper but master's version keys off prob.p isa DespecializedParameters while the dropped one probed the cotangent shape; and whether the duplicated one-line Mooncake peel should instead become a shared _unwrap_mooncake_parameter_tangent helper with the ODE block.

Fixes #1568. Please ignore this draft until reviewed by @ChrisRackauckas.

Risk assessment

  • Risk: low
  • Blast radius: test-only change to test/downstream/observables_autodiff.jl; no src, API, dependency, or docs impact. Only downstream CI behavior changes (one Broken becomes Pass).
  • Evidence: fail-before (2 Pass 1 Broken + FieldError(@NamedTuple{params}, :tunable) on old accessor) / pass-after (4 Pass, file fully green) shown above, Julia 1.12.7 / Mooncake 0.5.61.
  • Independent review: Claude Code (Opus 5.5) rated it low, high confidence: net diff vs master is test-only (merge commit adds nothing); observables_autodiff.jl is 13 Pass / 1 Broken on master and 15/15 on this branch; with Mooncake pinned to 0.5.52 the new DAE assertion errors with DownstreamAD fails when Mooncake copies tangents for DespecializedParameters #1568's _copy_output TypeError, so it is not vacuous.
  • Not verified / follow-ups: test/downstream/Project.toml allows Mooncake = "0.4, 0.5"; on 0.5.52 all four Mooncake testsets in this file error (also on master) — a 0.5.53 compat floor would be a separate PR. The DAE case could compare against a ForwardDiff reference like the ODE case.
  • Merge: auto-merge candidate once CI shows no regressions — test-only, green targeted suite, no API surface.

🤖 Adopted with opencode 1.18.31 (model: opencode/muse-spark-1.3-contributor-free), transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/SciMLBase.jl/jobs/1568-opencode/log.txt on amdci2.julia.csail.mit.edu

ChrisRackauckas and others added 2 commits September 30, 2026 09:57
Peel the DespecializedParameters params level when reading the Mooncake
parameter tangent, mirroring the ODE initialization fixture above.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: opencode <[email protected]>
Agent-Harness: opencode 1.18.31
Agent-Model: opencode/muse-spark-1.3-contributor-free
Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/SciMLBase.jl/jobs/1568-opencode/log.txt on amdci2.julia.csail.mit.edu
@ChrisRackauckas-Claude ChrisRackauckas-Claude changed the title Update observable AD fixtures for despecialized parameters Un-break Mooncake DAE initialization observable AD test (fixes #1568) Sep 30, 2026
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review October 3, 2026 05:32
@ChrisRackauckas
ChrisRackauckas merged commit 2a05f14 into SciML:master Oct 3, 2026
67 of 73 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.

DownstreamAD fails when Mooncake copies tangents for DespecializedParameters

2 participants