Skip to content

QA: add ExplicitImports checks; declare init/get_expression public - #133

Merged
ChrisRackauckas merged 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:qa-explicitimports
Jun 26, 2026
Merged

ChrisRackauckas merged 3 commits into
SciML:masterfrom
ChrisRackauckas-Claude:qa-explicitimports

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Note

Please ignore until reviewed by @ChrisRackauckas.

Part of the SciML CI/QA-greening campaign. Adds the full approved set of
ExplicitImports.jl checks
to the QA test group and fixes the import-hygiene issues they surface. As a
foundational base library, getting RuntimeGeneratedFunctions' own public-API
declarations right is high-leverage: it lets downstream SciML repos that access
RuntimeGeneratedFunctions.init / RuntimeGeneratedFunctions.get_expression
pass check_all_qualified_accesses_are_public against this package.

Checks wired in (test/qa/qa.jl)

All six, as direct @test ... === nothing calls alongside the existing Aqua block:

  1. check_no_implicit_imports
  2. check_no_stale_explicit_imports
  3. check_all_explicit_imports_via_owners
  4. check_all_qualified_accesses_via_owners
  5. check_all_qualified_accesses_are_public (with a minimal, documented ignore-list)
  6. check_all_explicit_imports_are_public

Violations found (before) and how each was handled

Check Before Resolution
no_implicit_imports 10 implicit names Fixed: using ExprTools, Serialization, SHA → explicit using Dep: name
no_stale_explicit_imports 1 (@opaque) Fixed: removed the unused import Base.Experimental: @opaque
explicit_imports_via_owners 0 already clean
qualified_accesses_via_owners 0 already clean
qualified_accesses_are_public 2 Ignore-listed (see below)
explicit_imports_are_public 1 (@opaque) Fixed by the stale-import removal

Fixed (implicit → explicit)

  • ExprTools: combinedef, splitdef
  • SHA: SHA1_CTX, update!
  • Serialization: AbstractSerializer, deserialize, serialize

Removed stale import

import Base.Experimental: @opaque — the macro is never invoked. closures_to_opaque
constructs the @opaque macrocall expression manually via
Expr(:., Expr(:., :Base, QuoteNode(:Experimental)), QuoteNode(Symbol("@opaque"))),
so the bare import was dead. Removing it also clears the only non-public explicit import.

