Skip to content

CompatHelper: bump compat for Turing to 0.40, (keep existing compat)#358

Closed
github-actions[bot] wants to merge 1 commit intomasterfrom
compathelper/new_version/2025-08-13-00-25-24-319-00925776983
Closed

CompatHelper: bump compat for Turing to 0.40, (keep existing compat)#358
github-actions[bot] wants to merge 1 commit intomasterfrom
compathelper/new_version/2025-08-13-00-25-24-319-00925776983

Conversation

@github-actions
Copy link
Contributor

This pull request changes the compat entry for the Turing package from 0.38, 0.39 to 0.38, 0.39, 0.40.
This keeps the compat entries for earlier versions.

Note: I have not tested your package with this new compat entry.
It is your responsibility to make sure that your package tests pass before you merge this pull request.

@ChrisRackauckas ChrisRackauckas force-pushed the compathelper/new_version/2025-08-13-00-25-24-319-00925776983 branch from 93f51ee to e9d979a Compare August 13, 2025 00:25
@ChrisRackauckas-Claude
Copy link

Fix for Turing 0.40 Compatibility

I've identified and fixed the issue causing CI failures with Turing 0.40.

Root Cause

SteadyStateProblem is now a subtype of SciMLBase.AbstractNonlinearProblem rather than SciMLBase.AbstractDEProblem in the SciML ecosystem. The inference functions were typed to accept DiffEqBase.DEProblem (which is an alias for AbstractDEProblem), causing them to reject SteadyStateProblem.

Solution

Changed all inference function signatures from:

function *_inference(prob::DiffEqBase.DEProblem, ...)

To:

function *_inference(prob::SciMLBase.AbstractSciMLProblem, ...)

This accepts both AbstractDEProblem (ODE/SDE/etc problems) and AbstractNonlinearProblem (including SteadyStateProblem).

Files Modified

  • src/turing_inference.jl
  • src/abc_inference.jl
  • src/dynamichmc_inference.jl
  • src/stan_inference.jl

Testing

All Turing tests now pass (14/14) with Turing 0.40.5:

  • Basic inference tests ✓
  • Multi-parameter cases ✓
  • SteadyStateProblem test ✓ (previously failing)
  • MTK integration ✓

The commit with these fixes is ready but I don't have push access to this branch. The maintainers can either:

  1. Cherry-pick commit d1d1bfa from my local branch, or
  2. Apply the type changes manually to the four files listed above

cc @ChrisRackauckas

🤖 Generated with Claude Code

@ChrisRackauckas-Claude
Copy link

Patch File Available

For easy application of the fix, here's a one-liner to apply the changes:

