Make DiffEqBase.NAN_CHECK public API - #4093
Merged
ChrisRackauckas merged 1 commit intoAug 2, 2026
Merged
Conversation
NAN_CHECK is the hook the integrators use to detect a step that produced NaN, and downstream state types need a method on it for that detection to reach their elements, so it is already used as public API without being declared one. Declare it public alongside the other default-callback hooks, document it, and render it on the DiffEqBase API page. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.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.
Ignore until reviewed by @ChrisRackauckas.
DiffEqBase.NAN_CHECKis the hook the integrators use to detect a step that producedNaNand reject it, and a custom state type needs a method on it for that detection to reach its elements. It is therefore already relied on as public API without being declared one — downstream packages that qualify it get flagged by the ExplicitImportsall_qualified_accesses_are_publicQA check and have to carry an ignore entry for it.This declares it public alongside the other default-callback hooks it sits with (
ODE_DEFAULT_NORM,ODE_DEFAULT_ISOUTOFDOMAIN,ODE_DEFAULT_PROG_MESSAGE,ODE_DEFAULT_UNSTABLE_CHECK), which were already public, and documents it in the same place.Changes
lib/DiffEqBase/src/DiffEqBase.jl— add:NAN_CHECKto the existingeval(Expr(:public, ...))list, in the default-callback group.lib/DiffEqBase/src/common_defaults.jl— docstring: supported state types, theEnumcarve-out, how to add a method for a custom state type, and the boundary againstODE_DEFAULT_UNSTABLE_CHECK(which is what handlesInf/overflow).docs/src/api/diffeqbase.md— render it in the "Default callback behavior"@docsblock, next to the siblings above. Public and documented ship together.lib/DiffEqBase/test/ode_default_unstable_check.jl—@test Base.ispublic(DiffEqBase, :NAN_CHECK), guarded to 1.11+ where the declaration has an observable effect.lib/DiffEqBase/Project.toml—7.10.0→7.11.0. Minor bump: new public API, no behavior change.Note for downstream: on Julia 1.10 the
publicdeclaration is a no-op, so an ExplicitImports run on the LTS will still flag qualified accesses toNAN_CHECK. Packages whose QA runs on 1.11+ can drop their ignore entry once this is released.Validation
Run locally on Julia 1.12.4:
GROUP=Core julia --project=. -e 'using Pkg; Pkg.test()'inlib/DiffEqBase— passed.ODE default unstable check | 19 19(18 pre-existing plus the new assertion),Testing DiffEqBase tests passed.GROUP=QA— passed.Aqua | 9 9, 0 method ambiguities.--check --diffon all three changed.jlfiles — clean.