Skip to content

test: expect sparse dot(x, A, y) to work on Julia versions with LinearAlgebra.jl#1842 - #332

Merged
adrhill merged 1 commit into
dpa/widen-jet-compatfrom
dpa/dot-sparse-version-check
Nov 20, 2026
Merged

adrhill merged 1 commit into
dpa/widen-jet-compatfrom
dpa/dot-sparse-version-check

Conversation

@DilumAluthge

@DilumAluthge DilumAluthge commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Dilum's PR description:

I discovered this while running PkgEval on Julia 1.10.13 vs the upcoming 1.10.14.

These two calls no longer throw an exception, thanks to JuliaLang/LinearAlgebra.jl#1842.

So this PR fixes the tests. Specifically, we no longer expect an exception if we are running with a Julia version that has JuliaLang/LinearAlgebra.jl#1842. If our Julia version doesn't have JuliaLang/LinearAlgebra.jl#1842, then we continue to expect an exception.

🤖 Assisted-by: Claude Code:claude-opus-5-5


🤖 Claude Code PR description: (click to expand)

Before

JuliaLang/LinearAlgebra.jl#1842 (a fix for JuliaLang/LinearAlgebra.jl#1836) removed the if !iszero(yj) check from the generic dot(x, A, y). In test/test_arrays.jl, sx is a SparseVector, so dot(sx, tA, ty) and dot(sx, rA, ty) fall back to that generic method. With the check in place, the iszero call on a tracer without a primal value threw MissingPrimalError, and the tests asserted that. Without the check, both calls succeed, and the two @test_throws MissingPrimalError tests fail. PkgEval found this on the Julia 1.10.14 backports (JuliaLang/julia#64473). It also already happens on the released Julia 1.13.4, so the CI job on 1 will hit it.

Change

Move the two tests into their own JuliaLang/LinearAlgebra.jl#1842 testset, and pick the expected behavior from VERSION:

  • On Julia versions with LinearAlgebra.jl#1842, test that the calls succeed, with @test_nowarn. Those versions are 1.10.14 and later 1.10 patch releases, 1.13.4 and later 1.13 patch releases, and 1.14.0-beta1 and everything after it.
  • On all other versions, keep the @test_throws MissingPrimalError tests.

The lower bounds include prereleases, so -DEV builds such as 1.10.14-DEV, which PkgEval tests, get the new behavior.

After

Not part of this PR: test/Project.toml allows only JET 0.9, 0.10 and 0.11, none of which can be installed on Julia 1.13, so the 1 CI job may fail while resolving the test environment, independently of this change. That is fixed in #333, below this PR in the stack. I checked this change on 1.13 by running test/test_arrays.jl in an environment without JET. I didn't add a CHANGELOG.md entry or bump the version; that's for the maintainers to decide.

The Invalidations check failure is likely unrelated: it fails the same way (2 more invalidations, all via dependencies) on test-only PRs such as #331.

@DilumAluthge
DilumAluthge marked this pull request as ready for review November 20, 2026 02:55
@DilumAluthge
DilumAluthge force-pushed the dpa/dot-sparse-version-check branch from b8e242e to 0ded45f Compare November 20, 2026 02:59
@DilumAluthge

Copy link
Copy Markdown
Member Author

This is ready to review and merge.

@DilumAluthge
DilumAluthge requested a review from adrhill November 20, 2026 03:03
@DilumAluthge
DilumAluthge force-pushed the dpa/dot-sparse-version-check branch from 0ded45f to 7f6f703 Compare November 20, 2026 03:13
@DilumAluthge
DilumAluthge changed the base branch from main to dpa/widen-jet-compat November 20, 2026 03:13
@DilumAluthge
DilumAluthge added this pull request to stack #334 November 20, 2026 03:14
@DilumAluthge
DilumAluthge removed this pull request from stack #334 November 20, 2026 03:18
…earAlgebra.jl#1842

JuliaLang/LinearAlgebra.jl#1842 removed the `iszero(y[j])` check from the generic `dot(x, A, y)`. With a `SparseVector` `x`, `dot(x, A, y)` falls back to that method, and on tracers without primal values the `iszero` call threw `MissingPrimalError`. Without the check, `dot(sx, tA, ty)` and `dot(sx, rA, ty)` now succeed, and the `@test_throws` tests fail.

The change is in Julia 1.10.14, 1.13.4 and 1.14.0-beta1, and will reach master (1.15.0-DEV) with its next LinearAlgebra bump. Move the two tests into their own testset, test them with `@test_nowarn` on those versions (including their -DEV builds) and later, and keep the `@test_throws` tests on older versions.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@DilumAluthge

Copy link
Copy Markdown
Member Author

Also, this PR is at the top of the stack, and CI is all green here.

@adrhill adrhill left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks a lot, I'll trust you on the bounds. :)

@adrhill
adrhill merged commit 13f26ad into main Nov 20, 2026
10 checks passed
@adrhill

adrhill commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Tagged a new v1.2.5 release.

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