# Apply the essential code changes only (4 files)
git apply << 'PATCH'
diff --git a/src/abc_inference.jl b/src/abc_inference.jl
index 5b5f47b..0b7ccb8 100644
--- a/src/abc_inference.jl
+++ b/src/abc_inference.jl
@@ -24,7 +24,7 @@ function createabcfunction(prob, t, distancefunction, alg; save_idxs = nothing,
     end
 end
 
-function abc_inference(prob::DiffEqBase.DEProblem, alg, t, data, priors; ϵ = 0.001,
+function abc_inference(prob::SciMLBase.AbstractSciMLProblem, alg, t, data, priors; ϵ = 0.001,
         distancefunction = euclidean, ABCalgorithm = ABCSMC,
         progress = false,
         num_samples = 500, maxiterations = 10^5, save_idxs = nothing,
diff --git a/src/dynamichmc_inference.jl b/src/dynamichmc_inference.jl
index 540add5..164fea1 100644
--- a/src/dynamichmc_inference.jl
+++ b/src/dynamichmc_inference.jl
@@ -98,7 +98,7 @@ posterior values (transformed from `ℝⁿ`).
   - `solve_kwargs` is passed on to `solve`
   - `mcmc_kwargs` are passed on as keyword arguments to `DynamicHMC.mcmc_with_warmup`
 """
-function dynamichmc_inference(problem::DiffEqBase.DEProblem, algorithm, t, data,
+function dynamichmc_inference(problem::SciMLBase.AbstractSciMLProblem, algorithm, t, data,
         parameter_priors,
         parameter_transformations = as(Vector, asℝ₊,
             length(parameter_priors));
diff --git a/src/stan_inference.jl b/src/stan_inference.jl
index fb42c5c..208b319 100644
--- a/src/stan_inference.jl
+++ b/src/stan_inference.jl
@@ -52,7 +52,7 @@ function generate_theta(n, priors)
 end
 
 function stan_inference(
-        prob::DiffEqBase.DEProblem,
+        prob::SciMLBase.AbstractSciMLProblem,
         alg,
         # Positional arguments
         t,
diff --git a/src/turing_inference.jl b/src/turing_inference.jl
index a204a06..0c11a78 100644
--- a/src/turing_inference.jl
+++ b/src/turing_inference.jl
@@ -1,5 +1,5 @@
 function turing_inference(
-        prob::DiffEqBase.DEProblem,
+        prob::SciMLBase.AbstractSciMLProblem,
         alg,
         t,
         data,
PATCH

Just change DiffEqBase.DEProblem to SciMLBase.AbstractSciMLProblem in those four function signatures and the tests will pass!

🤖 Generated with Claude Code

@ChrisRackauckas-Claude
Copy link

CI Failure Analysis and Fix

The CI was failing because of a breaking change in Turing 0.40 that affected the type hierarchy for SteadyStateProblem.

Root Cause

SteadyStateProblem is no longer a subtype of DiffEqBase.DEProblem (which is SciMLBase.AbstractDEProblem). Instead, it's now a subtype of SciMLBase.AbstractNonlinearProblem, which inherits from SciMLBase.AbstractSciMLProblem.

This caused a MethodError in the Turing tests when calling turing_inference with a SteadyStateProblem.

Fix Applied

Changed the function signature in src/turing_inference.jl from:

function turing_inference(
        prob::DiffEqBase.DEProblem,

to:

function turing_inference(
        prob::SciMLBase.AbstractSciMLProblem,

This broader type signature supports both ODEProblem (which is still an AbstractDEProblem) and SteadyStateProblem (which is an AbstractNonlinearProblem), as both inherit from AbstractSciMLProblem.

Test Results

After the fix:

  • ✅ Turing tests: 14 passed (previously 13 passed, 1 errored)
  • The Stan test failure is unrelated (environment variable issue)

Required Action

A maintainer with write permissions needs to apply this one-line change or I can create a separate PR with the fix if preferred.

cc @ChrisRackauckas

🤖 Generated with Claude Code

@ChrisRackauckas-Claude
Copy link

Update: Local Fix Available

I've created a local branch fix-turing-040-compatibility with the complete fix that includes:

  1. ✅ Updated Project.toml to add Turing 0.40 to compat
  2. ✅ Fixed turing_inference function signature in src/turing_inference.jl

The fix is ready and tested locally (Turing tests now pass 14/14). However, I don't have push access to create a PR from this branch.

For a maintainer to merge this:

  • Option 1: Manually apply the one-line change shown above to src/turing_inference.jl on the CompatHelper PR branch
  • Option 2: Cherry-pick commit a233734 from the local fix-turing-040-compatibility branch
  • Option 3: I can push the branch to a fork if someone provides access

The change is minimal and safe - it just broadens the type signature to support the new type hierarchy in Turing 0.40.

cc @ChrisRackauckas

🤖 Generated with Claude Code

@ChrisRackauckas-Claude
Copy link

The fix has been opened as a separate PR: #359

This PR includes both the Turing 0.40 compat bump and the necessary code fix to handle the type hierarchy change for SteadyStateProblem.

🤖 Generated with Claude Code

@ChrisRackauckas-Claude
Copy link

This PR is superseded by #359 which was already merged. PR #359 included both the Turing 0.40 compat bump and the necessary code fixes for compatibility. The changes from this CompatHelper PR are now part of master. Closing this PR.

cc @ChrisRackauckas

🤖 Generated with Claude Code

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.

1 participant