Skip to content

Fix StochasticDiffEqHighOrder SRACache to extend SciMLBase cache hooks - #4718

Merged
ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix/sde-highorder-cache-extend
Oct 4, 2026
Merged

ChrisRackauckas merged 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:fix/sde-highorder-cache-extend

Conversation

@ChrisRackauckas-Claude

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

Copy link
Copy Markdown
Member

Summary

StochasticDiffEqHighOrder's SRACache defined local u_cache/du_cache/user_cache instead of extending SciMLBase's exported functions. That shadowed the SciMLBase bindings inside HighOrder and caused an umbrella reexport clash / Aqua undefined-exports when StochasticDiffEq @reexports HighOrder alongside DiffEqBase.

This PR imports SciMLBase: u_cache, du_cache, user_cache (SciMLBase is a direct dep and the owner; DiffEqBase only forwards them), so the methods extend the shared functions. It also dedupes a duplicated c.chi2 entry in du_cache(::SRACache).

Not a resize! fix. Nothing in the SDE path calls the cache-level u_cache/du_cache/user_cache hooks; resize! walks full_cache then resize_non_user_cache!. This change does not make resize! reach previously skipped SRACache buffers.

Pre-existing: SRA + resize! is separately broken (H0 stage buffers not resized) — tracked in #4720. Not fixed here.

Verification

cd lib/StochasticDiffEqHighOrder && GROUP=Core julia --project -e 'using Pkg; Pkg.test()'

Before (master src + this test):

Expression: StochasticDiffEqHighOrder.du_cache === SciMLBase.du_cache
MethodError: no method matching du_cache(::StochasticDiffEqHighOrder.SRACache{...})
SRACache SciMLBase cache hooks | Fail/Error (EXIT:1)

After (this branch):

Test Summary:                  | Pass  Total  Time
SRACache SciMLBase cache hooks |    9      9  5.5s
     Testing StochasticDiffEqHighOrder tests passed
EXIT:0

The test keeps only discriminating checks: === SciMLBase and methods exist for SRACache (plus non-empty du_cache / user_cache contents). No resize! assertions.

Not verified

Please ignore this draft until reviewed by @ChrisRackauckas.

Risk assessment

  • Risk: Low. Corrects function identity/export clash; does not change the live resize! code path.
  • Blast radius: lib/StochasticDiffEqHighOrder namespace binding for the three cache accessors; umbrella reexport consistency.
  • Evidence: Core test fails before / passes after (9/9).
  • Independent review: pending
  • Merge: needs review

Harness: Cursor Agent CLI 2026.10.01-14929f9; model: auto; transcript: /home/crackauc/sandbox/goals/qa-hygiene/jobs/sde-qa/log.txt

Risk assessment

  • Risk: low

  • Blast radius: Limited to lib/StochasticDiffEqHighOrder. Three methods on SRACache (u_cache, du_cache, user_cache) now extend SciMLBase's exported functions. Before this PR they were HighOrder-local functions that hid the SciMLBase names. Anyone calling SciMLBase.du_cache(::SRACache) (and the other two) used to get a MethodError and now gets the buffer tuples. No code in the SDE path calls these on a cache: StochasticDiffEqCore's integrator interface only uses full_cache and resize_non_user_cache!, so solver and resize! behavior don't change. Removing the duplicate c.chi2 from du_cache only changes a tuple that nothing reads.

  • Evidence: Four checks fail on head ff56dcb. All four fail with the same error on master 4a5c0e71b3 and e70688847a, so they are pre-existing, not regressions:

    • SciMLSensitivity.jl/Core1 fails with Mooncake MethodError: no constructors have been defined for Any at concrete_solve_derivatives.jl:451.
    • tests / GPU (julia 1) fails with 3 QNDF mass=diag_cu failures at dae_tests.jl:481 (170 passed, 3 failed).
    • downgrade-sublibraries / test (lib/DiffEqBase) fails at high_level_solve.jl:94/98.
    • downgrade-sublibraries / test (lib/OrdinaryDiffEqDifferentiation) errors in "ScalarOperator mass matrix".

    Everything that covers this change passes: StochasticDiffEqHighOrder Core on Julia 1, lts and pre; StochasticDiffEqHighOrder QA; every StochasticDiffEq group including QA and StaticAnalysis; downgrade for StochasticDiffEqHighOrder; Runic, Typos and Docs.

    Other checks:

    • Internals and SemVer: it uses no non-public dependency internals, because u_cache, du_cache and user_cache are exported by SciMLBase, a direct dependency. HighOrder never exported these names, so there's no SemVer impact and no version bump is needed.
    • Tests: none are weakened. One new testset of 9 assertions is added to Core.
    • Not disclosed: the existing SRACache docstrings now attach to SciMLBase's functions, so they will show up in ?SciMLBase.du_cache. The description also says the change fixes an "Aqua undefined-exports" problem, but QA passes on master and the PR shows no failing QA run from before the change. That part of the motivation is unverified, though it doesn't affect the code.
  • Independent review: Devin CLI (Mac) / fusion-claude-opus-5-5-high-sidekick-swe-2-medium rated it low, high confidence: it's an import-only fix that makes the three methods extend the right exported SciMLBase functions, nothing in the solver path calls them on a cache, and every failing CI check fails the same way on master.

  • Merge: auto-merge candidate. The content is fine, but the PR is still a draft whose body says "Please ignore this draft until reviewed by @ChrisRackauckas", so it has to be marked ready first. Its attribution line says model: auto rather than an exact model ID.


🤖 Risk assessment posted by an AI agent (fleet master) — harness: Devin CLI (Mac) / fusion-claude-opus-5-5-high-sidekick-swe-2-medium; dispatched by Devin CLI 3000.11.3 (Mac) fleet-master caretaker, model Fusion (claude-opus-5-5 medium + swe-2 medium)
Conversation: local transcript ~/.local/share/devin/cli/transcripts/speckle-whale.json (Chris's Mac)

SRACache's u_cache/du_cache/user_cache were defining HighOrder-local
functions instead of extending DiffEqBase/SciMLBase, so resize! never
dispatched to them. Import the owner functions like StochasticDiffEqImplicit.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/qa-hygiene/jobs/sde-qa/log.txt on amdci2
Import SciMLBase's u_cache/du_cache/user_cache (owner path), drop the
false resize! rationale and non-discriminating resize assertions, and
dedupe chi2 in SRACache's du_cache.

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: Cursor Agent <[email protected]>
Agent-Harness: Cursor Agent CLI 2026.10.01-14929f9
Agent-Model: auto
Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/qa-hygiene/jobs/sde-qa/log.txt on amdci2
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review October 4, 2026 14:22
@ChrisRackauckas
ChrisRackauckas merged commit 196f878 into SciML:master Oct 4, 2026
141 of 145 checks passed
ChrisRackauckas referenced this pull request Oct 14, 2026
…inaryDiffEqBDF, OrdinaryDiffEqExplicitRK, OrdinaryDiffEqFIRK, OrdinaryDiffEqFeagin, OrdinaryDiffEqHighOrderRK, OrdinaryDiffEqPDIRK, OrdinaryDiffEqRKN, OrdinaryDiffEqSDIRK, StochasticDiffEqHighOrder, StochasticDiffEqLowOrder, and StochasticDiffEqMilstein for release (#4871)

Agent-Harness: Devin CLI 3000.11.3
Agent-Model: Fusion (Claude Opus 5.5 Medium + SWE-2 Medium)
Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/flash-hour.json

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.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.

2 participants