Alias derivative_discontinuity field to u_modified for SciMLBase v3#101
Draft
ChrisRackauckas-Claude wants to merge 1 commit into
Draft
Conversation
SciMLBase v3 renamed the `u_modified!` API to `derivative_discontinuity!` and its callback machinery now reads and writes the integrator field `derivative_discontinuity` directly (DiffEqBase callbacks.jl initialize!/ finalize!/apply_callback!). `ODEInterfaceIntegrator` only has a `u_modified` field, so callback initialization errored with `type ODEInterfaceIntegrator has no field derivative_discontinuity`. Alias `derivative_discontinuity` to the real `u_modified` field in both `getproperty` and a new `setproperty!`. The aliasing is version-agnostic (works on SciMLBase v2 where `u_modified` is accessed directly and v3 where `derivative_discontinuity` is). `setproperty!` preserves the implicit `convert` to the field type that Julia's default `setproperty!` performs, so non-aliased numeric field assignments still convert correctly. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
On the latest dependency resolution (SciMLBase v3, DiffEqBase that reads the new field name),
Pkg.test()fails in the Callback Tests with:Root cause
SciMLBase v3 renamed the
u_modified!API toderivative_discontinuity!, and DiffEqBase's callback machinery now reads and writes the integrator fieldderivative_discontinuitydirectly (callbacks.jlinitialize!/finalize!/apply_discrete_callback!/apply_callback!all dointegrator.derivative_discontinuityandintegrator.derivative_discontinuity = ...).ODEInterfaceIntegratoronly has au_modifiedfield. The repo already added aderivative_discontinuity!method shim, but that does not help when the callback code touches the field. Thegetpropertyoverride (which already aliases:dt) had no entry for:derivative_discontinuity, and there was nosetproperty!override at all.Fix
Alias
derivative_discontinuityto the realu_modifiedfield in bothgetpropertyand a newsetproperty!. The aliasing is version-agnostic: on SciMLBase v2 the field is accessed asu_modifieddirectly (unaffected), and on v3 thederivative_discontinuityaccesses now map tou_modified. The newsetproperty!preserves the implicitconvert(fieldtype(...), x)that Julia's defaultsetproperty!performs, so the other (numeric) field assignments inhandle_callbacks!/apply_callback!still convert correctly.Only
src/integrator_utils.jlis touched. No changes toProject.tomlor CI config.Testing
Full suite run locally at latest deps (SciMLBase v3.18.0), Julia 1.10:
Before:
After:
Full suite run locally at latest deps: PASS.
🤖 Generated with Claude Code