Skip to content

fix: update scan propagation for JAX 0.11's num_consts/num_carry removal - #180

Merged
adrhill merged 2 commits into
mainfrom
fix/scan-jax-0.11-num-consts
Aug 7, 2026
Merged

fix: update scan propagation for JAX 0.11's num_consts/num_carry removal#180
adrhill merged 2 commits into
mainfrom
fix/scan-jax-0.11-num-consts

Conversation

@gdalle

@gdalle gdalle commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • JAX 0.11.0 removed the num_consts/num_carry params on the scan eqn in favor of ft_in/ft_out (an FTTuple splitting invars into consts/carry/xs groups), which broke _prop_scan with KeyError: 'num_consts' (21 failing tests in tests/_interpret/test_scan.py).
  • Derive num_consts/num_carry from eqn.params["ft_in"].unpack() instead.
  • Bump the jax floor to >=0.11.0 to match. Since jax>=0.11.0 requires Python >=3.12, also drop Python 3.11 support (requires-python, classifiers, CI matrix).

Test plan

  • uv run pytest — 4002 passed, 1 skipped, 0 failed
  • uv run ruff check . / uv run ruff format --check .
  • uv run ty check

🤖 Generated with Claude Code

gdalle and others added 2 commits July 23, 2026 16:49
JAX 0.11.0 replaced the scan_p eqn params num_consts/num_carry with
ft_in/ft_out (an FTTuple splitting invars into consts/carry/xs groups),
breaking _prop_scan with KeyError: 'num_consts'. Derive the counts from
ft_in.unpack() instead, and bump the jax floor to >=0.11.0 accordingly.
Since jax 0.11.0 requires Python>=3.12, drop Python 3.11 support too.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Comment thread src/asdex/detection/_interpret/_scan.py
Comment thread src/asdex/detection/_interpret/_scan.py
@gdalle

gdalle commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

@adrhill why isn't CI running for this one?

@adrhill

adrhill commented Jul 23, 2026

Copy link
Copy Markdown
Owner

I think because you are not trying to merge into main, but into gd/badge (not sure what that branch is).

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]

@adrhill

adrhill commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Ah, it's the branch from PR #179.

Base automatically changed from gd/badge to main July 23, 2026 16:04
@adrhill

adrhill commented Jul 23, 2026

Copy link
Copy Markdown
Owner

I merged it, I assume a follow-up commit will trigger CI now.

@gdalle gdalle closed this Jul 23, 2026
@gdalle gdalle reopened this Jul 23, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.81%. Comparing base (3209417) to head (d656b4f).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #180      +/-   ##
==========================================
- Coverage   93.81%   93.81%   -0.01%     
==========================================
  Files          61       61              
  Lines        4056     4055       -1     
==========================================
- Hits         3805     3804       -1     
  Misses        251      251              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +49 to +51
num_consts, num_carry, _num_xs = (
len(group) for group in eqn.params["ft_in"].unpack()
)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this opens up new use-cases for scan, we should add tests (or at least open an issue documenting this for a follow-up PR, since it is undocumented).

@adrhill

adrhill commented Jul 24, 2026

Copy link
Copy Markdown
Owner

We will want to tag a patch release for this.

We could also upper bound JAX, but I worry uv might then fall back to the last non-upper-bounded version v0.5.1.

@adrhill

adrhill commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Unlike Julia, the current jax>=0.9.0 doesn't avoid uv from installing v0.10.0 or even 1.0.0: https://packaging.python.org/en/latest/specifications/version-specifiers/#inclusive-ordered-comparison
For Julia-like behavior, we'd need ~=: https://packaging.python.org/en/latest/specifications/version-specifiers/#examples.

Touching on the NumPy version bound you mentioned in #181, I just found this:

Lower bounds are particularly critical when writing a library. It's important to declare the lowest version for each dependency that your library works with, and to validate that the bounds are correct — testing with --resolution lowest or --resolution lowest-direct. Otherwise, a user may receive an old, incompatible version of one of your library's dependencies and the library will fail with an unexpected error.

@adrhill

adrhill commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Is this ready to merge @gdalle?

@gdalle

gdalle commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator Author

Yes, up to you deciding on lower bounds

@adrhill
adrhill merged commit 4516fd2 into main Aug 7, 2026
4 checks passed
@adrhill
adrhill deleted the fix/scan-jax-0.11-num-consts branch August 7, 2026 18:07
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.

3 participants