Skip to content

Make DiffEqBase.NAN_CHECK public API - #4093

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:cr/public-nan-check
Aug 2, 2026
Merged

Make DiffEqBase.NAN_CHECK public API#4093
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:cr/public-nan-check

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Ignore until reviewed by @ChrisRackauckas.

DiffEqBase.NAN_CHECK is the hook the integrators use to detect a step that produced NaN and 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 ExplicitImports all_qualified_accesses_are_public QA 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_CHECK to the existing eval(Expr(:public, ...)) list, in the default-callback group.
  • lib/DiffEqBase/src/common_defaults.jl — docstring: supported state types, the Enum carve-out, how to add a method for a custom state type, and the boundary against ODE_DEFAULT_UNSTABLE_CHECK (which is what handles Inf/overflow).
  • docs/src/api/diffeqbase.md — render it in the "Default callback behavior" @docs block, 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.toml7.10.07.11.0. Minor bump: new public API, no behavior change.

Note for downstream: on Julia 1.10 the public declaration is a no-op, so an ExplicitImports run on the LTS will still flag qualified accesses to NAN_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()' in lib/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.
  • Runic 1.7.0 --check --diff on all three changed .jl files — clean.

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>
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 2, 2026 05:04
@ChrisRackauckas
ChrisRackauckas merged commit 86fb530 into SciML:master Aug 2, 2026
237 of 268 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.

2 participants