Skip to content

Fix Core/Downgrade test failures: add using Dates, fix stdout capture#67

Merged
ChrisRackauckas merged 2 commits into
SciML:mainfrom
ChrisRackauckas-Claude:fix-import-timing-tests
Jun 21, 2026
Merged

Fix Core/Downgrade test failures: add using Dates, fix stdout capture#67
ChrisRackauckas merged 2 commits into
SciML:mainfrom
ChrisRackauckas-Claude:fix-import-timing-tests

Conversation

@ChrisRackauckas-Claude

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

Copy link
Copy Markdown
Contributor

Problem

main CI is red on three checks — Core (julia 1), Core (julia lts), and Downgrade.

Core (julia 1 / lts) — fixed by first commit

Two latent bugs surfaced when #63 migrated the suite to SciMLTesting's folder-based run_tests, which isolates each test file in its own @safetestset module:

  1. Missing using Dates. test/import_timing_analysis_tests.jl and test/invalidation_analysis_tests.jl call now() / DateTime(...) but only did using OrgMaintenanceScripts / using Test. Under per-file module isolation those Dates names are no longer in scope, so they threw UndefVarError: now/DateTime not defined.

  2. redirect_stdout(::IOBuffer) is unsupported. The import-timing subprocess script redirected stdout into an IOBuffer (MethodError on 1.10 and 1.12). Now captures into a temp file (an IOStream is a supported redirect_stdout target) and reads it back.

Downgrade — fixed by second commit

With the Core fix in place, Downgrade still failed: it resolves JSON3 to v1.0.0, where JSON3.pretty does not exist (UndefVarError: pretty not defined). write_import_timing_report calls JSON3.pretty, so both its testset and analyze_repo_import_timing (which calls it) errored on Downgrade while passing on Core (newer JSON3). JSON3.pretty was introduced in JSON3 v1.1.0 (src/pretty.jl), so the JSON3 compat floor is raised from "1" to "1.1" — the minimum resolved version now has the function, without capping the upper bound (still allows the current v1.14.x).

Verification (local)

  • Core: Pkg.test() GROUP=Core on Julia 1.10 (lts) and 1.12 ("1"), both exit 0, all eight Core files pass (import_timing 56/56, invalidation 36/36).
  • Downgrade: on Julia 1.10 with JSON3 pinned to the new floor v1.1.0, import_timing_analysis_tests.jl passes 56/56, exit 0, zero errors. Reproduced the original UndefVarError: pretty on v1.0.0 beforehand.

Please ignore until reviewed by @ChrisRackauckas

ChrisRackauckas and others added 2 commits June 19, 2026 05:40
Two latent bugs surfaced after the SciMLTesting folder-based `run_tests`
migration (SciML#63) isolated each test file in its own `@safetestset` module:

- `test/import_timing_analysis_tests.jl` and
  `test/invalidation_analysis_tests.jl` use `now()` / `DateTime(...)` but only
  did `using OrgMaintenanceScripts` / `using Test`. Under the per-file module
  isolation those `Dates` names are no longer in scope, so they threw
  `UndefVarError: now/DateTime not defined`, erroring the Core (julia 1, lts)
  and Downgrade jobs. Add `using Dates` to both test files.

- The import-timing subprocess script redirected stdout into an `IOBuffer`,
  which `redirect_stdout` does not support (`MethodError: no method matching
  (::Base.RedirectStdStream)(::IOBuffer)` on both 1.10 and 1.12). Capture into
  a temp file (an IOStream is supported) and read it back, so the timing
  analysis actually works instead of always falling into the error branch.

Verified locally with `Pkg.test()` GROUP=Core on Julia 1.10 (lts) and 1.12
("1"): all eight Core test files pass (import_timing 56/56, invalidation
36/36), "Testing OrgMaintenanceScripts tests passed", exit 0.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Downgrade job resolves JSON3 to v1.0.0, where `JSON3.pretty` does not
exist (`UndefVarError: pretty not defined`). `write_import_timing_report`
calls `JSON3.pretty`, so both its testset and `analyze_repo_import_timing`
(which calls it) errored on Downgrade while passing on Core (newer JSON3).

`JSON3.pretty` was introduced in JSON3 v1.1.0 (src/pretty.jl). Raising the
compat floor from "1" to "1.1" makes the minimum resolved version one that
has the function, fixing Downgrade without capping the upper bound (still
allows the current v1.14.x).

Verified locally on Julia 1.10 with JSON3 pinned to the floor v1.1.0:
import_timing_analysis_tests.jl passes 56/56, exit 0, zero errors.
Reproduced the original failure on v1.0.0 (UndefVarError) beforehand.

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 21, 2026 11:50
@ChrisRackauckas ChrisRackauckas merged commit cdc6dd6 into SciML:main Jun 21, 2026
10 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