Declared public (this package's own API)

@static if VERSION >= v"1.11"
    eval(Expr(:public, :init, :get_expression))
end

init and get_expression are documented (README + the @autodocs API page,
both carry docstrings) and relied on by downstreams, but intentionally not
exported so they stay namespaced under RuntimeGeneratedFunctions.. Declaring
them public (guarded for Julia 1.10) makes that intent explicit without
changing the export surface. Verified on 1.12 that Base.ispublic returns
true for both, and a no-op on 1.10.

Ignore-listed (unavoidable, dep hasn't marked public)

check_all_qualified_accesses_are_public(...; ignore = (:deepcopy_internal, :serialize_type))

  • Base.deepcopy_internal — the by-convention extension point overridden to get
    deepcopy(f) === f for RGFs. Not public in Base; no public alternative.
  • Serialization.serialize_type — the standard custom-serialization extension
    point used in the bespoke Serialization.serialize method. Not public in
    Serialization; no public alternative.

Project.toml

Added ExplicitImports to [compat] ("1"), [extras], [targets].test in the
root, and to the QA sub-environment (test/qa/Project.toml). Bumped version
0.5.20 → 0.5.21. No test/Project.toml was created.

Local verification

Both groups pass on Julia lts (1.10) and Julia 1 (1.12):

Test Summary:     | Pass  Total   Time
QA                |   16     16
  Aqua            |   10     10
  ExplicitImports |    6      6

Core group (GROUP=Core) also passes unchanged. Runic clean on the modified files.

🤖 Generated with Claude Code

ChrisRackauckas and others added 2 commits June 24, 2026 09:24
Wire the full set of ExplicitImports checks into the QA test group and fix
the import hygiene they surface:

- Implicit -> explicit: replace `using ExprTools, Serialization, SHA` with
  per-name `using Dep: name` imports (combinedef/splitdef, SHA1_CTX/update!,
  AbstractSerializer/deserialize/serialize).
- Remove stale `import Base.Experimental: @opaque` (the macro is never invoked;
  closures_to_opaque builds the macrocall expr manually). This also clears the
  lone non-public explicit import.
- Declare `init` and `get_expression` public (Julia >= 1.11, guarded) since they
  are documented, downstream-relied-on entry points. High-leverage for the
  fleet: downstream packages qualifying these now pass
  check_all_qualified_accesses_are_public against this library.

The only remaining non-public qualified accesses are `Base.deepcopy_internal`
and `Serialization.serialize_type` -- the documented-by-convention extension
points for customizing deepcopy/serialization. Neither owner marks them public
and there is no public alternative, so they are minimally ignore-listed with a
comment rather than rewritten.

All 6 checks pass locally on Julia lts (1.10) and 1 (1.12).

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the direct Aqua/ExplicitImports calls in test/qa/qa.jl with a single
run_qa(RuntimeGeneratedFunctions; Aqua, ExplicitImports, explicit_imports=true,
ei_kwargs=...) call, the canonical SciMLTesting QA body. The per-check ignore
list for check_all_qualified_accesses_are_public (:deepcopy_internal,
:serialize_type) is carried over verbatim via ei_kwargs. The init/get_expression
public declarations and all other PR fixes are retained.

Bump SciMLTesting [compat] to "1.4" in Project.toml and test/qa/Project.toml,
since run_qa's ExplicitImports support was introduced in SciMLTesting 1.4.0.

Verified locally on Julia 1.10 (lts) and 1.12 (the "1" channel): the QA group
passes 17/17 (all 6 ExplicitImports checks plus Aqua) via run_qa.

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

Copy link
Copy Markdown
Member Author

Canonicalized the QA body to SciMLTesting's run_qa (commit 653ea07).

  • test/qa/qa.jl now calls a single run_qa(RuntimeGeneratedFunctions; Aqua = Aqua, ExplicitImports = ExplicitImports, explicit_imports = true, ei_kwargs = (; all_qualified_accesses_are_public = (; ignore = (:deepcopy_internal, :serialize_type)))) instead of the direct Aqua/ExplicitImports calls. The same per-check ignore-list is carried over verbatim. No JET in this repo, so jet is left at its default false.
  • Bumped SciMLTesting [compat] to "1.4" in Project.toml and test/qa/Project.toml (run_qa's ExplicitImports support landed in SciMLTesting 1.4.0).
  • The init/get_expression public declarations and all prior fixes are retained.

Verified locally on Julia 1.10 (lts) and 1.12 (the 1 channel): QA group passes 17/17 (all 6 ExplicitImports checks + Aqua) via run_qa. Resolved SciMLTesting = 1.4.0 in both. Runic --check clean on qa.jl.

SciMLTesting 1.5.0 makes Aqua and ExplicitImports its own direct dependencies
and auto-detects them in run_qa, so the per-repo QA body no longer threads them
through:

- test/qa/qa.jl: drop the now-auto-detected `Aqua = Aqua` and
  `ExplicitImports = ExplicitImports` module arguments. Keep `explicit_imports =
  true` (the ExplicitImports checks are opt-in as of 1.5, defaulting off) and the
  per-check `ei_kwargs` ignore-list verbatim. Imports collapse to
  `using RuntimeGeneratedFunctions, SciMLTesting, Test`.
- test/qa/Project.toml: drop ExplicitImports (now transitive via SciMLTesting).
  KEEP Aqua as a direct dep: Aqua's `test_ambiguities` runs `detect_ambiguities`
  in a child process that does `using Aqua`, which requires Aqua to be a direct
  dependency of the active QA environment -- a transitive-only Aqua makes that
  subprocess fail with "Package Aqua not found in current path" (verified
  reproducible on Julia 1.10 and 1.11). ExplicitImports has no such subprocess
  and works transitively.
- Project.toml: drop Aqua and ExplicitImports from the root [extras]/[targets]
  test set (the root test target runs neither; QA is the separate test/qa
  sub-env).
- Bump SciMLTesting [compat] to "1.5" in both Project.toml and test/qa/Project.toml.

Verified locally against the released SciMLTesting 1.5.0 (no dev-from-branch):
GROUP=QA `Pkg.test` passes 17/17 on Julia 1.10 (lts) and 1.12 (the "1" channel) --
all six ExplicitImports checks plus Aqua's full test_all.

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 26, 2026 00:38
@ChrisRackauckas
ChrisRackauckas merged commit c6ee351 into SciML:master Jun 26, 2026
16 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