Skip to content

Commit 5aced86

Browse files
QA: run_qa v1.6 form + ExplicitImports
Convert test/qa/qa.jl from the hand-rolled Aqua/JET/ExplicitImports body to SciMLTesting v1.6 run_qa with explicit_imports = true. ExplicitImports findings (all 6 checks now run): - all_qualified_accesses_via_owners: FIXED by extending Base.rand/Base.randn instead of Random.rand/Random.randn (rand/randn are owned by Base; Random only re-exports them). Random.randexp / Random.rng_native_52 / Random.default_rng are genuinely Random-owned and left as-is. - all_qualified_accesses_are_public: ignore default_rng and rng_native_52, both Random stdlib internals (not public in Random): default_rng is the standard default-RNG accessor; rng_native_52 is extended for the PassthroughRNG sampler chain. No way to make a stdlib's own non-public names public. - no_implicit_imports, no_stale_explicit_imports, all_explicit_imports_via_owners, all_explicit_imports_are_public: pass with no changes. No @test_broken markers needed (none existed; 0 hard fails after the above). Deps (test/qa/Project.toml): SciMLTesting compat -> "1.6"; drop ExplicitImports (transitive via SciMLTesting) and Random (qa.jl no longer uses it); keep Aqua (ambiguities child-proc needs it a direct dep), JET (JET runs), SafeTestsets (run_tests @safetestset wrapper needs it loadable in the QA env), Test. Verified locally vs released SciMLTesting 1.6.0 (no dev-from-branch): QA group 18/18 on Julia 1.10 (lts) and 1.12 (release); Core 3/3 on 1.10. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 54cdeee commit 5aced86

3 files changed

Lines changed: 16 additions & 44 deletions

File tree

src/PoissonRandom.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export pois_rand, PassthroughRNG
99
# GPU-compatible Poisson sampling via PassthroughRNG
1010
struct PassthroughRNG <: AbstractRNG end
1111

12-
Random.rand(rng::PassthroughRNG) = rand()
12+
Base.rand(rng::PassthroughRNG) = rand()
1313
Random.randexp(rng::PassthroughRNG) = randexp()
14-
Random.randn(rng::PassthroughRNG) = randn()
14+
Base.randn(rng::PassthroughRNG) = randn()
1515

1616
# When an overlay method table (e.g. CUDA.jl's `@device_override
1717
# Random.randexp(::AbstractRNG)`) shadows the methods above, the overlay body
@@ -20,7 +20,7 @@ Random.randn(rng::PassthroughRNG) = randn()
2020
# `_rand52(r, rng_native_52(r))` → `rand(r, UInt64)`; provide those so the
2121
# chain still reaches bare rand(T) and the device-side default_rng path.
2222
Random.rng_native_52(::PassthroughRNG) = UInt64
23-
Random.rand(rng::PassthroughRNG, ::Type{T}) where {T} = rand(T)
23+
Base.rand(rng::PassthroughRNG, ::Type{T}) where {T} = rand(T)
2424

2525
count_rand::Real) = count_rand(Random.default_rng(), λ)
2626
function count_rand(rng::AbstractRNG, λ::Real)

test/qa/Project.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
[deps]
22
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
3-
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
43
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
54
PoissonRandom = "e409e4f3-bfea-5376-8464-e040bb5c01ab"
6-
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
75
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
86
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
97
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
@@ -13,10 +11,8 @@ PoissonRandom = {path = "../.."}
1311

1412
[compat]
1513
Aqua = "0.8"
16-
ExplicitImports = "1.14.0"
1714
JET = "0.9, 0.10, 0.11"
18-
Random = "1.10"
1915
SafeTestsets = "0.1, 1"
20-
SciMLTesting = "1"
16+
SciMLTesting = "1.6"
2117
Test = "1"
2218
julia = "1.10"

test/qa/qa.jl

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,12 @@
1-
using PoissonRandom, Aqua, JET, ExplicitImports
2-
using Random
3-
using Test
4-
5-
@testset "Aqua" begin
6-
Aqua.find_persistent_tasks_deps(PoissonRandom)
7-
Aqua.test_ambiguities(PoissonRandom, recursive = false)
8-
Aqua.test_deps_compat(PoissonRandom)
9-
Aqua.test_piracies(
10-
PoissonRandom,
11-
treat_as_own = []
12-
)
13-
Aqua.test_project_extras(PoissonRandom)
14-
Aqua.test_stale_deps(PoissonRandom)
15-
Aqua.test_unbound_args(PoissonRandom)
16-
Aqua.test_undefined_exports(PoissonRandom)
17-
end
18-
19-
@testset "JET static analysis" begin
20-
@testset "Type stability" begin
21-
JET.@test_opt target_modules = (PoissonRandom,) pois_rand(10.0)
22-
JET.@test_opt target_modules = (PoissonRandom,) pois_rand(Random.default_rng(), 10.0)
23-
JET.@test_opt target_modules = (PoissonRandom,) pois_rand(PassthroughRNG(), 10.0)
24-
end
25-
26-
@testset "Error analysis" begin
27-
JET.@test_call target_modules = (PoissonRandom,) pois_rand(10.0)
28-
JET.@test_call target_modules = (PoissonRandom,) pois_rand(Random.default_rng(), 10.0)
29-
JET.@test_call target_modules = (PoissonRandom,) pois_rand(PassthroughRNG(), 10.0)
30-
end
31-
end
32-
33-
@testset "ExplicitImports" begin
34-
@test check_no_implicit_imports(PoissonRandom) === nothing
35-
@test check_no_stale_explicit_imports(PoissonRandom) === nothing
36-
end
1+
using SciMLTesting, PoissonRandom, JET, Test
2+
3+
run_qa(
4+
PoissonRandom;
5+
explicit_imports = true,
6+
ei_kwargs = (;
7+
# default_rng / rng_native_52 are Random stdlib internals (not public in
8+
# Random): default_rng is the standard default-RNG accessor; rng_native_52 is
9+
# extended for the PassthroughRNG sampler chain.
10+
all_qualified_accesses_are_public = (; ignore = (:default_rng, :rng_native_52)),
11+
),
12+
)

0 commit comments

Comments
 (0)