Repository navigation
Keep narrowed metadata when remaking a concretized AutoDespecialize function - #1616
Merged
ChrisRackauckas merged 3 commits intoSep 25, 2026
Conversation
…unction `remake` was copying non-concrete field types off the replacement function. Re-concretizing an `AutoDespecialize` problem widens `initialization_data` and `nlstep_data` and passes that widened function back into `remake`, so the remade problem's type no longer matched. DiffEqBase `test/despecialized_p_test.jl` requires `typeof(remade) === typeof(first_prob)`. A concretized `AutoDespecialize` function already stores the narrowed field types, and its callable is a `FunctionWrappersWrapper`. Do not adopt the replacement's widened bounds in that case. A function that is not yet wrapped still picks up erasure from the replacement. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Grok 4.7 <[email protected]> Agent-Harness: grok Agent-Model: grok-4.7 Agent-Session: /home/crackauc/.grok/sessions/%2Fhome%2Fcrackauc%2Fsandbox%2Ffleet-master-jobs%2Fscimlbase-remake/01a0d4bd-2125-72d2-8b5b-a17915e7dfda
…e function The guard looked at the original function, so every erased replacement of a concretized AutoDespecialize function lost its bounds. A widened AutoSpecialize replacement and a widened function that is not yet wrapped both came back narrowed. The skip now requires both the original and the replacement to be already-wrapped AutoDespecialize functions. That is the second concretization. A wrapped replacement of a function that is not yet wrapped still keeps its widened bounds, which is what the first DAE concretization uses so two models share a type. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Grok 4.7 <[email protected]> Agent-Harness: grok Agent-Model: grok-4.7 Agent-Session: /home/crackauc/.grok/sessions/%2Fhome%2Fcrackauc%2Fsandbox%2Ffleet-master-jobs%2Fscimlbase-remake/01a0d4bd-2125-72d2-8b5b-a17915e7dfda
ChrisRackauckas
marked this pull request as ready for review
September 25, 2026 07:22
ChrisRackauckas-Claude
pushed a commit
to ChrisRackauckas-Claude/SciMLBase.jl
that referenced
this pull request
Sep 25, 2026
Pick up 83b4fc3 "Keep narrowed metadata when remaking a concretized AutoDespecialize function (SciML#1616)" — touches src/remake.jl and test/function_building_error_messages.jl, which this branch does not modify; merges cleanly. Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Devin <[email protected]> Agent-Harness: Devin (SWE-2 Max) Agent-Model: SWE-2 Max Agent-Session: /home/crackauc/sandbox/fleet-master-jobs/nw-scimlbase-1092/log.txt
Merged
ChrisRackauckas
referenced
this pull request
Sep 26, 2026
Agent-Harness: Claude Code Agent-Model: claude-opus-5-5[1m] Agent-Session: local Claude Code session 3cd6500a-1f81-46b5-ac0b-c466e15b6a53 on Chris's Mac (session ID, no URL) Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
SebastianM-C
added a commit
to SebastianM-C/OrdinaryDiffEq.jl
that referenced
this pull request
Sep 26, 2026
SciMLBase 3.56.1 (SciML/SciMLBase.jl#1616) makes `remake` keep the narrowed metadata types when a concretized `AutoDespecialize` function is replaced by a re-widened one. That hides a non-idempotent `promote_f` from the problem-level checks, so these now pass without the fix. Also compare the output of the `promote_f` call of `get_concrete_problem` on an already concretized problem directly, for the plain ODE and the SDE cases. The `DynamicalODEFunction` case is left at the problem level: there `promote_f` widens `ID` on every pass and `remake` narrows it back, so its output never matches the concretized function. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
ChrisRackauckas
pushed a commit
to SciML/OrdinaryDiffEq.jl
that referenced
this pull request
Sep 27, 2026
#4599) * Don't re-despecialize an already concretized AutoDespecialize function `promote_f` widens the bounded type parameters of an `AutoDespecialize` function (`_despecialize_auxiliary_functions`) and relies on the `@set`s of the wrapping step to narrow them back. For a function that is already wrapped the wrapping step is skipped, so concretizing a concretized problem returned the widened type (`initialization_data::Union{Nothing, OverrideInitData}`). This was masked because SciMLBase's `constructorof` reset the specialization to the default on every `@set`, so a concretized problem was no longer `AutoDespecialize`. Once the specialization survives (SciML/SciMLBase.jl#1606), `despecialized_p_test.jl` catches it. Skip the auxiliary despecialization for an `f` whose RHS is already wrapped; this works with either SciMLBase. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01JNAfKDURNdkubVjmftigPP * Handle functions without an `f` field and SDEs in `_is_concretized` `_is_concretized` read `f.f`, which `DynamicalODEFunction` (`f1`/`f2`) does not have, so every `AutoDespecialize` `DynamicalODEProblem` threw a `FieldError` when concretized. It also excluded `SDEFunction` outright, so an SDE wrapped by the non-ForwardDiff path was despecialized again on a second concretization, re-widening its `ID` parameter. Treat a function without an `f` field as not wrapped, and an `SDEFunction` as wrapped when both drift and diffusion are, matching the skip condition of the wrapping step. Add an idempotency testset covering a plain `AutoDespecialize` ODE (no jac/tgrad, which the existing test relies on), an SDE on the non-ForwardDiff path and a `DynamicalODEProblem`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01JNAfKDURNdkubVjmftigPP * Qualify `NoRecompileArgumentError` in the ForwardDiff extension `wrapfun_oop` threw `NoRecompileArgumentError(IT)` unqualified, but the error type lives in DiffEqBase, so the unsupported-signature path raised an `UndefVarError` instead of the intended error. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01JNAfKDURNdkubVjmftigPP * Test the unsupported-signature error of the ForwardDiff extension An out-of-place `FunctionWrapperSpecialize` problem with argument types that have no precompiled wrapper signature must raise `NoRecompileArgumentError`. Before the previous commit it raised an `UndefVarError`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Check the idempotency of `promote_f` without `remake` SciMLBase 3.56.1 (SciML/SciMLBase.jl#1616) makes `remake` keep the narrowed metadata types when a concretized `AutoDespecialize` function is replaced by a re-widened one. That hides a non-idempotent `promote_f` from the problem-level checks, so these now pass without the fix. Also compare the output of the `promote_f` call of `get_concrete_problem` on an already concretized problem directly, for the plain ODE and the SDE cases. The `DynamicalODEFunction` case is left at the problem level: there `promote_f` widens `ID` on every pass and `remake` narrows it back, so its output never matches the concretized function. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Harness: grok
Model: grok-4.7
Conversation: /home/crackauc/.grok/sessions/%2Fhome%2Fcrackauc%2Fsandbox%2Ffleet-master-jobs%2Fscimlbase-remake/01a0d4bd-2125-72d2-8b5b-a17915e7dfda
What changed and why
Re-concretizing an
AutoDespecializeproblem changed its type. DiffEqBasepromote_fwidens the bounded metadata parameters (initialization_datatoUnion{Nothing, OverrideInitData},nlstep_datatoUnion{Nothing, ODENLStepData}) and, once the callable is already aFunctionWrappersWrapper, returns that widened function without the narrowing rebuild.remakethen copied those non-concrete parameters onto the result.That path is taken only because
constructorofnow keepsAutoDespecialize(#1606,b7076b57). The DiffEqBase assertiontypeof(remade) === typeof(first_prob)intest/despecialized_p_test.jl:128is the right expectation. The test was not changed.remakerestores type erasure from the original function, and from the replacement whenget_concrete_problempassesf = promoted_f. It skips that restore only when both the original and the replacement are already-wrappedAutoDespecializefunctions. That is a second concretization. A widenedAutoSpecializereplacement, and a widenedAutoDespecializefunction that is not yet wrapped, still keep their erasure. A wrapped replacement of a function that is not yet wrapped also keeps its widened bounds: that is the first DAE concretization, and dropping it makes two models'DAEFunctions differ.Relation to OrdinaryDiffEq#4599
This is a defensive guard. It is redundant with SciML/OrdinaryDiffEq.jl#4599 once that change is released.
#1606 named #4599 (make
promote_fidempotent for an already concretizedAutoDespecializefunction) as the prerequisite, to be released first. #4599 alone also makesdespecialized_p_test.jlpass, by not widening on the second concretization, so thisremakebranch is not reached from DiffEqBase. The two changes are compatible. This PR is not that root-cause fix, and it is not a reason to drop #4599.SciMLBase still needs the guard. A release that contains #1606 has to stay safe for a DiffEqBase that does not yet have #4599, and SciMLBase cannot express that as a DiffEqBase lower bound: the downstream test runs against OrdinaryDiffEq master as it is today.
Verification
Julia 1.12.7 (
julia +1.12). Downstream setup matches.github/workflows/Downstream.yml: OrdinaryDiffEqlib/DiffEqBase, with this SciMLBase checkout developed over it.Before any of this PR,
despecialized_p_test.jl:128failed (14passed,1failed). The only parameter difference was theODEFunctiontail:Union{Nothing, OverrideInitData}, Union{Nothing, ODENLStepData}versusNothing, Nothing.On
b5811b44(guard keyed only on the original function), the new scope testset failed:remade_asis a widenedAutoSpecializereplacement.remade_plainis a widenedAutoDespecializefunction that is not yet wrapped. Both originals were concretizedAutoDespecializefunctions.After
e3be16b2:AutoSpecializefunction, and a not-yet-wrapped original with a wrapped widened replacement).concretized AutoDespecialize remake keeps narrowed metadata types: 7 passed.despecialized_p_test.jl: 15, 3, 3, 26, and 3 passed. The DAE pairtypeof(dae_concrete.f) === typeof(other_dae_concrete.f)is in the 26.runic --checkandtyposon both edited files passed.Keying the skip on the replacement alone was tried and rejected:
despecialized_p_test.jl:178then failed, because the first DAE concretization is itself a wrappedAutoDespecializereplacement and its widenedinitialization_datais what the two models share.Earlier on
b5811b44: DiffEqBaseGROUP=Corepassed (Despecialized-p Hook | 50) and SciMLBaseGROUP=SII_Remakepassed (4605). Those were not re-run aftere3be16b2; the despecialized file and the function-building file were.What I did not verify
Other SciMLBase downstream lanes, docs, and QA.
Project.tomlis still3.56.0, the same version as the registered tag, which does not containb7076b57. A release still needs a version bump; that is not in these commits.Risk assessment
remake(func; f = replacement)where both are already-wrappedAutoDespecializefunctions and the replacement has non-concrete field parameters. Second concretization keeps the narrowed metadata types. A widenedAutoSpecializereplacement, an unwrapped replacement, and a wrapped replacement of a function that is not yet wrapped still adopt erasure. No public name was added.b5811b44(2 passed, 3 failed) and passed aftere3be16b2(6 passed).despecialized_p_test.jlpassed aftere3be16b2, including the ODE re-concretization and the DAE pair. It failed at line 128 before this PR.Please ignore this draft until reviewed by @ChrisRackauckas.
🤖 Generated with grok (model: grok-4.7). Session: /home/crackauc/.grok/sessions/%2Fhome%2Fcrackauc%2Fsandbox%2Ffleet-master-jobs%2Fscimlbase-remake/01a0d4bd-2125-72d2-8b5b-a17915e7dfda
Independent review (Devin CLI / fusion-claude-opus-5-5-high-sidekick-swe-2-medium)
VERDICT: CHANGES
Risk assessment
remake(::AbstractSciMLFunction; f=...). It only changes which type parameters the result gets, not field values. The worst outcome of a wrong guard is lost type erasure, meaning extra compilation, not wrong numbers.remake(func; f = g::AbstractSciMLFunction)wherefuncisAutoDespecializewithfunc.f isa FunctionWrappersWrapperandghas erased params. That includes the problem-levelremake(prob; f = ...)path, and so DiffEqBaseget_concrete_problem. The guard is keyed onfunc, not on the replacementg, so it also fires for replacements that are not the intended "re-promoted concretized function" (see B1).despecialized_p_test.jl:128fails on SciMLBase master and passes with the PR. The new unit test fails on master and passes with the PR. SciMLBaseGROUP=Corepasses with the PR. A probe script shows the guard changes behavior in two cases outside the stated scope.Full review
VERDICT: CHANGES
Review of #1616 (head
b5811b44, base4fa7f7f2), fixing the downstream DiffEqBase regression from #1606 (mergeb7076b57).Risk assessment
remake(::AbstractSciMLFunction; f=...). It only changes which type parameters the result gets, not field values. The worst outcome of a wrong guard is lost type erasure, meaning extra compilation, not wrong numbers.remake(func; f = g::AbstractSciMLFunction)wherefuncisAutoDespecializewithfunc.f isa FunctionWrappersWrapperandghas erased params. That includes the problem-levelremake(prob; f = ...)path, and so DiffEqBaseget_concrete_problem. The guard is keyed onfunc, not on the replacementg, so it also fires for replacements that are not the intended "re-promoted concretized function" (see B1).despecialized_p_test.jl:128fails on SciMLBase master and passes with the PR. The new unit test fails on master and passes with the PR. SciMLBaseGROUP=Corepasses with the PR. A probe script shows the guard changes behavior in two cases outside the stated scope.Blocking findings
B1. The guard checks the wrong object, so it covers more than the intended case. The PR body's scope claim is also false.
_adopt_replacement_type_erasure(func)looks at the original function. The failing case is defined by the replacement: DiffEqBasepromote_freturns an already-wrappedAutoDespecializefunction whose bounded params were widened and never narrowed back. I ranprobe.jlagainst master and the PR. It shows two out-of-scope behavior changes:func= concretized AutoDespecialize,f= widened AutoSpecialize function=== typeof(f)(erasure kept)AutoSpecialize, Nothing, Nothing: erasure droppedfunc= concretized AutoDespecialize,f= widened not-yet-wrapped AutoDespecialize functionresult.fis not an FWW)The PR body and code comment say "A function that is not yet wrapped still picks up erasure from the replacement". Case 4 contradicts that: when the replacement is the unwrapped one, it no longer does. Only an unwrapped func keeps the old behavior. Case 3 drops the compile-cache erasure that
AutoSpecializeexists to provide.Both cases are rare and only cost compilation, but the review criterion is "catches only the intended case", and this does not. The fix is small: key the helper on
forig, since that is where the widened-but-wrapped signature lives. For example:called as
_adopt_replacement_type_erasure(forig). In the target caseforigispromote_f(prob.f)of a concretized problem, soforig.fis the FWW, and cases 3 and 4 fall back to master behavior. Add probe cases 3 and 4, plus case 2 (concretized AutoSpecialize still adopts erasure), as assertions next to the new testset so the scope is actually pinned. Then fix the PR text and code comment to describe the condition that is actually implemented.Non-blocking findings
N1. The relationship to SciML/OrdinaryDiffEq.jl#4599 is not mentioned. The merger needs it. #1606 itself named #4599 (make
promote_fidempotent for concretizedAutoDespecialize) as the prerequisite, to be released first. I ran all four combinations. #4599 alone also fixes the downstream test (SciMLBase master + ODE #4599: pass), and the two fixes are compatible (PR + #4599: pass, including #4599's idempotency testset). With #4599 merged, the PR's branch is unreachable from DiffEqBase.There is still a legitimate case for this PR: it makes a SciMLBase release containing #1606 safe for users on a DiffEqBase without #4599, and SciMLBase cannot force a DiffEqBase lower bound. The PR body should say so explicitly ("defensive guard, redundant with OrdinaryDiffEq#4599 once that's released"), so that nobody later reads it as the root-cause fix and nobody drops #4599.
N2. A useful explanatory comment was deleted. The removed comment said why
forigis checked (get_concrete_problemcallsremake(prob; f = promoted_f), and the promoted function carries erasure the original does not). The replacement comment drops that. Keep one line of it. Also, the PR has 8 comment lines out of 47 added lines (~17%). The test comment "A second concretization widens…" and the helper's two-line comment largely repeat the code and the PR body.N3. Test placement and fragility. The new testset is in
test/function_building_error_messages.jl, a file about constructor error messages. It belongs with the remake tests.typeof(x).parameters[end - 1]/[end]hard-codes the position ofinitialization_data/nlstep_datainODEFunction's parameter list. Adding a field would break the test silently or confusingly.fieldtype(typeof(x), :initialization_data)would be more robust.using FunctionWrappersWrappersinside the testset works (it is a direct dep, and CI Core passed), butSciMLBase.FunctionWrappersWrapperswould avoid depending on it.N4. #1606's intent is preserved. The PR does not touch
constructorof. Probe cases 5–7 show specialization and the concretized type kept throughremake(cA),remake(cA; f = rhs!),remake(prob; u0), and an already-widenedfuncstays widened. #1606's own "rebuilding a function keeps its specialization" testset is inproblem_building_test.jl, and it passed in the localGROUP=Corerun. This is not a revert.N5. No test weakening. The downstream test is unchanged. The only existing lines touched in
src/are the comment block and the added&&clause. The new test's expected values are principled (the narrowed type equals the pre-remake type), not copied from output. It fails before the fix (6 pass / 1 fail) and passes after (7/7).N6. SemVer.
_adopt_replacement_type_erasureis a private helper, and no public API changes, so a patch bump fits.Project.tomlis still3.56.0, equal to the registered tag, so the release needs a bump in a separate commit or PR, as the author notes.N7. PR CI.
b7076b57,9cfd9e6d).205 passed, 2 errored, 5 broken).Base.Callablepublic-access check. That comes from the PR's base4fa7f7f2, and master fixed it in Use the local Callable alias instead of non-public Base.Callable #1608, so a rebase should clear it.Catalyst/All/1fail on master too.post_optimize!(LoopUnroll/MemorySSA) atCore3/default_alg_diff.jl:21, on a defaultAutoSpecializeproblem, where the new guard short-circuits onspecialization(func) === AutoDespecialize. The same crash was reported on OrdinaryDiffEq#4599's CI. It looks flaky, but a re-run should confirm (unverified).What I ran
All on Julia 1.12.7 (
julia +1.12), in/Users/chrisrackauckas/sandbox/fleet-master/jobs/sb-1616.SHAs:
9cfd9e6d, PRb5811b44418f7834, OrdinaryDiffEq#4599 head0d1cfda1lib/DiffEqBase/test/despecialized_p_test.jl, with the SciMLBase worktree and the ODE tree'slib/DiffEqBasedeveloped into one env (log_{A,B,C,D}.txt):Test Failed at .../despecialized_p_test.jl:128 Expression: typeof(remade) === typeof(first_prob),14 passed, 1 failedconcretizing a concretized problem is idempotent | 14log_t2_{master,pr}.txt): master6 pass, 1 failattypeof(remake(concrete; f = widened)) === typeof(concrete); PR7/7.probe.jl(probe_{master,pr}.txt): results in the B1 table and N4.GROUP=Core julia +1.12 --project -e 'using Pkg; Pkg.test()'on the PR worktree (log_core_pr.txt):Testing SciMLBase tests passed, includingFunction Building Error Messages | 409.Callable. Compared them with master IntegrationTest runs 35923456119 and 36085636423, Run Tests 36085636757, and ReleaseTest 36085635882.What I did not verify
GROUP=Corewith the PR (I ran onlydespecialized_p_test.jl; the author reports the full group passes).AutoDespecializevariants through the guard (onlyODEFunctionprobed).Links
Callable): Use the local Callable alias instead of non-public Base.Callable #1608Review by an AI agent (Devin CLI, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium). Local session, no URL published. Nothing was posted to GitHub.
🤖 Posted by an AI agent — orchestrator: Devin Sidekick on behalf of @ChrisRackauckas · reviewer: Devin CLI / fusion-claude-opus-5-5-high-sidekick-swe-2-medium
Conversation: local session; review transcript ~/sandbox/fleet-master/jobs/sb-1616/log.txt on Chris's Mac
Independent re-review at head e3be16b (Devin CLI / fusion-claude-opus-5-5-high-sidekick-swe-2-medium)
VERDICT: MERGE
Risk assessment
&&clause in the erasure-restore tail ofremake(::AbstractSciMLFunction; f = g). It only decides which type parameters the result gets; field values are unchanged. If the guard is wrong, the result is a narrower or wider type, which means extra compilation or a type mismatch, not wrong numbers.remake(func; f = g)wherefuncandgare bothAutoDespecialize, both have.f isa FunctionWrappersWrapper,funcis not type-erased, andgis. In practice that is DiffEqBaseget_concrete_problemon an already-concretizedAutoDespecializeODE/SDE problem. It also covers the rare manual call wheregis an unrelated wrappedAutoDespecializefunction (N1 below).b5811b44and passes one3be16b2. The replacement-only alternative fails both the unit test and downstream:178/:179. SciMLBaseGROUP=Coreand DiffEqBaseGROUP=Corepass with the PR.e3be16b2was still almost entirely pending when I checked. The QA lane will still fail on the stale base until the branch is rebased onto master (see N5).Full review
VERDICT: MERGE
Re-review of #1616 at head
e3be16b2(base4fa7f7f2). It fixes the downstream DiffEqBase regression from #1606 (mergeb7076b57). The round-1 verdict was CHANGES, with blocker B1 and non-blocking N1.Risk assessment
&&clause in the erasure-restore tail ofremake(::AbstractSciMLFunction; f = g). It only decides which type parameters the result gets; field values are unchanged. If the guard is wrong, the result is a narrower or wider type, which means extra compilation or a type mismatch, not wrong numbers.remake(func; f = g)wherefuncandgare bothAutoDespecialize, both have.f isa FunctionWrappersWrapper,funcis not type-erased, andgis. In practice that is DiffEqBaseget_concrete_problemon an already-concretizedAutoDespecializeODE/SDE problem. It also covers the rare manual call wheregis an unrelated wrappedAutoDespecializefunction (N1 below).b5811b44and passes one3be16b2. The replacement-only alternative fails both the unit test and downstream:178/:179. SciMLBaseGROUP=Coreand DiffEqBaseGROUP=Corepass with the PR.e3be16b2was still almost entirely pending when I checked. The QA lane will still fail on the stale base until the branch is rebased onto master (see N5).Blocking findings
None.
Round-1 B1 is resolved. The guard is now
!(_wrapped_autodespecialize(func) && _wrapped_autodespecialize(forig)), so it depends on the replacement as well as the original. Both round-1 out-of-scope cases now match master (probe_r2_{A2,B2}.txt):b5811b44e3be16b2f= widened copy of itself (target case)Nothing, NothingNothing, Nothingf= widened AutoSpecialize=== typeof(wS)f= widened not-yet-wrapped ADf= widened wrapped AD (first-DAE shape)remake(prob; f = wA) === typeof(prob)The new testset
only a wrapped AutoDespecialize replacement skips erasureseparates the candidate guards:b5811b44it fails 3 of 6 assertions (:65,:66,:69:remade_asandremade_plainlose their erasure).e3be16b2it passes 6 of 6.sb-alt) it fails 1 of 6 (:76, the first-DAE shape).The same variant also fails downstream
despecialized_p_test.jl:178and:179(typeof(dae_concrete.f) === typeof(other_dae_concrete.f)). So the author's reason for rejecting that form holds. The conjunction is needed, not a matter of style.Non-blocking findings
N1. One out-of-scope case remains. Probe case 8:
funcis concretized AD forrhs!, andgis a widened, concretized AD function for a differentrhs2!. Master adoptsg's erasure (=== typeof(wA2)). The PR narrows the result toNothing, Nothing. The guard asks "are both wrapped AD?", not "isgthe re-promotedfunc?"Only a manual call reaches this; DiffEqBase does not. The cost is lost erasure, not wrong results. A tighter key would pin the rule to the re-concretization identity:
getfield(func, :f) === getfield(forig, :f). DiffEqBase_despecialize_auxiliary_functionsnever touchesf.f, and probe case 10 showswiden_bounded_type_params(cA).f === cA.f. I have not run that variant. Optional.N2. Round-1 N1 is answered in the body. The section "Relation to OrdinaryDiffEq#4599" calls the PR a defensive guard that becomes redundant once SciML/OrdinaryDiffEq.jl#4599 is released. It says #4599 alone also fixes the test, that the two changes are compatible, and that #4599 should not be dropped. It explains the guard is still needed because SciMLBase cannot require a DiffEqBase lower bound. All of this matches my runs: with #4599 plus this PR (C2),
despecialized_p_test.jlpasses fully, including #4599'sconcretizing a concretized problem is idempotent | 14.N3. #1606's intent is preserved; this is not a revert.
constructorofis untouched. On master and the PR, the specialization and concrete type survive the following remakes (probe cases 5 and 7):remake(cA)remake(cA; f = rhs!)remake(prob; u0)func, which stays widenedSciMLBase
GROUP=Corepasses with the PR. That group includes #1606's rebuild-keeps-specialization testset.N4. No test weakening. The downstream test is unchanged. The expected values are principled:
widen_bounded_type_paramsoutput;None were copied from output. Testset 1 fails on master (
:23, 6 pass / 1 fail) and passes on the PR.N5. Housekeeping:
test/function_building_error_messages.jl(a constructor error-message file) rather than the remake tests. Testset 1 still uses positionaltypeof(x).parameters[end - 1]/[end], even though testset 2 switched tofieldtype(..., :initialization_data).Harness:/Conversation:lines outside the blockquote.4fa7f7f2, behind master9cfd9e6d, which contains the QACallablefix (Use the local Callable alias instead of non-public Base.Callable #1608). A rebase is needed for QA to go green.Project.tomlis still3.56.0. The release needs a patch bump in a separate change. The helpers are private, so a patch bump fits SemVer.What I ran
All on Julia 1.12.7 (
julia +1.12), in/Users/chrisrackauckas/sandbox/fleet-master/jobs/sb-1616. Logs are inr2/.SHAs:
9cfd9e6d; PRe3be16b2; round-1 headb5811b44sb-alt=e3be16b2with_adopt_replacement_type_erasure(func, r) = !_wrapped_autodespecialize(r)(r2/sb-alt.diff)7e9117f0; OrdinaryDiffEq#4599 head0d1cfda1lib/DiffEqBase/test/despecialized_p_test.jl, with a SciMLBase tree developed over DiffEqBase (r2/deb_*.txt):Test Failed at …despecialized_p_test.jl:128 Expression: typeof(remade) === typeof(first_prob),14 pass, 1 failconcretizing a concretized problem is idempotent | 14:178and:179(24 pass, 2 fail)b5811b44+ ODE master: all passr2/new_testsets.jl→r2/unit_*.txt)::23)b5811b44: 7/7 and 3/3 (:65,:66,:69)e3be16b2: 7/7 and 6/6:76)r2/probe_r2.jl(round-1 probe plus cases 8–10), results in the tables above.r2/probe_deb.jl: three chainedget_concrete_problemcalls for these cases, compared on master and the PR:jac, and withinitialization_data. On masterc2 === c1is false in all three; on the PR it is true in all three.initialization_data: stable, and identical on master and the PR.initialization_data: stable on both, with erasure(Any, Union{Nothing, ODENLStepData})kept; under ALT the erasure is lost.GROUP=Coreone3be16b2:Testing SciMLBase tests passed,Function Building Error Messages | 415(r2/core_pr2.txt).GROUP=Corewithe3be16b2developed over ODE master:Testing DiffEqBase tests passed,Despecialized-p Hook | 50(r2/deb_core_pr2.txt).gh pr checks 1616one3be16b2: almost all lanes pending at review time.What I did not verify
e3be16b2: pending when I checked. That includes SciMLSensitivity Core3, where round 1 saw an Enzyme segfault that looked flaky.probe_deb.jl. That row errored because of a bug in my script: it readsnlstep_data, whichSDEFunctiondoes not have. SDE re-concretization is covered bydespecialized_p_test.jl:211–213, which passes on the PR.Links
Callable): Use the local Callable alias instead of non-public Base.Callable #1608e3be16b2: https://github.com/SciML/SciMLBase.jl/actions/runs/36098203769 and https://github.com/SciML/SciMLBase.jl/actions/runs/36098203651Review by an AI agent (Devin CLI, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium). Local session, no URL published. Nothing was posted to GitHub.
🤖 Posted by an AI agent — orchestrator: Devin Sidekick on behalf of @ChrisRackauckas · reviewer: Devin CLI / fusion-claude-opus-5-5-high-sidekick-swe-2-medium
Conversation: local session; review transcript ~/sandbox/fleet-master/jobs/sb-1616/log-r2.txt on Chris's Mac