Skip to content

Update JET to 0.12 and run the package analysis in CI - #570

Merged
kshyatt merged 6 commits into
mainfrom
ld-jet-0.12
Oct 16, 2026
Merged

kshyatt merged 6 commits into
mainfrom
ld-jet-0.12

Conversation

@lkdvos

@lkdvos lkdvos commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Replaces #495. Bumps the test compat to JET = "0.9, 0.12" and adds test/other/jet.jl, which runs JET.test_package over TensorKit, plus fixes for what it reports.

This also fixes the current Pkg resolution failures on main: CI's Julia 1 is now 1.13, where only JET 0.12 is installable, and main still caps JET at 0.11.

Commits

  1. JET 0.12 + test group. other/jet only runs where JET.JET_AVAILABLE (Julia 1.12+, JET 0.12); mooncake/tangent is gated separately since it works with any functional JET.
  2. Genuine bugs, all on untested paths:
    • @planar ... order=(...) called an out-of-scope normalizeindex (UndefVarError).
    • _extract_contraction_pairs interpolated an undefined $ex into its error message.
    • linalg.jl threw a nonexistent DimensionError instead of IndexError.
    • the numout/numin fallbacks built MethodError(f, T) instead of MethodError(f, (T,)), so showerror itself threw.
  3. JET-only cleanups, no behavioural change: real sentinels instead of branch-assigned locals (@cached, planar_trace, _construct_braidingtensors!), type annotations where union-widened arguments split onto branches with no method, and _braid!/_transpose!/permute!/braid!/transpose! pass spaces to spacecheck_transform/treebraider/treetransposer, whose tensor-accepting methods are removed.
  4. Reports in code that landed on main since (storagetype-adapted treetransformers #556, Add Enzyme rules for factorizations #464): _recouple! gemm scalars, nothing_or_block restricted to SectorVector-backed Diagonals, a FusionTreeBlock assertion in _fsbraid, and the redundant numind(::AbstractTensorMap) removed.
  5. Drop the schur DefaultAlgorithm forwarding. TensorKit has no schur implementation for tensors, so schur_full/schur_vals already errored; the forwarding only gave JET an unimplemented path to report.

Remaining filter

JET#860: a false positive from Base's @debug expansion inside GenericTreeTransformer. The MatrixAlgebraKit#276 filter is gone; the fix is released.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.31034% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/tensors/abstracttensor.jl 0.00% 2 Missing ⚠️
src/auxiliary/caches.jl 90.00% 1 Missing ⚠️
src/planar/macros.jl 0.00% 1 Missing ⚠️
src/planar/preprocessors.jl 66.66% 1 Missing ⚠️
src/tensors/adjoint.jl 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/auxiliary/iterators.jl 100.00% <100.00%> (ø)
src/fusiontrees/duality_manipulations.jl 97.12% <100.00%> (+0.26%) ⬆️
src/fusiontrees/fusiontrees.jl 96.11% <ø> (+2.77%) ⬆️
src/pullbacks/tensoroperations.jl 100.00% <ø> (+100.00%) ⬆️
src/tensors/indexmanipulations.jl 91.52% <100.00%> (+11.18%) ⬆️
src/tensors/linalg.jl 83.38% <ø> (+15.13%) ⬆️
src/tensors/tensoroperations.jl 96.87% <100.00%> (+8.03%) ⬆️
src/tensors/treetransformers.jl 97.36% <100.00%> (-0.14%) ⬇️
src/auxiliary/caches.jl 88.76% <90.00%> (-0.25%) ⬇️
src/planar/macros.jl 84.94% <0.00%> (+4.30%) ⬆️
... and 3 more

... and 29 files with indirect coverage changes

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

lkdvos and others added 5 commits October 15, 2026 10:56
Mooncake 0.5.45 lifted its `JET = "0.9 - 0.11"` cap, so JET 0.12 is now
resolvable. Add `test/other/jet.jl`, which runs `JET.test_package` over
TensorKit, and gate it in `runtests.jl`.

JET 0.12 only works on Julia 1.12+; on older versions it loads empty stubs and
signals this through `JET_AVAILABLE`. Whole-package analysis is therefore pinned
to the 0.12 generation, so its reports need not be curated for several
JET/Julia combinations. Mooncake's tangent tests reach JET through Mooncake's
extension and work with any functional JET, so they are gated separately.

The `Mooncake = "0.5.45"` floor is load-bearing: with an older Mooncake the
resolver settles on JET 0.11 and the analysis would be silently skipped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Four latent bugs on paths that no test exercises:

- `@planar ... order=(...)` called a bare `normalizeindex`, which is not in
  scope: an outright `UndefVarError`. Nothing tests `order=`.
- `_extract_contraction_pairs` interpolated `$ex` into its error message, but
  the argument is named `rhs`, so constructing the error threw instead.
- `src/tensors/linalg.jl` threw `DimensionError`, which does not exist; the
  intended type is `IndexError`.
- `numout`/`numin`'s fallbacks built `MethodError(f, T)` from a bare type.
  `MethodError`'s second field must be the argument *tuple*, so `showerror`
  itself threw `ErrorException("expected tuple type")` and the intended error
  was never printable. Every other site in the file already uses `(T,)`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
No behavioural changes; each hunk silences a report that JET cannot see through.

Inference cannot narrow a `local` binding that is only assigned inside a branch,
so replace the sentinel-by-undefinedness idiom with real sentinel values:
`@cached`'s `hasparams`/`typed` flags become `nothing` checks on `params`/`typeex`,
`planar_trace`'s `local i, j` becomes `i = j = 0`, and `_construct_braidingtensors!`
tracks `V1`/`V2` as `nothing` rather than via `foundV1`/`foundV2`.

`OneOrNoneIterator`'s default `state = true` is a `Bool`, but a recursive call
passes an `Int`, so `if state` is reported as a non-boolean context; `isone`
accepts both and keeps the `Bool` default.

`fusiontensor` used `TupleTools.prod(d)` on a value inferred as
`Union{Tuple, NamedTuple}`; `reshape(F, :, sz[end])` computes the same leading
dimension without the union split.

The remaining reports came from functions that serve both tensors and spaces
under one name. Julia narrows a slot after a call that would otherwise throw a
`MethodError`, so an untyped argument passed to such a function is refined to
`Union{AbstractTensorMap, TensorMapSpace}` rather than to a tensor, and the next
call splits on a branch that has no method.

`_braid!`/`_transpose!` are fixed structurally rather than by annotation: they
now take `space(tdst)`/`space(tsrc)` once and pass the spaces to both
`spacecheck_transform` and `treebraider`/`treetransposer`, whose tensor-accepting
forwarding methods are therefore removed. `permute!`/`braid!`/`transpose!` likewise
pass spaces to `spacecheck_transform`, so its tensor-accepting method is removed too. `space` has no space-accepting method,
so this narrows the arguments on its own, and the non-dense path now computes two
spaces instead of four.

Where no such restructuring applies, the contract is written down instead:
`_trace_permute!` (matching `add_transform!` next door), the
`UniqueTreeTransformer`/`GenericTreeTransformer` constructors (`::HomSpace`,
their only caller always passes one), `parenttype(::Type{Union{}})`, and the
primal `A` of `trace_permute_pullback_ΔA!`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- `_recouple!`: pass `true`/`false` as gemm scalars so they cannot be union-split independently of `U`'s eltype
- `nothing_or_block`: only accept a `Diagonal` wrapping a `SectorVector`, the only one `block` supports
- `_fsbraid`: assert the `FusionTreeBlock` before the final `repartition`
- drop `numind(::AbstractTensorMap)`, which the generic `numind(x) = numin(x) + numout(x)` already covers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TensorKit has no schur implementation for tensors, so `schur_full`/`schur_vals` already
fail in `select_algorithm`. The forwarding methods only gave JET an unimplemented
`DiagonalAlgorithm` path to report; MatrixAlgebraKit#276 itself has been fixed upstream.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lkdvos
lkdvos enabled auto-merge (squash) October 15, 2026 15:08
@kshyatt

kshyatt commented Oct 16, 2026

Copy link
Copy Markdown
Member

ROCm tests shouldn't be affected by this, I'll force merge

@kshyatt
kshyatt disabled auto-merge October 16, 2026 07:48
@kshyatt
kshyatt merged commit a2add70 into main Oct 16, 2026
99 of 102 checks passed
@kshyatt
kshyatt deleted the ld-jet-0.12 branch October 16, 2026 07:48
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