Make test_abstract_blocktype work with MatrixAlgebraKit 0.6.6#262
Merged
Make test_abstract_blocktype work with MatrixAlgebraKit 0.6.6#262
Conversation
Two related issues surface in `test/test_abstract_blocktype.jl` once
MatrixAlgebraKit 0.6.6 is resolved:
* `@test_broken f(a)` for `f ∈ (svd_full, svd_trunc)` on JLArray-backed
`BlockSparseMatrix{T, AbstractMatrix{T}}` errored with "Expression
evaluated to non-Boolean" because `svd_full` now succeeds and returns
a 3-tuple (it used to throw, which `@test_broken` correctly caught).
* The unconditional `@test c * u ≈ a` in the right-side loop was
flaky on JLArray for `right_orth`, `lq_compact`, `lq_full` — these
produce `c * u != a` in MatrixAlgebraKit 0.6.6 (regression from 0.6.4).
This commit:
* Seeds each `(arrayt, elt)` iteration with `StableRNG(1)` so the
random matrices are deterministic across runs.
* Promotes `svd_full` to a regular `@test` on JLArray (it now produces
a correct factorization).
* Wraps `svd_trunc` in a Boolean-safe `@test ... broken = true` block
so its return value can no longer surface as a non-Boolean error.
* Marks `c * u ≈ a` as broken on JLArray for `right_orth`, `lq_compact`,
`lq_full`, with a comment pointing at the upstream regression.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #262 +/- ##
==========================================
- Coverage 71.99% 71.89% -0.10%
==========================================
Files 36 36
Lines 2032 2032
==========================================
- Hits 1463 1461 -2
- Misses 569 571 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Reference QuantumKitHub/MatrixAlgebraKit.jl#218 from the comment on the broken `c * u ≈ a` assertion so the marker has a paper trail when the upstream fix lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Each independent `a` (or `a, a′`) construction gets its own `rng = StableRNG(1234)` so individual blocks are self-contained and reproducible in isolation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fold each `if arrayt === Array; @test ...; else @test_broken ...; end` pair into a single `@test expr broken = (arrayt ≢ Array && ...)` form so the array-type branching lives in the `broken` argument rather than duplicated control flow. Drop the now-unused `@test_broken` import. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Convert the rest of the `@test_broken` calls in `test_basics.jl` and `test_map.jl` to the `broken = ...` keyword form, fold the surviving `if arrayt === Array; ...; else; @test_broken ...; end` pair in `test_map.jl` into a single `@test ... broken = arrayt ≢ Array`, and drop the now-unused `@test_broken` import from `test_genericblockindex.jl` and `test_tensoralgebraext.jl`. Also gate the LQ regression broken marker in `test_abstract_blocktype.jl` on `pkgversion(MatrixAlgebraKit) < v"0.6.7"` so the marker auto-disables once the upstream LQ gauge-fixing fix lands in MatrixAlgebraKit 0.6.7 (QuantumKitHub/MatrixAlgebraKit.jl#219). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Define the LQ-regression `broken` predicate locally and pass `broken = broken` to `@test`, so the assertion line stays readable without a multi-line `broken = (...)` argument. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two issues surface in
test/test_abstract_blocktype.jlonce MatrixAlgebraKit 0.6.6 is resolved (which can happen on any newPkg.add/Pkg.updateagainst the registered v0.10.39, since itstest/Project.tomlallowsMatrixAlgebraKit = "0.6.0 - 0.6.4, 0.6.6"):@test_broken f(a)forf ∈ (svd_full, svd_trunc)on JLArray-backedBlockSparseMatrix{T, AbstractMatrix{T}}errors withExpression evaluated to non-Booleanbecausesvd_fullnow succeeds and returns a 3-tuple — it used to throw, which@test_brokencorrectly caught.@test c * u ≈ ain the right-side loop is flaky on JLArray forright_orth,lq_compact,lq_full. These factorizations regressed in MatrixAlgebraKit 0.6.5/0.6.6 and producec * u != aon GPU-backed inputs (0.6.4 was correct), tracked upstream at Issue with LQ decomposition of JLMatrix in MatrixAlgebraKit v0.6.6 QuantumKitHub/MatrixAlgebraKit.jl#218. Whether the assertion fails on a given CI run depends on the random matrix.This PR:
(arrayt, elt)iteration withStableRNG(1)so the test is deterministic across runs.svd_fullto a regular@teston JLArray (the math is now correct).svd_truncin a Boolean-safe@test ... broken = trueblock so its return value can no longer surface as a non-Boolean error.c * u ≈ aas broken on JLArray forright_orth,lq_compact,lq_full, with a comment pointing at Issue with LQ decomposition of JLMatrix in MatrixAlgebraKit v0.6.6 QuantumKitHub/MatrixAlgebraKit.jl#218.Test plan
Pkg.test BlockSparseArrayspasses locally with MatrixAlgebraKit 0.6.6 (test_abstract_blocktype.jl: 198 pass + 54 broken = 252).🤖 Generated with Claude Code