Skip to content

Correct derivative discontinuity tstop expectation - #4261

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/investigate-tstops-value
Aug 21, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:agent/investigate-tstops-value

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Ignore this PR until it has been reviewed by @ChrisRackauckas.

What changed and why

Keep exact equality in the fixed-step d_discontinuities test, but calculate the first post-discontinuity time from nextfloat(1 / 2). The active derivative discontinuity advances the integrator one ULP before the following 1 / 3 step, as documented by shift_past_discontinuity!; the previous expression described the no-discontinuity case.

This surfaced after #4258 correctly filtered the stale pre-t0 discontinuity which had blocked the real 1 / 2 entry.

Failing before

On clean current OrdinaryDiffEq master 080fa945ba2a01cb1c3654aa24a56cf97fe4919d, Julia 1.12.6:

GROUP=InterfaceI JULIA_NUM_THREADS=2 julia +1.12 --startup-file=no --project=. -e 'using Pkg; Pkg.test(; coverage=false)'
Expression: sol.t == [0, 1 / 3, 1 / 2, 1 / 3 + 1 / 2, 1]
Evaluated: [0.0, 0.3333333333333333, 0.5, 0.8333333333333335, 1.0] == [0.0, 0.3333333333333333, 0.5, 0.8333333333333333, 1.0]
Test Summary: | Pass Fail Total
Tstops Tests  |   61    1    62

An isolated current/parent source control used the same RK4 solve and printed the exact Float64 bit patterns. Current master produced a two-ULP delta only with d_discontinuities; parent 8c7968fa produced the old exact value because the stale -1 / 2 entry still blocked the active discontinuity.

Passing after

GROUP=InterfaceI JULIA_NUM_THREADS=2 julia +1.12 --startup-file=no --project=. -e 'using Pkg; Pkg.test(; coverage=false)'
Test Summary:                 | Pass Total     Time
Algebraic Interpolation Tests |   52    52  2m29.0s
Test Summary:                           | Pass Total Time
Interpolation and Cache Stripping Tests |   16    16 3.6s
Test Summary:             | Pass Total  Time
Public API Package Splits |   15    15 40.0s
Test Summary:  | Pass Total Time
Aliasing Tests |    1     1 0.2s
Test Summary:           | Pass Total Time
Solution Memory Release |    1     1 0.3s
Testing OrdinaryDiffEq tests passed
GROUP=QA JULIA_NUM_THREADS=2 julia +1.12 --startup-file=no --project=. -e 'using Pkg; Pkg.test(; coverage=false)'
Test Summary:           | Pass Total     Time
Quality Assurance Tests |   90    90  8m25.1s
Testing OrdinaryDiffEq tests passed

Julia Runic --check on the changed file, typos on the changed file, and git diff --check all exited 0.

Not verified

I did not run GROUP=Everything, GPU jobs, or the other Julia-version matrices locally. This test-only change does not touch public API or documentation.

Copy link
Copy Markdown
Member Author

Current-master revalidation update (upstream 3c20997bb9aaf93d5c7bebcdd63810eb63416e6b):

  • The one-line test correction applies cleanly with an exact range-diff.
  • The unchanged current-source RK4 control produces sol.t = [0.0, 0.3333333333333333, 0.5, 0.8333333333333335, 1.0]; the old expectation is false and nextfloat(0.5) + 1/3 is exactly equal.
  • Full GROUP=InterfaceI julia +1.12 --project=. -e 'using Pkg; Pkg.test()' passed after 61m10s. Tstops is 62/62; Algebraic Interpolation 52/52; Interpolation and Cache Stripping 16/16; Public API Package Splits 15/15; Aliasing 1/1; Solution Memory Release 1/1; the package test exits 0.
  • Runic on the changed file, typos over the diff, and git diff --check pass.

Current-master root QA fails two unrelated GlobalDiffEq metadata assertions (41 projects vs 40 and MuladdMacro 0.2.1 vs required 0.2.4). Those exact clean-base failures are fixed and locally validated in #4308. I have not force-updated this branch onto a base whose exact QA tree is red; once that separate fix lands, this branch can be rebased and QA rerun without mixing changes.

Copy link
Copy Markdown
Member Author

The same stale tstop expectation has now reproduced independently in SciMLBase source-triggered downstream CI:

Tstops Tests | 61 pass, 1 fail, 62 total
ode_tstops_tests.jl:21

That matches the local fail-before result already recorded here. The full current-source GROUP=InterfaceI run with this PR's corrected expectation passed all 62 tstop tests and the complete group.

@ChrisRackauckas-Claude
ChrisRackauckas-Claude force-pushed the agent/investigate-tstops-value branch from e4d288b to 1ffc6f2 Compare August 20, 2026 19:06
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review August 21, 2026 19:09
@ChrisRackauckas
ChrisRackauckas merged commit cc67d0e into SciML:master Aug 21, 2026
110 of 128 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