Skip to content

Raise PrecompileTools compat floor to 1.2 to fix Downgrade CI#27

Merged
ChrisRackauckas merged 2 commits into
SciML:mainfrom
ChrisRackauckas-Claude:downgrade-precompiletools-floor
Jun 17, 2026
Merged

Raise PrecompileTools compat floor to 1.2 to fix Downgrade CI#27
ChrisRackauckas merged 2 commits into
SciML:mainfrom
ChrisRackauckas-Claude:downgrade-precompiletools-floor

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

This PR fixes two main CI failures for LightweightStats.jl on the 1 channel (now Julia 1.12) / JET 0.11.

1. Downgrade Tests resolution failure

The Downgrade Tests job on main failed to resolve the test environment:

ERROR: LoadError: Unsatisfiable requirements detected for package ExplicitImports [7d51a73a]:
 ├─restricted to versions 1.14.0-1 by project
 └─restricted by compatibility requirements with PrecompileTools [aea7be01]
   to versions: 1.0.0-1.8.0 or uninstalled — no versions left
     └─restricted to versions 1.0.0 by an explicit requirement

Root cause: ExplicitImports 1.13+ requires PrecompileTools = "1.2.0 - 1", but this package declared PrecompileTools = "1" (floor 1.0.0). The downgrade job pins every [compat] dep to its floor, pinning PrecompileTools to 1.0.0, which forces ExplicitImports <= 1.8.0 — unsatisfiable against the declared ExplicitImports = "1.14.0" floor.

Fix: Raise the compat floor to PrecompileTools = "1.2". PrecompileTools 1.2 supports julia >= 1.6, so the package's julia = "1.10" floor and the @compile_workload usage are unaffected.

2. JET static-analysis failures (JET 0.11 / Julia 1.12)

The JET error analysis, JET analysis with different numeric types, and JET analysis with complex numbers testsets failed with 4 reports, all originating from cov(::Matrix) (and cor(::Matrix), which calls it). Each report bottomed out at the same Julia-1.12 LinearAlgebra inference artifact: broadcasting (.*) over two contiguous matrix-column SubArrays forces broadcast's unaliascopy path through copyto_unaliased! in LinearAlgebra transpose.jl, where inference yields a Union{Adjoint{T,Union{}}, Transpose{T,Union{}}} and JET flags an "invalid builtin getfield". This reproduces in a ~7-line standalone function with no package code (a Julia/LinearAlgebra false positive), but is straightforward to avoid in source.

Fix: Rewrite both cov branches to accumulate each covariance entry with an explicit index loop over the centered values instead of broadcasting over column/row views. This sidesteps the unaliascopy path entirely — JET now reports zero issues for both report_call and report_opt — and also removes the per-pair temporary allocation.

Latent bug also fixed: the result matrix was allocated as zeros(float(real(eltype(X))), p, p) — a real matrix even for complex input. Whenever an off-diagonal covariance was genuinely complex, assigning it into the real array threw InexactError. The result is now zeros(float(eltype(X)), ...), matching Statistics.cov. A regression test for complex covariance matrices was added.

Local verification

Julia 1.12.6 (the 1 channel) full suite, with JET 0.11.4:

LightweightStats.jl |  455    455   (0 fail)   # was 447 pass / 4 fail before the JET fix

All report_call / report_opt entry points from jet_tests.jl return zero reports on 1.12. Julia 1.10.11 floor full suite: 422 pass / 1 pre-existing broken (the gated JET @test_skip), no regressions. Complex cov verified against Statistics.cov for a matrix with genuinely-complex off-diagonals (matches; old code threw InexactError).

Downgrade resolve (Julia 1.10.11): PrecompileTools=1.0.0 fails (unsatisfiable), PrecompileTools=1.2.0 resolves and loads cleanly.

Please ignore until reviewed by @ChrisRackauckas.

ChrisRackauckas and others added 2 commits June 15, 2026 10:23
ExplicitImports 1.13+ (the package's declared test-dep floor is 1.14.0)
requires PrecompileTools "1.2.0 - 1" in the registry. With the previous
PrecompileTools = "1" compat (floor 1.0.0), the Downgrade job pins
PrecompileTools to 1.0.0, which forces ExplicitImports <= 1.8.0 and is
unsatisfiable against the 1.14.0 floor:

    Unsatisfiable requirements detected for package ExplicitImports:
    restricted by compatibility requirements with PrecompileTools to
    versions: 1.0.0-1.8.0 or uninstalled — no versions left

Raising the floor to "1.2" matches what ExplicitImports actually needs.
PrecompileTools 1.2 still supports julia >= 1.6, so the package's
julia = "1.10" floor and its @compile_workload usage are unaffected.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… 1.12

The JET 'error analysis', 'different numeric types', and 'complex numbers'
testsets failed under JET 0.11 / Julia 1.12 with 4 reports, all from
cov(::Matrix) (and cor(::Matrix), which calls it). Each report bottomed
out at the same Julia-1.12 LinearAlgebra inference artifact: broadcasting
(`.*`) over two contiguous matrix-column SubArrays forces broadcast's
`unaliascopy` path through `copyto_unaliased!` in LinearAlgebra
transpose.jl, where inference yields a `Union{Adjoint{T,Union{}},
Transpose{T,Union{}}}` and JET flags an "invalid builtin getfield". This
reproduces in a 7-line standalone function with no package code, so it is
a Julia/LinearAlgebra false positive, but it is straightforward to avoid
in source.

Rewrite both cov branches to accumulate each covariance entry with an
explicit index loop over the centered values instead of broadcasting over
column/row views. This sidesteps the unaliascopy path entirely (JET now
reports zero issues for both report_call and report_opt) and removes the
per-pair temporary allocation.

Also fix a latent correctness bug uncovered while doing this: the result
matrix was allocated as `zeros(float(real(eltype(X))), p, p)` — a real
matrix even for complex input. Whenever an off-diagonal covariance was
genuinely complex, assigning it into the real array threw InexactError.
The result is now `zeros(float(eltype(X)), ...)`, matching Statistics.cov
(verified against Statistics.jl for a complex matrix with complex
off-diagonals). Added a regression test for complex covariance matrices.

Verified locally: full suite passes on Julia 1.12.6 (455/455) and on the
1.10.11 floor (422 pass / 1 pre-existing broken), and all JET report_call
/ report_opt entry points from jet_tests.jl return zero reports on 1.12.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas marked this pull request as ready for review June 17, 2026 10:39
@ChrisRackauckas ChrisRackauckas merged commit d602305 into SciML:main Jun 17, 2026
11 of 14 checks passed
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