From 7ed1cb9d36f1d77a9044a858610e22d313c82ab2 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 10 Sep 2026 18:20:18 +0000 Subject: [PATCH] ci(lib-tests): persist every JAX compile in the unit gate (threshold 0) Same knob PyAutoHeart#222 set for the smoke leg, on the libraries' unit gate: lib-tests.yml restores and saves the same JAX compilation cache with no compile-time threshold, so autonerves' setdefault of 1s wins and the restored cache holds almost nothing a unit suite compiles. Export JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS="0" in the Run tests step env, beside JAX_COMPILATION_CACHE_DIR; the command is untouched. Wiring test pins the key. Follow-up named on PyAutoHeart#221. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01NWYEAsAsN5cfuqqBoYTHho --- .github/workflows/lib-tests.yml | 8 ++++++++ tests/test_lib_tests_wiring.py | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/.github/workflows/lib-tests.yml b/.github/workflows/lib-tests.yml index 34b0d75f..ec89e3a7 100644 --- a/.github/workflows/lib-tests.yml +++ b/.github/workflows/lib-tests.yml @@ -326,6 +326,14 @@ jobs: # function cache out of the source trees (where it would be neither # restorable nor saveable) into the one directory those steps cache. JAX_COMPILATION_CACHE_DIR: ${{ github.workspace }}/.pyauto_jax_cache + # Persist EVERY compile, not only those over JAX's 1.0s default + # (autonerves setdefaults the same 1s whenever the cache dir is set; + # a preset value wins). Same reasoning and same knob as the smoke + # leg (PyAutoHeart#221): a unit suite is many small compiles, so + # under the 1s regime the restored cache holds almost nothing and + # every run re-pays them. The price is cache-artefact size; the way + # out is this one line, or an epoch bump to drop the fat caches. + JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS: "0" NUMBA_CACHE_DIR: ${{ github.workspace }}/.numba_cache run: | export JAX_ENABLE_X64=True diff --git a/tests/test_lib_tests_wiring.py b/tests/test_lib_tests_wiring.py index 7c2ae821..dce18efe 100644 --- a/tests/test_lib_tests_wiring.py +++ b/tests/test_lib_tests_wiring.py @@ -253,6 +253,17 @@ def test_the_suite_runs_under_both_cache_dirs_and_is_otherwise_untouched(): assert "--junitxml=test-results/junit.xml" in step["run"] +def test_the_suite_persists_every_compile_it_makes(): + """Same knob as the smoke leg (PyAutoHeart#221): JAX and autonerves only + persist an executable that took over a second to compile, and a unit suite + is many small compiles, so under that default the restored cache held + almost nothing. Exactly "0", not a smaller-but-nonzero value a faster + runner could silently drop a compile under.""" + step = _step(_steps("unittest"), "Run tests") + assert step["env"]["JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS"] == "0" + assert "JAX_COMPILATION_CACHE_DIR" in step["env"] + + def test_the_record_step_runs_on_a_red_run_too_and_writes_the_sidecar(): """A red run's cache state is exactly as interesting as a green one's — and the artifact it rides in is uploaded either way."""