From 0d78de41e22dea027fc1d1172ebf11ceccb605dc Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Fri, 19 Jun 2026 05:40:30 -0400 Subject: [PATCH 1/2] Fix Core/Downgrade test failures: add `using Dates`, fix stdout capture Two latent bugs surfaced after the SciMLTesting folder-based `run_tests` migration (#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 Co-Authored-By: Claude Opus 4.8 (1M context) --- src/import_timing_analysis.jl | 24 ++++++++++++++---------- test/import_timing_analysis_tests.jl | 1 + test/invalidation_analysis_tests.jl | 1 + 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/import_timing_analysis.jl b/src/import_timing_analysis.jl index 3f2dc94..407720a 100644 --- a/src/import_timing_analysis.jl +++ b/src/import_timing_analysis.jl @@ -69,18 +69,22 @@ function analyze_import_timing_in_process(repo_path::String, package_name::Strin # Capture timing data in a structured way timing_data = [] - raw_output = IOBuffer() - - # Redirect stdout to capture the timing output - original_stdout = stdout - redirect_stdout(raw_output) do - # Run with time imports flag - Base.eval(Main, :(using InteractiveUtils)) - Base.eval(Main, :(@time_imports using \$(Symbol("$package_name")))) + + # Redirect stdout to a temporary file to capture the timing output. + # `redirect_stdout` accepts a file IOStream (not an IOBuffer), so we + # write to a temp file and read it back. + timing_capture_file = tempname() + open(timing_capture_file, "w") do capture_io + redirect_stdout(capture_io) do + # Run with time imports flag + Base.eval(Main, :(using InteractiveUtils)) + Base.eval(Main, :(@time_imports using \$(Symbol("$package_name")))) + end end - + # Process the captured output - raw_str = String(take!(raw_output)) + raw_str = read(timing_capture_file, String) + rm(timing_capture_file; force = true) lines = split(raw_str, '\n') for line in lines diff --git a/test/import_timing_analysis_tests.jl b/test/import_timing_analysis_tests.jl index 2612401..cef234c 100644 --- a/test/import_timing_analysis_tests.jl +++ b/test/import_timing_analysis_tests.jl @@ -1,5 +1,6 @@ using OrgMaintenanceScripts using Test +using Dates @testset "Import Timing Analysis Tests" begin # Create a simple test package structure diff --git a/test/invalidation_analysis_tests.jl b/test/invalidation_analysis_tests.jl index 22a5101..e8b1dcd 100644 --- a/test/invalidation_analysis_tests.jl +++ b/test/invalidation_analysis_tests.jl @@ -1,5 +1,6 @@ using OrgMaintenanceScripts using Test +using Dates @testset "Invalidation Analysis Tests" begin # Create a simple test package structure From 11cfe5253dc1371b51c357194766a7d8ffbe23ed Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sat, 20 Jun 2026 08:19:44 -0400 Subject: [PATCH 2/2] Raise JSON3 compat floor to 1.1 for Downgrade green 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 Co-Authored-By: Claude Opus 4.8 (1M context) --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index e41d9fb..6d54661 100644 --- a/Project.toml +++ b/Project.toml @@ -25,7 +25,7 @@ YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6" ExplicitImports = "1" HTTP = "1" JET = "0.9, 0.10, 0.11" -JSON3 = "1" +JSON3 = "1.1" JuliaFormatter = "2" LocalRegistry = "0.5" SafeTestsets = "0.0.1, 0.1, 1"