From c081f5107f1f83c2792731a08dbe56c09722da8d Mon Sep 17 00:00:00 2001 From: Kim Morrison Date: Thu, 22 Oct 2026 21:25:31 +0000 Subject: [PATCH 1/3] feat: evaluate submissions with toolchain Lake comparator --- .github/workflows/ci.yml | 54 +- EvalTools/CheckComparatorInstallation.lean | 179 ------ EvalTools/CheckEvalWorkflow.lean | 3 +- EvalTools/RunEval.lean | 106 ++-- README.md | 98 +--- SECURITY.md | 548 +++++------------- .../WorkspaceTest.lean | 66 +-- generated/abel_ruffini/WorkspaceTest.lean | 66 +-- generated/adoCharZero/WorkspaceTest.lean | 66 +-- generated/adoIwasawa/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../annals_bose_gases/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../annals_good_lt_codes/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../annals_on_property_t/WorkspaceTest.lean | 66 +-- .../annals_optimal_moebius/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/annals_ulam/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../annals_unit_conjecture/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../anosov_bowen_shadowing/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/baer_suzuki/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/bender_suzuki/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../boone_higman_embedding/WorkspaceTest.lean | 66 +-- .../boone_higman_simple/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/brauer_fowler/WorkspaceTest.lean | 66 +-- .../brauer_splitting_field/WorkspaceTest.lean | 66 +-- generated/brauer_suzuki/WorkspaceTest.lean | 66 +-- .../brouwer_fixed_point/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/bvp_comparison/WorkspaceTest.lean | 66 +-- .../cauchy_kovalevskaya/WorkspaceTest.lean | 66 +-- .../cdt_linearIndependent/WorkspaceTest.lean | 66 +-- generated/cerf_gamma_four/WorkspaceTest.lean | 66 +-- .../chebyshev_sign_change/WorkspaceTest.lean | 66 +-- generated/chen_theorem/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/commProb_closed/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../cubic_decay_asymptotic/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/darboux/WorkspaceTest.lean | 66 +-- .../deBranges_theorem/WorkspaceTest.lean | 66 +-- generated/def_hole_example/WorkspaceTest.lean | 66 +-- generated/dehn_sommerville/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/dimitrov/WorkspaceTest.lean | 66 +-- generated/direct_summand/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/duffin_schaeffer/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../exists_chiral_knot/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/faltings/WorkspaceTest.lean | 66 +-- .../families_of_maps_b01/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/fary_milnor/WorkspaceTest.lean | 66 +-- .../fatou_julia_dichotomy/WorkspaceTest.lean | 66 +-- generated/feit_thompson/WorkspaceTest.lean | 66 +-- .../fermat_last_theorem/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../friedlander_iwaniec/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../furstenberg_measure/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/glauberman_zStar/WorkspaceTest.lean | 66 +-- .../gleason_theorem_finite/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../gorenstein_walter/WorkspaceTest.lean | 66 +-- generated/green_tao/WorkspaceTest.lean | 66 +-- .../hSpace_sphere_iff/WorkspaceTest.lean | 66 +-- generated/hadwiger/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../higman_infinite_simple/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../hippocrates_lunes/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/hopf_rinow/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/hopf_umlaufsatz/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../instance_hole_example/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/jordan_brouwer/WorkspaceTest.lean | 66 +-- generated/jordan_curve/WorkspaceTest.lean | 66 +-- .../jordan_normal_form/WorkspaceTest.lean | 66 +-- .../kakutani_fixed_point/WorkspaceTest.lean | 66 +-- .../kam_invariant_curve/WorkspaceTest.lean | 66 +-- .../kepler_conjecture/WorkspaceTest.lean | 66 +-- .../kirk_normal_structure/WorkspaceTest.lean | 66 +-- generated/klartag_packing/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/koszul_formula/WorkspaceTest.lean | 66 +-- generated/landsberg_schaar/WorkspaceTest.lean | 66 +-- .../lax_approximation/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../lidskii_inequality/WorkspaceTest.lean | 66 +-- generated/lidskii_last/WorkspaceTest.lean | 66 +-- generated/lindemann/WorkspaceTest.lean | 66 +-- .../lindemann_weierstrass/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/linnik/WorkspaceTest.lean | 66 +-- generated/liouville_arnold/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../lp_maximum_principle/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../mandelbrot_connected/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/margulis_ruelle/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/mazur_torsion/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../mergelyan_theorem/WorkspaceTest.lean | 66 +-- generated/mihailescu/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../monge_kantorovich/WorkspaceTest.lean | 66 +-- .../moran_equality_affine/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/morley_theorem/WorkspaceTest.lean | 66 +-- generated/morse_inequality/WorkspaceTest.lean | 66 +-- generated/mostow_rigidity/WorkspaceTest.lean | 66 +-- generated/mountain_pass/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/neukirch_uchida/WorkspaceTest.lean | 66 +-- .../newlander_nirenberg/WorkspaceTest.lean | 66 +-- generated/nikolov_segal/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../novikov_unsolvable/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../oppenheim_inequality/WorkspaceTest.lean | 66 +-- generated/ore_conjecture/WorkspaceTest.lean | 66 +-- .../ornstein_weiss_rokhlin/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/pascal/WorkspaceTest.lean | 66 +-- generated/peano_existence/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../permute_to_unimodal/WorkspaceTest.lean | 66 +-- generated/pesin_formula/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../pi_sphere_infinite_iff/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/pick/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../poincare_3d_smooth/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../poincare_bendixson/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../posSemidef_map_exp/WorkspaceTest.lean | 66 +-- generated/q_tspp/WorkspaceTest.lean | 66 +-- .../rado_riemannSurface/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../ramanujan_petersson/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/regular_value_ae/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../riesz_brothers_theorem/WorkspaceTest.lean | 66 +-- generated/rising_sun_lemma/WorkspaceTest.lean | 66 +-- generated/rokhlin_lemma/WorkspaceTest.lean | 66 +-- .../rouche_zero_count_eq/WorkspaceTest.lean | 66 +-- generated/runge_theorem/WorkspaceTest.lean | 66 +-- generated/sard_theorem/WorkspaceTest.lean | 66 +-- .../schauder_fixed_point/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/schmidt_subspace/WorkspaceTest.lean | 66 +-- generated/schoenflies/WorkspaceTest.lean | 66 +-- .../schreier_conjecture/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/smale_conjecture/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/space_groups_230/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../strong_subadditivity/WorkspaceTest.lean | 66 +-- generated/sturm/WorkspaceTest.lean | 66 +-- generated/sturm_separation/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../symplectic_matrix_det/WorkspaceTest.lean | 66 +-- generated/szemeredi/WorkspaceTest.lean | 66 +-- .../ten_martini_problem/WorkspaceTest.lean | 66 +-- generated/thue_siegel_roth/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../turing_recursive_equiv/WorkspaceTest.lean | 66 +-- generated/tverberg_theorem/WorkspaceTest.lean | 66 +-- .../two_ninety_theorem/WorkspaceTest.lean | 66 +-- generated/two_plus_two/WorkspaceTest.lean | 66 +-- generated/uniformization/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../vinogradov_mean_value/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../wallpaper_groups_17/WorkspaceTest.lean | 66 +-- .../wang_zahl_kakeya_dimH/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- generated/weak_goldbach/WorkspaceTest.lean | 66 +-- .../weak_morse_inequality/WorkspaceTest.lean | 66 +-- generated/weil_conjectures/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../whitney_embedding/WorkspaceTest.lean | 66 +-- .../wieferich_g_three/WorkspaceTest.lean | 66 +-- .../wiener_atom_detection/WorkspaceTest.lean | 66 +-- .../wiener_inverse_closed/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- .../wigner_semicircle/WorkspaceTest.lean | 66 +-- .../WorkspaceTest.lean | 66 +-- scripts/install_bwrap.sh | 55 ++ scripts/sandbox_engaged_probe.py | 378 ++---------- .../security_probes/artifact_tamper_probe.py | 416 +------------ scripts/security_probes/common.py | 70 +++ scripts/security_probes/comparator_probe.py | 74 +++ scripts/security_probes/env_dump_probe.py | 287 +-------- scripts/security_probes/lake_env_probe.py | 2 +- scripts/security_probes/tool_path_probe.py | 4 +- templates/WorkspaceTest.lean | 66 +-- .../CheckComparatorInstallationTest.lean | 43 -- tests/python/test_workspace_tools.py | 255 +++----- 329 files changed, 7545 insertions(+), 15685 deletions(-) create mode 100644 scripts/install_bwrap.sh create mode 100644 scripts/security_probes/common.py create mode 100644 scripts/security_probes/comparator_probe.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec181fa6b..771873099 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -213,51 +213,12 @@ jobs: test: false lint: false - # actions/setup-go pinned to b7ad1dad (= refs/tags/v7.0.0 as of 2026-07-30). - - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e - with: - go-version: '1.25.12' - cache: false - - - name: Install landrun - run: | - # landrun pinned to 5ed4a3db (zouuup/landrun main HEAD as of 2026-05-04). - # Bump procedure: SECURITY.md > "Bumping pinned dependencies". - go install github.com/zouuup/landrun/cmd/landrun@5ed4a3db3a4ad930d577215c6b9abaa19df7f99f - echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH" - - - name: Build lean4export - run: | - set -euo pipefail - git clone https://github.com/leanprover/lean4export.git .ci/lean4export - cd .ci/lean4export - # lean4export pinned to 076e8e57 (= refs/tags/v4.34.0 as of 2026-09-16). - # Bump procedure: SECURITY.md > "Bumping pinned dependencies". - git checkout 076e8e57707e813375e8f9da8bf989799ace9680 # pin-audit: exempt -- SHA, see comment - cp "$GITHUB_WORKSPACE/lean-toolchain" lean-toolchain - lake build lean4export - echo "$PWD/.lake/build/bin" >> "$GITHUB_PATH" - - - name: Build comparator - run: | - git clone https://github.com/leanprover/comparator.git .ci/comparator - cd .ci/comparator - # comparator pinned to d03acab1 (= refs/tags/v4.34.0 as of 2026-09-16). - # Bump procedure: SECURITY.md > "Bumping pinned dependencies". - git checkout d03acab154d269c06e60e4de7e4cc85deebff94b # pin-audit: exempt -- SHA, see comment - lake build comparator - echo "$PWD/.lake/build/bin" >> "$GITHUB_PATH" - - - name: Build nanoda + - name: Install bubblewrap run: | - set -euo pipefail - git clone https://github.com/robsimmons/nanoda_lib.git .ci/nanoda - cd .ci/nanoda - # nanoda pinned to 68d5ca9 (robsimmons/nanoda_lib HEAD as of 2026-07-29). - # Bump procedure: SECURITY.md > "Bumping pinned dependencies". - git checkout 68d5ca9db226849b41a6fff59d796ff19d0a8840 # pin-audit: exempt -- SHA, see comment - cargo build --release - echo "$PWD/target/release" >> "$GITHUB_PATH" + sudo apt-get update + sudo apt-get install --yes meson ninja-build libcap-dev + bwrap_path=$(bash scripts/install_bwrap.sh "$RUNNER_TEMP/lean-eval-bwrap") + echo "COMPARATOR_BWRAP=$bwrap_path" >> "$GITHUB_ENV" # These probes stay in the mandatory path. Parallelization must not # weaken the submission trust boundary. @@ -270,6 +231,11 @@ jobs: - name: Probe trusted comparator tool paths run: python scripts/security_probes/tool_path_probe.py --require-tools + - name: Check comparator verdicts and descendant cleanup + run: | + python scripts/security_probes/comparator_probe.py --require-tools + python scripts/security_probes/artifact_tamper_probe.py --require-tools + - name: Refresh smoke-test workspace run: lake exe lean-eval generate --problem two_plus_two diff --git a/EvalTools/CheckComparatorInstallation.lean b/EvalTools/CheckComparatorInstallation.lean index 5b42a6627..d21734748 100644 --- a/EvalTools/CheckComparatorInstallation.lean +++ b/EvalTools/CheckComparatorInstallation.lean @@ -7,180 +7,6 @@ open LeanEvalGenerator.Core set_option autoImplicit false -structure Semver where - major : Nat - minor : Nat - patch : Nat - deriving Inhabited, BEq, Repr - -namespace Semver - -def lt (a b : Semver) : Bool := - a.major < b.major - || (a.major == b.major && (a.minor < b.minor - || (a.minor == b.minor && a.patch < b.patch))) - -def toString (v : Semver) : String := s!"v{v.major}.{v.minor}.{v.patch}" - -end Semver - -/-- landrun pinned to the same SHA as `.github/workflows/{ci,submission}.yml`. -Bump procedure: see SECURITY.md. -/ -def landrunInstallTarget : String := - "5ed4a3db3a4ad930d577215c6b9abaa19df7f99f" - -def minLandrunVersion : Semver := ⟨0, 1, 14⟩ - -def requiredLandrunFlags : Array String := - #["--best-effort", "--ro", "--rw", "--rox", "--rwx", "--ldd", "--add-exec"] - -structure LandrunInspection where - path : String - helpText : String - versionText : Option String - version : Option Semver - -private def isWordChar (c : Char) : Bool := - c.isDigit || c.isAlpha - -/-- Parse the first `v?MAJOR.MINOR.PATCH` substring out of `text`, mirroring -the Python `re.search(r"\bv?(\d+)\.(\d+)\.(\d+)\b", text)`. -/ -def parseSemver (text : String) : Option Semver := Id.run do - let chars := text.toList - let n := chars.length - let arr := chars.toArray - let isDigit (i : Nat) : Bool := i < n && arr[i]!.isDigit - let readNumber (start : Nat) : Nat × Nat := Id.run do - let mut k := start - while k < n && arr[k]!.isDigit do - k := k + 1 - return (start, k) - let toNum (lo hi : Nat) : Option Nat := - let s := String.ofList (arr.extract lo hi).toList - s.toNat? - let mut i := 0 - while i < n do - -- Optional leading `v`, but require word boundary before any literal char. - if i == 0 || !isWordChar arr[i - 1]! then - let start := if i < n && arr[i]! == 'v' then i + 1 else i - if isDigit start then - let (a0, a1) := readNumber start - if a1 < n && arr[a1]! == '.' && isDigit (a1 + 1) then - let (b0, b1) := readNumber (a1 + 1) - if b1 < n && arr[b1]! == '.' && isDigit (b1 + 1) then - let (c0, c1) := readNumber (b1 + 1) - if c1 == n || !isWordChar arr[c1]! then - match toNum a0 a1, toNum b0 b1, toNum c0 c1 with - | some a, some b, some c => return some ⟨a, b, c⟩ - | _, _, _ => pure () - i := i + 1 - return none - -private def hasSubstr (haystack needle : String) : Bool := - (haystack.find? needle).isSome - -def missingLandrunFlags (helpText : String) : Array String := - requiredLandrunFlags.filter fun flag => !hasSubstr helpText flag - -def landrunInstallAdvice : String := - String.intercalate "\n" [ - "Comparator currently needs a `landrun` build with `--ldd` and `--add-exec` support.", - "Released tags through `v0.1.15` are not enough to reliably satisfy comparator's sandboxing needs.", - "Install or reinstall the project's pinned commit with:", - s!" go install github.com/zouuup/landrun/cmd/landrun@{landrunInstallTarget}", - "Version strings are not sufficient to distinguish landrun commits — upstream main has long reported `0.1.15` even when the SHA differs. The constant `LANDRUN_INSTALL_TARGET` holds the project's pin (kept in lockstep with .github/workflows/{ci,submission}.yml). See SECURITY.md > 'Bumping pinned dependencies'." - ] - -/-- Look up an executable on PATH, returning the resolved absolute path. -/ -def which (name : String) : IO (Option String) := do - let res ← runCmdCaptured "which" #[name] (← IO.currentDir) - if res.exitCode != 0 then return none - let trimmed := res.stdout.trimAscii.toString - if trimmed.isEmpty then return none else return some trimmed - -/-- Run a process with `LC_ALL=C` / `LANG=C`, capture both streams. -/ -def runCaptureC (cmd : String) (args : Array String) : IO ProcessOutput := do - let out ← IO.Process.output { - cmd := cmd - args := args - env := #[("LC_ALL", some "C"), ("LANG", some "C")] - } - return { exitCode := out.exitCode, stdout := out.stdout, stderr := out.stderr } - -private def combined (out : ProcessOutput) : String := - let parts := [out.stdout, out.stderr].filter (! ·.isEmpty) - (String.intercalate "\n" parts).trimAscii.toString - -def inspectLandrun : IO LandrunInspection := do - let path? ← which "landrun" - let path ← - match path? with - | some p => pure p - | none => throw <| IO.userError s!"`landrun` was not found on PATH.\n{landrunInstallAdvice}" - let helpRun ← runCaptureC path #["--help"] - let mut helpText := combined helpRun - if helpText.isEmpty then - let helpRun2 ← runCaptureC path #["-h"] - helpText := combined helpRun2 - let versionRun ← runCaptureC path #["--version"] - let versionText := combined versionRun - let versionText? := if versionText.isEmpty then none else some versionText - return { - path := path - helpText := helpText - versionText := versionText? - version := versionText?.bind parseSemver - } - -def validateLandrun (inspection : LandrunInspection) : Except String Unit := do - let missing := missingLandrunFlags inspection.helpText - if !missing.isEmpty then - let formatted := ", ".intercalate missing.toList - throw s!"`landrun` at {inspection.path} is missing comparator-required flags: {formatted}\n{landrunInstallAdvice}" - match inspection.version with - | some v => - if Semver.lt v minLandrunVersion then - let displayed := inspection.versionText.getD v.toString - throw <| String.intercalate "\n" [ - s!"`landrun` at {inspection.path} is too old: {displayed}", - s!"Comparator needs a `landrun` version at or above {minLandrunVersion.toString}.", - landrunInstallAdvice] - | none => pure () - -def ensureLandrunCompatible : IO LandrunInspection := do - let inspection ← inspectLandrun - match validateLandrun inspection with - | .ok _ => pure inspection - | .error msg => throw <| IO.userError msg - -def probeLandrunWithLeanToolchain (landrunPath : String) : IO Unit := do - let some leanPath ← which "lean" - | throw <| IO.userError "`lean` was not found on PATH while checking comparator prerequisites." - let prefixRun ← runCaptureC leanPath #["--print-prefix"] - let leanPrefix := combined prefixRun - if prefixRun.exitCode != 0 || leanPrefix.isEmpty then - throw <| IO.userError - "Failed to determine the active Lean toolchain prefix with `lean --print-prefix`." - let toolchainLean : System.FilePath := (leanPrefix : System.FilePath) / "bin" / "lean" - let toolchainLeanStr := toolchainLean.toString - unless ← toolchainLean.pathExists do - throw <| IO.userError s!"Lean toolchain binary not found at {toolchainLeanStr}." - let probeArgs : Array String := - #["--best-effort", "--ro", "/", "--rw", "/dev", "--ldd", "--add-exec", - "--rox", leanPrefix, toolchainLeanStr, "--version"] - let probe ← runCaptureC landrunPath probeArgs - if probe.exitCode == 0 then return - let output := - let c := combined probe - if c.isEmpty then "(no output)" else c - let cmdline := s!"{landrunPath} {" ".intercalate probeArgs.toList}" - throw <| IO.userError <| String.intercalate "\n" [ - "`landrun` failed a Lean toolchain execution probe.", - "Comparator needs `landrun --ldd --add-exec` to execute Lean's dynamically linked toolchain binaries inside the sandbox.", - "Tagged `landrun` builds such as `v0.1.15` can fail here because they miss newer ELF dependency handling present on upstream `main`.", - s!"Probe command: {cmdline}", - s!"Probe output:\n{output}", - landrunInstallAdvice] /-- Replace the first ` sorry\n` in `Submission.lean` with ` norm_num\n`. This is the maintainer-controlled "happy-path" solution for the @@ -201,11 +27,6 @@ def solveTwoPlusTwo (workspace : System.FilePath) : IO Unit := do /-- Run an end-to-end comparator check against the `two_plus_two` workspace. -/ def runCheckComparatorInstallation (root : System.FilePath) : IO UInt32 := do try - let landrun ← ensureLandrunCompatible - probeLandrunWithLeanToolchain landrun.path - match landrun.version with - | some v => IO.println s!"Using landrun {v.toString} from {landrun.path}." - | none => IO.println s!"Using landrun at {landrun.path}." let source := root / "generated" / "two_plus_two" unless ← source.isDir do IO.eprintln s!"Missing generated workspace: {source}" diff --git a/EvalTools/CheckEvalWorkflow.lean b/EvalTools/CheckEvalWorkflow.lean index aa8e8edfb..7a842d648 100644 --- a/EvalTools/CheckEvalWorkflow.lean +++ b/EvalTools/CheckEvalWorkflow.lean @@ -61,7 +61,8 @@ private def reuseRootPackages (root workspace : System.FilePath) : IO Unit := do let workspaceLake := workspace / ".lake" IO.FS.createDirAll workspaceLake let packagesLink := workspaceLake / "packages" - let _ ← runCmdCheckedCaptured "ln" #["-s", rootPackages.toString, packagesLink.toString] + let packages ← IO.FS.realPath rootPackages + let _ ← runCmdCheckedCaptured "ln" #["-s", packages.toString, packagesLink.toString] root "Failed to share the root Lake package cache with the eval workspace" IO.FS.writeFile (workspace / "lake-manifest.json") (← IO.FS.readFile rootManifest) diff --git a/EvalTools/RunEval.lean b/EvalTools/RunEval.lean index b98700bdb..bbc0030fc 100644 --- a/EvalTools/RunEval.lean +++ b/EvalTools/RunEval.lean @@ -52,12 +52,14 @@ def workspacePathForProblem (root : System.FilePath) (problemId : String) JSON-mode callers can keep their stdout clean. Mirrors `run_problem_test`. Streams each chunk as it arrives so noisy / hanging child output doesn't accumulate unbounded memory before the child exits. -/ -def runProblemTest (workspace : System.FilePath) : IO UInt32 := do +def runProblemTest (workspace : System.FilePath) + (env : Array (String × Option String) := #[]) : IO UInt32 := do let stderr ← IO.getStderr let child ← IO.Process.spawn { cmd := "lake" args := #["test"] cwd := workspace + env stdin := .inherit stdout := .piped stderr := .piped @@ -77,43 +79,77 @@ def runProblemTest (workspace : System.FilePath) : IO UInt32 := do let _ ← IO.wait errForward return exitCode +/-- Resolve preparation tools before any submitted code runs. -/ +private def resolveExecutable (name : String) : IO System.FilePath := do + if name.contains System.FilePath.pathSeparator then + return ← IO.FS.realPath name + for dir in System.SearchPath.parse ((← IO.getEnv "PATH").getD "") do + let candidate := dir / name + if ← candidate.pathExists then + return ← IO.FS.realPath candidate + throw <| IO.userError s!"Missing evaluation tool: {name}" + +/-- Make the trusted shared cache visible after Lake covers home and /tmp. +The wrapper runs with an empty environment, so all paths are embedded. -/ +private def withCacheSandbox {α : Type} (root : System.FilePath) + (f : Array (String × Option String) → IO α) : IO α := do + let cache ← IO.FS.realPath (root / ".lake" / "packages") + let bwrap ← resolveExecutable ((← IO.getEnv "COMPARATOR_BWRAP").getD "bwrap") + let python ← resolveExecutable "python3" + IO.FS.withTempDir fun tmp => do + let wrapper := tmp / "bwrap-with-cache" + let quoted (path : System.FilePath) := (toJson path.toString).compress + IO.FS.writeFile wrapper <| + s!"#!{python}\nimport os, sys\n" ++ + "args = sys.argv[1:]\ni = args.index('--')\n" ++ + s!"cache = {quoted cache}\nreal = {quoted bwrap}\n" ++ + "os.execv(real, [real, *args[:i], '--ro-bind', cache, cache, *args[i:]])\n" + IO.setAccessRights wrapper { user := { read := true, write := true, execution := true } } + f #[("COMPARATOR_BWRAP", some wrapper.toString)] + /-- Score every problem in `problems`. Mirrors `score_problems`. -/ def scoreProblems (root : System.FilePath) (problems : Array EvalProblemMetadata) (workspacesRoot : System.FilePath) : IO (Array ProblemScore) := do - let toolchain ← IO.FS.readFile (root / "lean-toolchain") - let deps ← loadRootDependencies root - let workspaceTest ← loadWorkspaceTestTemplate root - let mut scores : Array ProblemScore := #[] - for entry in problems do - let mut extracteds : Array ExtractedTheorem := #[] - for hole in entry.holes do - let e ← extractOne root entry hole - extracteds := extracteds.push e - let expectedFiles ← renderWorkspace root entry extracteds toolchain deps workspaceTest - let workspace ← workspacePathForProblem root entry.id workspacesRoot - let relDisplay := - let wsStr := workspace.toString - let rootStr := root.toString ++ "/" - if wsStr.startsWith rootStr then wsStr.drop rootStr.length |>.toString else wsStr - let mismatches ← checkWorkspace workspace relDisplay expectedFiles - let attempted := !mismatches.isEmpty - let (exitCode?, succeeded) ← - if attempted then - let code ← runProblemTest workspace - pure (some code, code == 0) - else - pure (none, false) - scores := scores.push { - id := entry.id - title := entry.title - visible := entry.visible - attempted := attempted - succeeded := succeeded - exitCode := exitCode? - mismatches := mismatches - workspacePath := relDisplay - } - return scores + withCacheSandbox root fun env => do + score env +where + score (env : Array (String × Option String)) : IO (Array ProblemScore) := do + let toolchain ← IO.FS.readFile (root / "lean-toolchain") + let deps ← loadRootDependencies root + let workspaceTest ← loadWorkspaceTestTemplate root + let mut scores : Array ProblemScore := #[] + for entry in problems do + let mut extracteds : Array ExtractedTheorem := #[] + for hole in entry.holes do + let e ← extractOne root entry hole + extracteds := extracteds.push e + let expectedFiles ← renderWorkspace root entry extracteds toolchain deps workspaceTest + let workspace ← workspacePathForProblem root entry.id workspacesRoot + let relDisplay := + let wsStr := workspace.toString + let rootStr := root.toString ++ "/" + if wsStr.startsWith rootStr then wsStr.drop rootStr.length |>.toString else wsStr + let mismatches ← checkWorkspace workspace relDisplay expectedFiles + let attempted := !mismatches.isEmpty + let (exitCode?, succeeded) ← + if attempted then + let code ← runProblemTest workspace env + if code == 2 then + throw <| IO.userError s!"Comparator could not run for {entry.id}; see the setup diagnostics above." + pure (some code, code == 0) + else + pure (none, false) + scores := scores.push { + id := entry.id + title := entry.title + visible := entry.visible + attempted := attempted + succeeded := succeeded + exitCode := exitCode? + mismatches := mismatches + workspacePath := relDisplay + } + return scores /-- Aggregated counts. Mirrors `summarize_scores`. -/ structure ScoreSummary where diff --git a/README.md b/README.md index 524153600..561b4262e 100644 --- a/README.md +++ b/README.md @@ -218,85 +218,45 @@ Comparator and nanoda checks apply as usual. lake test ``` -`lake test` shells out to four external tools that you must install yourself: -`landrun` (the sandbox), `lean4export` (exports oleans to text), `comparator` -(the verifier), and `nanoda` (the independent kernel). `WorkspaceTest` forces -comparator to replay every Solution through nanoda, so a missing `nanoda_bin` -fails the check. All four are pinned to immutable commits; the authoritative -pin table lives in [`SECURITY.md`](SECURITY.md) ("Trusted dependencies and pin -policy"), and CI installs exactly these in -[`.github/workflows/ci.yml`](.github/workflows/ci.yml). Reproduce that setup -locally: +The pinned Lean toolchain includes Lake comparator, `leanexport`, the Lean +checker, and NanoDa. The trusted test driver always requires both Lean and NanoDa. +The only additional verifier dependency is bubblewrap on Linux with user namespaces. -```bash -# landrun — install at the pinned commit (NOT @main; the version string is -# unreliable, and tagged releases through v0.1.15 lack fixes comparator needs). -go install github.com/zouuup/landrun/cmd/landrun@5ed4a3db3a4ad930d577215c6b9abaa19df7f99f -export PATH="$(go env GOPATH)/bin:$PATH" - -# lean4export — clone, check out the pin, and build. -lean_eval_root="$(pwd)" # run this setup from the lean-eval repository root -git clone https://github.com/leanprover/lean4export.git -( cd lean4export - git checkout 076e8e57707e813375e8f9da8bf989799ace9680 - cp "$lean_eval_root/lean-toolchain" lean-toolchain - lake build lean4export ) -export PATH="$PWD/lean4export/.lake/build/bin:$PATH" - -# comparator — clone, check out the pin (adds `def`-hole support), and build. -git clone https://github.com/leanprover/comparator.git -( cd comparator - git checkout d03acab154d269c06e60e4de7e4cc85deebff94b - lake build comparator ) -export PATH="$PWD/comparator/.lake/build/bin:$PATH" - -# nanoda — the external kernel. WorkspaceTest forces comparator to replay the -# Solution through nanoda, so `lake test` fails unless `nanoda_bin` is on your -# PATH. Needs a Rust toolchain (`cargo`); the pin is on the source commit, not -# the compiler version. -git clone https://github.com/robsimmons/nanoda_lib.git -( cd nanoda_lib - git checkout 68d5ca9db226849b41a6fff59d796ff19d0a8840 - cargo build --release ) -export PATH="$PWD/nanoda_lib/target/release:$PATH" -``` - -`lean4export` and `comparator` are Lean programs. The pinned lean4export source -uses Lean v4.34.0 by default, and its build command above deliberately selects -the workspace's exact toolchain by copying `lean-toolchain`; different Lean -releases have incompatible olean headers. Comparator builds `Challenge.olean` with the -workspace toolchain and then reads it back with `lean4export`, so exact -compatibility is required. If the formats differ you get -`failed to read file '.../Challenge.olean', incompatible header` — that error -means a Lean/olean version mismatch (or a stale `.lake` artifact left over from -an earlier toolchain), never a problem with your proof. If you hit it, rebuild -`lean4export` at the pinned commit after copying this repository's -`lean-toolchain` into its checkout, rebuild comparator at its pinned commit, and clear the affected -workspace's `.lake/build` before retrying. - -Once the tools are on your `PATH`, verify the whole pipeline against the starter -problem before attempting a real one — this builds and scores `two_plus_two` end -to end, so it isolates an install problem from a proof problem: +Install bubblewrap 0.12.0 using the same checksum-verified installer as CI +(requires Meson, Ninja, libcap development headers, curl, and a C compiler): ```bash -lake exe lean-eval check-comparator-installation +# Run from the lean-eval repository root, outside a problem workspace. +export COMPARATOR_BWRAP="$(bash scripts/install_bwrap.sh "$PWD/.tools/bubblewrap")" ``` -Install the tools outside the evaluation workspace. The test harness removes -workspace and writable cache directories from executable and library search -paths, then resolves comparator and its helpers to absolute paths before any -submission runs. -`LEAN_PATH` remains available for exporting the compiled proof. +On Ubuntu 24.04 the installer loads an executable-specific AppArmor profile using +`sudo` when user namespaces are restricted. On a system where bubblewrap 0.12.0 +is already configured, put `bwrap` on PATH or set `COMPARATOR_BWRAP` to its +absolute path. -If a tool is off your `PATH`, set its override: `COMPARATOR_BIN`, -`COMPARATOR_LANDRUN`, `COMPARATOR_LEAN4EXPORT`, or `COMPARATOR_NANODA`. -Overrides resolving inside the evaluation workspace or its writable `.lake` -cache are rejected, including when `.lake` is a symlink: +Check the installation against the starter problem: ```bash -COMPARATOR_BIN=/path/to/comparator lake test +lake exe lean-eval check-comparator-installation ``` +Run `lake test` in a problem workspace to invoke the toolchain's +`lake comparator`. It pins the exporter and checker to the same Lean release, +avoiding separate exporter builds and incompatible olean formats. When changing +toolchains, refresh the dependency caches and remove stale workspace build outputs. + +The trusted driver uses Lake's `LAKE` and `LEAN_SYSROOT` settings and removes +workspace/cache directories from executable and library search paths before +starting comparator. `LEAN_PATH` remains available for module imports. +Install bubblewrap and the toolchain outside submission-writable directories. +The old `COMPARATOR_BIN`, `COMPARATOR_LANDRUN`, `COMPARATOR_LEAN4EXPORT`, +and `COMPARATOR_NANODA` overrides are no longer used. + +Root scoring makes the trusted shared package cache visible read-only inside +Lake's sandboxes. Direct local workspaces can keep their own dependencies; no +cache wrapper is needed for that layout. + ### 6. Check your local score From the repo root: diff --git a/SECURITY.md b/SECURITY.md index 6d4dc6454..c05654915 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,399 +1,159 @@ # Security model: lean-eval -This repository owns the benchmark problem set and the -**comparator / landrun sandbox integration** — the machinery that bounds -untrusted submitter Lean code. This document explains the sandbox -invariants, the comparator trust model, and the pinned-dependency policy -that the whole evaluation pipeline rests on. - -The **submission pipeline** itself — issue intake, fetching submission -source, the evaluation workflow, recording results, and the overall -adversarial-submission threat model — lives in the submissions -repository and is documented there: - -> **[`leanprover/lean-eval-submissions` → `SECURITY.md`](https://github.com/leanprover/lean-eval-submissions/blob/main/SECURITY.md)** - -The two documents are complementary. The pipeline's guarantees are only -as strong as the sandbox guarantees described here; this repository is -where a change (a pin bump, a `templates/` edit, a generated-workspace -lakefile change) can weaken the sandbox, so this is the doc a reviewer -of a `lean-eval` PR must check against. +This repository owns the problem set and the integration between the trusted +evaluation harness and the pinned toolchain's `lake comparator`. Intake, +fetching, credentials, archiving, and result publication are documented in +[lean-eval-submissions/SECURITY.md](https://github.com/leanprover/lean-eval-submissions/blob/main/SECURITY.md). ## Reporting a vulnerability -If you find a way for a submitter to receive credit for a theorem they -have not proved, or to read another submission's private source, or to -execute code outside the landrun sandbox: do not file a public issue. -Email the maintainers (see the repository's `leanprover` org contacts) -with the details and a reproduction. - -## 1. What this document covers - -The adversary is a submitter who controls a `Submission.lean` (and files -under `Submission/`). The goal we resist here: **untrusted submitter Lean -escaping comparator's sandbox, or comparator accepting a Solution that -does not actually prove the Challenge.** The pipeline-level framing of -the same adversary (issue intake, token handling, confidentiality) is in -the submissions repo's `SECURITY.md`. - -The submitter does not control `Challenge.lean`, `Solution.lean`, -`lakefile.toml`, `lean-toolchain`, `config.json`, or `WorkspaceTest.lean` -in the generated workspace — these are taken from a pristine -`generated//` checkout each run — nor any pinned upstream commit. - -## 2. Architecture: Challenge / Submission / Solution - -Every benchmark problem ships as a self-contained Lake project in -[generated//](generated/two_plus_two/) with a fixed three-file shape: - -- **Challenge.lean** is the trusted theorem statement, body `sorry`. The - benchmark author writes this and reviewers approve it. It is what the - problem ASKS. -- **Submission.lean** is the only file the solver edits. It must define - a theorem of the same signature inside `namespace Submission`. This - is what the solver provides as their PROOF. -- **Solution.lean** is a generated bridge: it has the same theorem - signature as Challenge and provides `exact Submission.foo` (or, for - multi-hole problems, the structured equivalent). It exists so that - comparator can verify "Solution typechecks => Submission really - proves Challenge." - -[leanprover/comparator](https://github.com/leanprover/comparator) is the -verifier. Given a `config.json` listing `theorem_names`, -`definition_names`, and `permitted_axioms`, it: - -1. Builds Challenge and Solution **separately** under a `landrun` Linux - landlock sandbox, then runs `lean4export` on each (also sandboxed). -2. Walks the constant graph from each named theorem and requires that - every transitively-used constant (other than def-hole targets, where - only the type signature must match) is byte-identical between - Challenge and Solution. See - [comparator/Comparator/Compare.lean](../comparator/Comparator/Compare.lean). -3. Walks the same graph for axioms and requires every reachable axiom - to be in the `permitted_axioms` allowlist. See - [comparator/Comparator/Axioms.lean](../comparator/Comparator/Axioms.lean). - Our allowlist is `{propext, Quot.sound, Classical.choice}`. Notably - absent: `sorryAx` (so `sorry` is rejected) and `Lean.ofReduceBool` - (so `native_decide` is rejected). -4. Replays the exported Solution environment into the in-process Lean - kernel for a final type-check. - -Because Solution's only proof step is `exact Submission.foo`, and -because Compare.lean rejects any drift in the constant graph from -Challenge's theorem statement, the only way for verification to succeed -is if `Submission.foo` is definitionally equal to a proof of Challenge's -exact theorem statement, using only the permitted axioms. - -## 3. Where untrusted code runs, and what bounds it - -User-submitted Lean is elaborated in exactly one place: comparator's -`safeLakeBuild Solution`, which runs `lake build Solution` (and -transitively `lake build Submission`) inside a landrun sandbox. Every -other step either does not elaborate Lean, or elaborates only trusted -code. - -| Step | Process | Location | Elaborates Submission? | -|---|---|---|---| -| `actions/checkout` | trusted | runner | No | -| `rm -rf .git` | trusted | runner | No | -| `lake build comparator` (in `.ci/comparator/`) | trusted | runner | No | -| `lake build lean4export` (in `.ci/lean4export/`) | trusted | runner | No | -| `cargo build --release` (in `.ci/nanoda/`) | trusted, pinned source | runner | No | -| Submission tarball extracted | inert data | runner | No | -| `evaluate_submission.py` overlay walk | trusted Python | runner | No | -| `_share_packages` symlink setup | trusted Python | runner | No | -| `_prime_workspace` runs `lake update` | parses TOML lakefile | runner | No | -| `_prime_workspace` runs `lake exe cache get` | downloads pre-built oleans | runner | No | -| `lake exe lean-eval run-eval` (host exe) | trusted Lean | runner | No | -| `lake test` builds `WorkspaceTest` | only `import Lean` | runner | No | -| `WorkspaceTest` resolves tools and spawns comparator directly | trusted tool paths, inherited `LEAN_PATH` | runner | No | -| `comparator` calls `lean --print-prefix` / `which git` | side-effect-free | runner | No | -| `comparator.safeLakeBuild Challenge` | trusted source, sandboxed | **inside landrun** | No | -| `comparator.safeExport challengeModule` | reads trusted olean | **inside landrun** | No | -| **`comparator.safeLakeBuild Solution`** | builds Solution -> imports Submission | **inside landrun** | **YES** | -| `comparator.safeExport solutionModule` | reads the just-built olean | **inside landrun** | No | -| `runNanoda solution` | pipes the export to `nanoda_bin` (independent kernel) | **inside landrun** | No | -| `runKernel solution` | replays exported env in comparator process | runner | No | - -(`evaluate_submission.py` lives in the submissions repo; the steps above -describe what it does when it drives an evaluation against this -benchmark.) - -Boundary concerns to call out explicitly: - -**Comparator tool paths must stay outside the writable workspace.** Lake starts -`WorkspaceTest` with package binary directories prepended to `PATH`, including -the submission-writable `.lake/build/bin`. The harness removes canonical paths -inside the workspace or its writable `.lake` cache (including a symlinked cache) -from `PATH`, `LD_LIBRARY_PATH`, and `DYLD_LIBRARY_PATH`, -omits empty or nonexistent search directories, and resolves comparator, -landrun, lean4export, and nanoda to absolute paths outside these roots. -An empty filtered executable path is rejected; empty filtered library paths -are unset to avoid interpreting them as the current directory. -Explicit `COMPARATOR_*` overrides are checked after symlink resolution too. -Comparator is launched directly with these overrides; `LEAN_PATH` from the -outer `lake test` is preserved for sandboxed export. Consequently, a submission -cannot change the supervisor or external kernel selected by later tool lookup -by creating new executables under `.lake`. Filtering `PATH` also protects -Landrun's unsandboxed `ldconfig` lookup while preparing later sandboxes. -This guarantee applies to the -generated harness, not arbitrary direct `lake env comparator` invocations. -Evaluation must still start from a trusted, freshly prepared workspace and -cache: this protects tool lookup after submission elaboration, while an -already compromised cache could run code as Lake starts the test driver. - -**Lake env doesn't elaborate.** [scripts/security_probes/lake_env_probe.py](scripts/security_probes/lake_env_probe.py) -verifies on every run of the test suite that `lake env -- ` (and -nested `lake env -- lake env -- `) on a workspace whose -`Submission.lean` has top-level `initialize` and `#eval` markers does -NOT produce those markers in stdout. Confirmed on the pinned toolchain -(Lean v4.34.0, 2026-09-16). If a future lake version starts evaluating project Lean -during `lake env`, this probe must be re-run before the toolchain -bump lands. - -**`_prime_workspace` doesn't build user-controlled targets.** The -docstring at `evaluate_submission.py` (in the submissions repo) -documents the rule and the regression history (commit `3474943` -violated it in 2026-04, reverted in #92 in 2026-05). `lake update` and -`lake exe cache get` are the only shell-outs allowed. - -**Writable `.lake/` self-tampering is a known limitation.** -Comparator gives `safeLakeBuild` `--rwx /.lake`, which is -necessary because lake writes its build outputs there. The natural -attack to consider is: a `Submission.lean` `initialize` block spawns a -detached `setsid` daemon that inherits landrun's filesystem rules, -survives the per-build landrun child's exit (children get reparented -to PID 1, not killed), and races to overwrite `Solution.olean` between -`safeLakeBuild Solution` returning and `safeExport solutionModule` -reading it — getting comparator to verify against an -attacker-controlled olean. - -[scripts/security_probes/artifact_tamper_probe.py](scripts/security_probes/artifact_tamper_probe.py) -shows that `IO.Process.spawn` succeeds for the whitelisted `lean` and -`git` binaries while `sh`, `setsid`, `bash`, `cp`, `/bin/sh`, and -`/usr/bin/env` are denied. Phase B verifies by SHA-256 that its deliberately -distinct prepared olean is not installed. Neither result rules out the attack: -`lean` is a general-purpose interpreter, so the daemon can be another `lean` -running an attacker-written `initialize` block. Detaching it needs no external -binary because `IO.Process.SpawnArgs` has a native `setsid : Bool` field. -Orphaned children are reparented rather than killed when the landrun child -exits. In addition, `executablePaths := #[leanPrefix, gitLocation]` -whitelists exec across the *entire* Lean prefix (`lake`, `clang`, -`ld.lld`, `leanc`, ...), not just `lean`; and comparator passes `-ldd`, -which whitelists the dynamic loader, and a permitted loader can load a -readable ELF that is not itself exec-whitelisted. - -So the premise that no persistent child is possible does not hold, and -`safeExport` has nothing guaranteeing it reads the olean that -`safeLakeBuild` produced. We have no working exploit, so this is an -unsound argument rather than a demonstrated attack, and note that any -substituted olean is still replayed through the kernel and -`external_kernels`. This known limitation is tracked upstream at -https://github.com/leanprover/comparator/issues/77, with a proposed fix -in https://github.com/leanprover/comparator/pull/78 that runs each -landrun invocation as PID 1 of a fresh PID namespace, so the kernel -tears down any survivors before comparator proceeds. The current pin does not -contain that proposed fix. - -This applies to every runner we use today; it has nothing to do with -any particular kernel. Re-derive it after any landrun, comparator, or -lean-toolchain pin bump. - -## 4. Trust model for the comparator - -We rely on the following claims about [leanprover/comparator](https://github.com/leanprover/comparator) -at the pinned commit: - -1. The constant-graph walk in `compareAt` reaches every constant that - the theorem's statement type or proof body transitively uses. If a - constant is reachable, it must be byte-identical between Challenge - and Solution unless it is listed in `definition_names` (which the - benchmark author controls via the manifest). -2. The axiom walk in `checkAxioms` reaches every axiom transitively - used by the theorem and definition targets, and rejects any axiom - not in the configured allowlist. -3. `safeLakeBuild` and `safeExport` run inside landrun with the - filesystem and environment policy described in - `comparator/Main.lean`. -4. Lean kernel re-replay (`runKernel`) catches any malformed olean - structure that lean4export accepts but the kernel rejects. - -If any of those claims drifts in a future comparator commit, our -guarantees regress with it. The comparator pin (see Section 5) is the -mechanism that prevents silent drift; the bump procedure is the -mechanism that forces a re-audit. - -## 5. Trusted dependencies and pin policy - -Every source dependency and CI action in the evaluation pipeline is -pinned to an immutable commit SHA. The Lean binary toolchain is pinned -to an exact release selector. Branches and loose action tags are mutable; -if `landrun@main` or `actions/checkout@v4` is ever resolved at install -time, the upstream publisher controls our supply chain. - -| Dependency | Repo | Pinned to | Purpose | Last bumped | -|---|---|---|---|---| -| Lean toolchain | leanprover/lean4 | `v4.35.0-rc3` | compiler and Lake | 2026-09-28 | -| mathlib | leanprover-community/mathlib4 | `5e0c4e5239cb0a2d86d68a884bf52cfd963fce22` | theorem library (the pin of TauCeti `522706e`) | 2026-09-28 | -| TauCeti | TauCetiProject/TauCeti | `522706e83ca349c3d6bde045e56778d17354ae8d` | definitions used by `classification_finite_simple_groups`; oleans from its public Lake cache | 2026-09-28 | -| lean-pool | Vilin97/lean-pool | `e9d53e9cbcff8dfd0cc816ba94db7a26b082929f` | solution-only library; forbidden in trusted problem imports | 2026-09-28 | -| lean-eval-generator | leanprover/lean-eval-generator | `0b8cc2d141710a18515c53448f006c971dd8eeb4` | workspace generation and solution-dependency policy | 2026-09-28 | -| lean4-cli | leanprover/lean4-cli | `843844fa601dd56767b1eb22b7ada5b64d5e567a` | command-line parsing | 2026-09-28 | -| landrun | zouuup/landrun | `5ed4a3db3a4ad930d577215c6b9abaa19df7f99f` | Linux landlock sandbox | 2026-05-04 | -| lean4export | leanprover/lean4export | `076e8e57707e813375e8f9da8bf989799ace9680` | exports olean to text | 2026-09-16 | -| comparator | leanprover/comparator | `d03acab154d269c06e60e4de7e4cc85deebff94b` | the verifier | 2026-09-16 | -| nanoda | robsimmons/nanoda_lib | `68d5ca9db226849b41a6fff59d796ff19d0a8840` | independent kernel (external checker) | 2026-07-29 | -| `jlumbroso/free-disk-space` | (action) | `54081f138730dfa15788a46383842cd2f914a1be` | runner disk cleanup | 2026-05-04 | -| `actions/checkout` | (action) | `3d3c42e5aac5ba805825da76410c181273ba90b1` (v7.0.1) | repo checkout | 2026-07-30 | -| `actions/setup-python` | (action) | `5fda3b95a4ea91299a34e894583c3862153e4b97` (v7.0.0) | python setup (`lean-eval-submissions`) | 2026-07-30 | -| `actions/setup-go` | (action) | `b7ad1dad31e06c5925ef5d2fc7ad053ef454303e` (v7.0.0) | go setup | 2026-07-30 | -| `actions/create-github-app-token` | (action) | `bcd2ba49218906704ab6c1aa796996da409d3eb1` (v3.2.0) | App auth | 2026-07-30 | -| `actions/upload-artifact` | (action) | `043fb46d1a93c77aae656e7c1c64a875d1fc6a0a` (v7.0.1) | submission artifact upload (`lean-eval-submissions`) | 2026-07-30 | -| `actions/download-artifact` | (action) | `3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c` (v8.0.1) | submission artifact download (`lean-eval-submissions`) | 2026-07-30 | -| `leanprover/lean-action` | (action) | `38fbc41a8c28c4cbaec22d7f7de508ec2e7c0dd9` | Lean toolchain | 2026-05-04 | -| Go toolchain | (setup-go arg) | `1.25.12` | concrete version, not `stable` | 2026-07-30 | -| Python | (setup-python arg) | `3.11.10` | concrete patch version | 2026-05-04 | -| `permitted_axioms` (every workspace) | comparator config | `{propext, Quot.sound, Classical.choice}` | axioms allowed in proofs | unchanged | - -Mutable selectors are forbidden anywhere in `.github/workflows/`. The -[`scripts/action_pin_audit.py`](scripts/action_pin_audit.py) script -walks every workflow and hard-fails on `uses: ...@main`, -`uses: ...@v` (loose tag), `go-version: stable`, `python-version` -without a patch component, and `go install ...@`. It runs on -every CI build; an unpinned dependency cannot be merged. - -The submission pipeline (`leanprover/lean-eval-submissions`) pins the -same landrun / lean4export / comparator / GitHub Actions versions in its -own `submission.yml`. A bump must update both repos in lockstep. - -### Bumping pinned dependencies - -1. Find the new SHA. For tags: `git ls-remote refs/tags/`. - For branch HEAD: `git ls-remote refs/heads/main`. -2. Update **every** site listed below in lockstep, and add a dated - comment of the form `# pinned to ( as of YYYY-MM-DD).` - - `.github/workflows/ci.yml` (this repo; includes the nanoda pin) - - `.github/workflows/regenerate-main.yml` (this repo) - - `.github/workflows/submission.yml` (leanprover/lean-eval-submissions; - includes the nanoda pin) - - `README.md` (this repo; the local-setup nanoda / comparator / - lean4export / landrun clone commands) - - `EvalTools/CheckComparatorInstallation.lean` (`landrunInstallTarget`, - for landrun only) - - `lean-eval-leaderboard/.benchmark-commit` (for the lean-eval - benchmark commit only) -3. Open a PR. CI runs `scripts/action_pin_audit.py`, - `scripts/sandbox_engaged_probe.py`, - `scripts/security_probes/env_dump_probe.py`, and - `scripts/security_probes/tool_path_probe.py`. All four must pass. -4. Re-run the one-shot probes locally on Linux: - - [scripts/security_probes/lake_env_probe.py](scripts/security_probes/lake_env_probe.py) - - [scripts/security_probes/artifact_tamper_probe.py](scripts/security_probes/artifact_tamper_probe.py) - Update Sections 3 and 6 of this doc if either changes verdict. -5. Merge. - -## 6. Validations done at evaluation time - -- **Action pin audit.** [scripts/action_pin_audit.py](scripts/action_pin_audit.py) - runs in CI; mutable workflow refs are blocked from merging. -- **Sandbox-engaged probe.** [scripts/sandbox_engaged_probe.py](scripts/sandbox_engaged_probe.py) - runs in `ci.yml` and on every `submission` workflow run (the - submissions repo invokes it from this repo's checkout). It builds a - synthetic comparator workspace whose `Submission.lean` attempts five - writes — `/tmp/...`, `$HOME/...`, `../outside`, through a `.lake/` - symlink to outside, and `.lake/probe/inside-ok` — and asserts only - the inside-ok write succeeds. Catches landrun fail-open, kernel - landlock regressions, and policy drift in comparator's flag set. -- **Env-allowlist probe.** [scripts/security_probes/env_dump_probe.py](scripts/security_probes/env_dump_probe.py) - runs in `ci.yml` and on every `submission` workflow run. The probe - salts the parent env with decoy secrets (`GH_TOKEN`, - `LD_PRELOAD`, `AWS_ACCESS_KEY_ID`, `LEAN_EVAL_BOT_PRIVATE_KEY`, - etc.) and asserts that `Submission`'s elaboration sees a subset - of `{PATH, HOME, LEAN_ABORT_ON_PANIC, LEAN_PATH, LD_LIBRARY_PATH}` - containing the required `{PATH, HOME, LEAN_ABORT_ON_PANIC}`. - Allowlist-based, not spot-check, so the next unknown token class - can't slip through. The required three are forwarded by comparator's - `envPass`; `LEAN_PATH` and `LD_LIBRARY_PATH` are added by `lake` - itself when it spawns `lean` and may or may not be present - depending on the OS. They point at the workspace's `.lake/build/lib` - and the toolchain's shared libs and contain no secrets. -- **Tool-path probe.** [scripts/security_probes/tool_path_probe.py](scripts/security_probes/tool_path_probe.py) - runs in the security CI job through the production `WorkspaceTest` template. - Submission elaboration creates executable stand-ins for landrun, lean4export, - nanoda, Lean, and additional lookup commands (including `ldconfig`) in - `.lake/build/bin`; the probe requires that none is used and - that the valid proof passes comparator and nanoda. Harness tests also cover - relative paths, missing directories, symlink aliases, and explicit overrides. -- **Permitted axioms.** Every generated `config.json` has - `permitted_axioms = {propext, Quot.sound, Classical.choice}`. No - `sorryAx`, no `Lean.ofReduceBool`. - -Why CI runs the probes: a `lean-eval` PR can weaken the sandbox by -bumping the comparator/landrun pin, editing `templates/`, or changing a -generated workspace's lakefile. The probes run as a required check here -so such a regression is caught on the PR that introduces it, before any -submission is ever evaluated against it. The submission pipeline re-runs -them per-submission as a last-second pre-flight gate. - -## 7. Soft spots — where to look first - -Each item is something we believe is OK today but where the assumption -is fragile or hard to audit. Pipeline-level soft spots (leaderboard -escaping, the triage gate) are in the submissions repo's `SECURITY.md`. - -1. **landrun `--best-effort` semantics on novel kernels.** landrun - silently runs without sandbox if the kernel lacks landlock support. - Today's `ubuntu-latest` runners are fine. The sandbox-engaged probe - catches this in CI on every run, but the probe only exercises the - policy comparator uses — if comparator's policy ever diverges from - the probe's mock workspace shape, a real false negative is possible. - Re-run the probe by hand on a clean Linux box after any landrun - bump. -2. **Writable-`.lake` self-tampering** (Section 3). **Not currently - mitigated at the pinned comparator commit.** A `lean` descendant can - outlive `safeLakeBuild` and race `safeExport`. No working exploit is - known, and a substituted olean is still kernel-checked. Tracked at - https://github.com/leanprover/comparator/issues/77; proposed fix in - https://github.com/leanprover/comparator/pull/78. -3. **`lake env` behaviour across lake versions.** The `lake_env_probe` - confirms current behaviour. Lake version bumps must re-run it. -4. **`definition_names` author trap.** Comparator only requires that - def/instance holes match Challenge in TYPE, not body. If the - benchmark author writes a theorem whose statement does not pin the - def's value, a submitter can satisfy the manifest with a trivial - def. There is no automated guard against this — comparator - structurally cannot verify that an author's spec theorems - sufficiently constrain a def — and adding one would be at most a - heuristic. The real guard is PR review of any problem that uses - def/instance holes. -5. **Dual-kernel defence.** nanoda is a global requirement, not a - per-problem option. `templates/WorkspaceTest.lean` (the harness that - invokes comparator, propagated verbatim into every workspace and - rebuilt from the template by `run-eval`) reads the committed - `config.json`, overrides `enable_nanoda := true`, and hands that to - comparator — so nanoda runs regardless of what any config file says. - This mirrors comparator-live, which forces the flag at the invocation - site (`exec.ts`) and leaves project configs untouched. A single Lean - kernel soundness bug (e.g. the Lean-conjecture counterexample) no - longer suffices to claim false credit; the proof must be accepted by - both kernels. The residual risk narrows to a bug present in *both* - kernels, or in comparator's export/axiom comparison itself. Note the - pinned nanoda is `robsimmons/nanoda_lib` (the fork comparator-live - deploys); the `builtinTargets` widening in comparator's `Main.lean` - still carries a `TODO: fix when nanoda fixes its string handling`, so a - nanoda string soundness gap would not be caught. Because enforcement - lives in `WorkspaceTest`, a workspace whose committed `config.json` - still says `enable_nanoda: false` is not a bypass — the harness - overrides it. Bumping the nanoda pin follows the "Bumping pinned - dependencies" procedure above. - -## References - -- [comparator/Main.lean](../comparator/Main.lean), [comparator/Comparator/Compare.lean](../comparator/Comparator/Compare.lean), [comparator/Comparator/Axioms.lean](../comparator/Comparator/Axioms.lean) — verifier internals. -- [leanprover/comparator README](https://github.com/leanprover/comparator) — upstream trust model. -- [scripts/security_probes/](scripts/security_probes/) — the security probes cited above. -- [scripts/action_pin_audit.py](scripts/action_pin_audit.py), - [scripts/sandbox_engaged_probe.py](scripts/sandbox_engaged_probe.py), - [EvalTools/CheckComparatorInstallation.lean](EvalTools/CheckComparatorInstallation.lean) — the integrity scripts referenced above. -- Workflow files: [.github/workflows/ci.yml](.github/workflows/ci.yml), [.github/workflows/regenerate-main.yml](.github/workflows/regenerate-main.yml), [.github/workflows/notify-leaderboard.yml](.github/workflows/notify-leaderboard.yml). -- [`leanprover/lean-eval-submissions` SECURITY.md](https://github.com/leanprover/lean-eval-submissions/blob/main/SECURITY.md) — the submission-pipeline threat model. +If a submission can receive credit without proving its statement, read another +submission's private source, or execute code outside the sandbox, email the +maintainers through the Lean organization contacts with details and a reproduction. +Do not disclose a vulnerability in a public issue. + +## Submission boundary + +Submitters control only `Submission.lean` and files under `Submission/`. +The pipeline copies Challenge, Solution, config, toolchain, Lake configuration, +and the test driver from the trusted benchmark revision. It checks paths and +dependency pins before overlaying permitted files. Problem helpers and statements +cannot import the solution-only Lean Pool dependency. + +Challenge expresses the trusted statement. Solution imports Submission and exposes +the declarations named in the trusted comparator config. Definition holes are +explicitly named separately from theorem targets. Neither successful elaboration +nor a submission's printed output is evidence of acceptance. + +## Verifier and kernel policy + +The trusted `WorkspaceTest` driver invokes the toolchain's absolute Lake +executable with `comparator --config `. It unconditionally +registers the toolchain's bundled NanoDa, regardless of the on-disk +`enable_nanoda` flag or `external_kernels` map. Every acceptance requires +NanoDa and the default Lean checker. Missing tools or failed checkers cannot +produce acceptance. `--paranoid` is not enabled. + +Lake builds and exports Challenge before building/exporting Solution. Its trusted +supervisor parses the exports, compares target statements and their constant +graphs (with the configured definition holes), checks the allowed axioms, and runs +the checkers in separate processes. The solution exporter is untrusted: the design +must remain sound even if it fabricates its output. Exporter behavior alone is +not a soundness guarantee. + +The permitted axioms are `propext`, `Quot.sound`, and `Classical.choice`. +The trust assumptions include the comparator's graph/axiom checks, the trusted +challenge, the export parser, kernel implementations, and the operating system's +sandbox isolation. Extra axioms, mismatched statements, and uses of sorry must be +rejected. A native computation that introduces an unpermitted axiom is not a +substitute for a checked proof. + +## Where submitted code runs + +| Operation | Trust and execution boundary | +| --- | --- | +| Root dependency restoration and benchmark build | Trusted pinned sources, on the runner before submission extraction | +| Building the generated test driver | Trusted source; it must not import Submission | +| Driver config enforcement and launching comparator | Trusted supervisor on the runner | +| Comparator workspace resolution/build/export | Lake's bubblewrap sandboxes; solution build/imports execute submitted code | +| Export comparison and axiom checking | Trusted supervisor parsing untrusted export data | +| NanoDa and Lean checker | Separate sandboxed processes reading the solution export | + +Do not add an unsandboxed `lake build Solution`, `lake build Submission`, or a +test-driver import of submitted modules. `lake env` itself does not build project +libraries, but it is unnecessary for starting this driver. Challenge preparation +must use trusted source and dependencies only. + +The driver filters executable and library search paths to remove the workspace, +its writable cache, relative/empty entries resolving there, symlink aliases, and +nonexistent directories. It uses Lake's supplied `LAKE` and `LEAN_SYSROOT` +paths outside writable roots. Keep this filtering: supervisor tool lookups must +not execute a program planted in a workspace build directory. The bundled +exporter and Lean checker are selected by Lake from its own toolchain. + +## Sandbox and caches + +Linux bubblewrap 0.12.0 is installed from a checksum-verified release using +`scripts/install_bwrap.sh`. Ubuntu's user-namespace restriction is handled by an +AppArmor profile granting userns permission to that executable. Failure to create +a sandbox is an error; there is no unsandboxed fallback. + +Lake binds the host filesystem read-only, masks home and temporary paths, clears +the child environment, provides private writable temporary directories, and +grants writes to the workspace's private `.lake` for builds. Network isolation, +PID namespaces, parent-death cleanup, and new sessions are configured by Lake. +A successful write to sandbox-private HOME or /tmp is allowed; it must not change +the corresponding host file. + +Scoring creates a trusted temporary `COMPARATOR_BWRAP` wrapper to bind the root's +canonical shared package directory read-only after Lake's masking mounts. The +wrapper embeds the real bubblewrap and cache paths because Lake launches it with +an empty environment. It preserves Lake's other arguments and settings. +Mounts come from trusted root state, never submission input. Private local +workspaces do not need this visibility adapter. + +Existing trusted root builds finish dependency setup before evaluation, including +ProofWidgets metadata that cannot be updated in a read-only cache. Shared source +and cached artifacts remain read-only during submission builds. The submissions +adapter gives Lean Pool its own writable build outputs in each workspace while +sharing its pinned source read-only; one submission must never supply writable +artifacts to another. + +The former Landrun setup allowed detached build descendants to survive between +phases. Lake's PID namespaces tear down descendants; the descendant-cleanup probe +checks that the heartbeat stops. Historical replay images keep their recorded +legacy tools and are not covered by this current-path migration. + +## Trusted dependencies and pin policy + +The Lean release in `lean-toolchain` pins Lake comparator, exporter, Lean checker, +and bundled NanoDa together. Mathematics and generator revisions are in +`lakefile.toml` and `lake-manifest.json`. Bubblewrap's release and SHA256 are +in `scripts/install_bwrap.sh`. Workflow actions use immutable commit SHAs; +`scripts/action_pin_audit.py` checks mutable selectors. + +When changing the Lean toolchain, update compatible mathematics pins and generated +workspaces together, restore their exact caches, and run the normal CI and +sandbox/scoring checks. When changing bubblewrap, update the release and checksum +in both benchmark and submission installers. Review the actual sandbox behavior, +not just the reported version. No standalone comparator/exporter/NanoDa build or +Landrun pin is required by this benchmark. + +The generator rejects Lean Pool imports in trusted statements and helpers while +making its pinned source available to solutions. Maintain that separation. +Historical replay locks and instrumentation are versioned independently; do not +silently change their verifier or metric semantics. + +## Validations done at evaluation time + +Before unpacking submitted source, the production job runs the benchmark's +sandbox and environment probes. Benchmark CI also runs these through the same +`lake test` driver used for scoring: + +- `scripts/sandbox_engaged_probe.py`: source/host writes denied, host marker + hidden, private build/temp writes work, and no IPv4 routes appear. +- `scripts/security_probes/env_dump_probe.py`: a synthetic parent secret is + absent during submission elaboration. +- `scripts/security_probes/tool_path_probe.py`: workspace helper stand-ins do + not displace the trusted supervisor/kernel commands. +- `scripts/security_probes/artifact_tamper_probe.py`: a detached build + descendant stops before comparator returns. +- `scripts/security_probes/comparator_probe.py`: valid/invalid proofs, + definition holes, dependent holes, mandatory NanoDa, and missing sandbox. +- `check-comparator-installation` and `check-eval-workflow`: a real generated + Mathlib workspace, shared cache visibility, Lean Pool import, and exact counts. + +The `run-eval` command can exit successfully while reporting rejected proofs. +Consumers must inspect per-problem JSON. Exit 2 from the driver denotes setup +failure and aborts scoring; exit 1 can include runtime infrastructure failures, so +retain raw diagnostics. Resource exhaustion is not evidence of an invalid theorem. + +## Limits + +This boundary does not make arbitrary benchmark changes safe: changing the +trusted statement, Solution adapter, config, driver, dependency source, or +executable paths changes what is trusted. Reviews must preserve those assumptions. +A flaw shared by the checkers, comparator comparison/axiom logic, export parser, +or Linux isolation can defeat the system. Keep runner credentials and unrelated +private data out of the evaluation environment even though child environment and +filesystem access are restricted. diff --git a/generated/H1_not_closedComplemented/WorkspaceTest.lean b/generated/H1_not_closedComplemented/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/H1_not_closedComplemented/WorkspaceTest.lean +++ b/generated/H1_not_closedComplemented/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/abel_ruffini/WorkspaceTest.lean b/generated/abel_ruffini/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/abel_ruffini/WorkspaceTest.lean +++ b/generated/abel_ruffini/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/adoCharZero/WorkspaceTest.lean b/generated/adoCharZero/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/adoCharZero/WorkspaceTest.lean +++ b/generated/adoCharZero/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/adoIwasawa/WorkspaceTest.lean b/generated/adoIwasawa/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/adoIwasawa/WorkspaceTest.lean +++ b/generated/adoIwasawa/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/alternating_sign_matrix_count/WorkspaceTest.lean b/generated/alternating_sign_matrix_count/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/alternating_sign_matrix_count/WorkspaceTest.lean +++ b/generated/alternating_sign_matrix_count/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_absolute_profinite_rigidity/WorkspaceTest.lean b/generated/annals_absolute_profinite_rigidity/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_absolute_profinite_rigidity/WorkspaceTest.lean +++ b/generated/annals_absolute_profinite_rigidity/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_algebraic_integers/WorkspaceTest.lean b/generated/annals_algebraic_integers/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_algebraic_integers/WorkspaceTest.lean +++ b/generated/annals_algebraic_integers/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_bose_gases/WorkspaceTest.lean b/generated/annals_bose_gases/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_bose_gases/WorkspaceTest.lean +++ b/generated/annals_bose_gases/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_bounded_multiplicative_functions/WorkspaceTest.lean b/generated/annals_bounded_multiplicative_functions/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_bounded_multiplicative_functions/WorkspaceTest.lean +++ b/generated/annals_bounded_multiplicative_functions/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_chowla_and_twin_prime_over_fq_t/WorkspaceTest.lean b/generated/annals_chowla_and_twin_prime_over_fq_t/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_chowla_and_twin_prime_over_fq_t/WorkspaceTest.lean +++ b/generated/annals_chowla_and_twin_prime_over_fq_t/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_conjecture_of_marton/WorkspaceTest.lean b/generated/annals_conjecture_of_marton/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_conjecture_of_marton/WorkspaceTest.lean +++ b/generated/annals_conjecture_of_marton/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_dirichlet_weyl_bound/WorkspaceTest.lean b/generated/annals_dirichlet_weyl_bound/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_dirichlet_weyl_bound/WorkspaceTest.lean +++ b/generated/annals_dirichlet_weyl_bound/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_duffin_schaeffer_conjecture/WorkspaceTest.lean b/generated/annals_duffin_schaeffer_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_duffin_schaeffer_conjecture/WorkspaceTest.lean +++ b/generated/annals_duffin_schaeffer_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_enumerating_number_fields/WorkspaceTest.lean b/generated/annals_enumerating_number_fields/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_enumerating_number_fields/WorkspaceTest.lean +++ b/generated/annals_enumerating_number_fields/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_equiangular_lines_fixed_angle/WorkspaceTest.lean b/generated/annals_equiangular_lines_fixed_angle/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_equiangular_lines_fixed_angle/WorkspaceTest.lean +++ b/generated/annals_equiangular_lines_fixed_angle/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_erdos_faber_lovasz_conjecture/WorkspaceTest.lean b/generated/annals_erdos_faber_lovasz_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_erdos_faber_lovasz_conjecture/WorkspaceTest.lean +++ b/generated/annals_erdos_faber_lovasz_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_erdos_supersingular_primes/WorkspaceTest.lean b/generated/annals_erdos_supersingular_primes/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_erdos_supersingular_primes/WorkspaceTest.lean +++ b/generated/annals_erdos_supersingular_primes/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_finite_time_singularity/WorkspaceTest.lean b/generated/annals_finite_time_singularity/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_finite_time_singularity/WorkspaceTest.lean +++ b/generated/annals_finite_time_singularity/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_flat_littlewood_poly/WorkspaceTest.lean b/generated/annals_flat_littlewood_poly/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_flat_littlewood_poly/WorkspaceTest.lean +++ b/generated/annals_flat_littlewood_poly/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_fractal_uncertainty/WorkspaceTest.lean b/generated/annals_fractal_uncertainty/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_fractal_uncertainty/WorkspaceTest.lean +++ b/generated/annals_fractal_uncertainty/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_fractional_expectation_thresholds/WorkspaceTest.lean b/generated/annals_fractional_expectation_thresholds/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_fractional_expectation_thresholds/WorkspaceTest.lean +++ b/generated/annals_fractional_expectation_thresholds/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_good_lt_codes/WorkspaceTest.lean b/generated/annals_good_lt_codes/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_good_lt_codes/WorkspaceTest.lean +++ b/generated/annals_good_lt_codes/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_hasse_principle_random_fano/WorkspaceTest.lean b/generated/annals_hasse_principle_random_fano/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_hasse_principle_random_fano/WorkspaceTest.lean +++ b/generated/annals_hasse_principle_random_fano/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_hessian_estimates/WorkspaceTest.lean b/generated/annals_hessian_estimates/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_hessian_estimates/WorkspaceTest.lean +++ b/generated/annals_hessian_estimates/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_improved_bounds_sunflower_lemma/WorkspaceTest.lean b/generated/annals_improved_bounds_sunflower_lemma/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_improved_bounds_sunflower_lemma/WorkspaceTest.lean +++ b/generated/annals_improved_bounds_sunflower_lemma/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_inscribed_rectangles/WorkspaceTest.lean b/generated/annals_inscribed_rectangles/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_inscribed_rectangles/WorkspaceTest.lean +++ b/generated/annals_inscribed_rectangles/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_integer_multiplication/WorkspaceTest.lean b/generated/annals_integer_multiplication/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_integer_multiplication/WorkspaceTest.lean +++ b/generated/annals_integer_multiplication/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_large_value_estimates/WorkspaceTest.lean b/generated/annals_large_value_estimates/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_large_value_estimates/WorkspaceTest.lean +++ b/generated/annals_large_value_estimates/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_linear_subspaces/WorkspaceTest.lean b/generated/annals_linear_subspaces/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_linear_subspaces/WorkspaceTest.lean +++ b/generated/annals_linear_subspaces/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_local_global_apollonian_circle_packings/WorkspaceTest.lean b/generated/annals_local_global_apollonian_circle_packings/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_local_global_apollonian_circle_packings/WorkspaceTest.lean +++ b/generated/annals_local_global_apollonian_circle_packings/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_lorentzian_polynomials/WorkspaceTest.lean b/generated/annals_lorentzian_polynomials/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_lorentzian_polynomials/WorkspaceTest.lean +++ b/generated/annals_lorentzian_polynomials/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_mckay_conjecture/WorkspaceTest.lean b/generated/annals_mckay_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_mckay_conjecture/WorkspaceTest.lean +++ b/generated/annals_mckay_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_motivic_invariants/WorkspaceTest.lean b/generated/annals_motivic_invariants/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_motivic_invariants/WorkspaceTest.lean +++ b/generated/annals_motivic_invariants/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_on_approximation_of_reals/WorkspaceTest.lean b/generated/annals_on_approximation_of_reals/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_on_approximation_of_reals/WorkspaceTest.lean +++ b/generated/annals_on_approximation_of_reals/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_on_coherence_of_one_relator_groups/WorkspaceTest.lean b/generated/annals_on_coherence_of_one_relator_groups/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_on_coherence_of_one_relator_groups/WorkspaceTest.lean +++ b/generated/annals_on_coherence_of_one_relator_groups/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_on_property_t/WorkspaceTest.lean b/generated/annals_on_property_t/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_on_property_t/WorkspaceTest.lean +++ b/generated/annals_on_property_t/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_optimal_moebius/WorkspaceTest.lean b/generated/annals_optimal_moebius/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_optimal_moebius/WorkspaceTest.lean +++ b/generated/annals_optimal_moebius/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_periodic_tiling_conjecture/WorkspaceTest.lean b/generated/annals_periodic_tiling_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_periodic_tiling_conjecture/WorkspaceTest.lean +++ b/generated/annals_periodic_tiling_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_pointwise_ergodic_theorems/WorkspaceTest.lean b/generated/annals_pointwise_ergodic_theorems/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_pointwise_ergodic_theorems/WorkspaceTest.lean +++ b/generated/annals_pointwise_ergodic_theorems/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_pseudorandom_grassmann/WorkspaceTest.lean b/generated/annals_pseudorandom_grassmann/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_pseudorandom_grassmann/WorkspaceTest.lean +++ b/generated/annals_pseudorandom_grassmann/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_rademacher_enflo_type/WorkspaceTest.lean b/generated/annals_rademacher_enflo_type/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_rademacher_enflo_type/WorkspaceTest.lean +++ b/generated/annals_rademacher_enflo_type/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_random_bernoulli_matrices/WorkspaceTest.lean b/generated/annals_random_bernoulli_matrices/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_random_bernoulli_matrices/WorkspaceTest.lean +++ b/generated/annals_random_bernoulli_matrices/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_rectangular_peg_problem/WorkspaceTest.lean b/generated/annals_rectangular_peg_problem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_rectangular_peg_problem/WorkspaceTest.lean +++ b/generated/annals_rectangular_peg_problem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_reverse_minkowski/WorkspaceTest.lean b/generated/annals_reverse_minkowski/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_reverse_minkowski/WorkspaceTest.lean +++ b/generated/annals_reverse_minkowski/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_simplicity_conjecture/WorkspaceTest.lean b/generated/annals_simplicity_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_simplicity_conjecture/WorkspaceTest.lean +++ b/generated/annals_simplicity_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_spread_of_a_finite_group/WorkspaceTest.lean b/generated/annals_spread_of_a_finite_group/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_spread_of_a_finite_group/WorkspaceTest.lean +++ b/generated/annals_spread_of_a_finite_group/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_supremum_of_selector_processes/WorkspaceTest.lean b/generated/annals_supremum_of_selector_processes/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_supremum_of_selector_processes/WorkspaceTest.lean +++ b/generated/annals_supremum_of_selector_processes/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_symplectic_monodromy/WorkspaceTest.lean b/generated/annals_symplectic_monodromy/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_symplectic_monodromy/WorkspaceTest.lean +++ b/generated/annals_symplectic_monodromy/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_ulam/WorkspaceTest.lean b/generated/annals_ulam/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_ulam/WorkspaceTest.lean +++ b/generated/annals_ulam/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_uniform_mordell_lang/WorkspaceTest.lean b/generated/annals_uniform_mordell_lang/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_uniform_mordell_lang/WorkspaceTest.lean +++ b/generated/annals_uniform_mordell_lang/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_unit_conjecture/WorkspaceTest.lean b/generated/annals_unit_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_unit_conjecture/WorkspaceTest.lean +++ b/generated/annals_unit_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_van_der_waerden_conjecture/WorkspaceTest.lean b/generated/annals_van_der_waerden_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_van_der_waerden_conjecture/WorkspaceTest.lean +++ b/generated/annals_van_der_waerden_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_viscosity_solutions/WorkspaceTest.lean b/generated/annals_viscosity_solutions/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_viscosity_solutions/WorkspaceTest.lean +++ b/generated/annals_viscosity_solutions/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_wilkies_conjecture/WorkspaceTest.lean b/generated/annals_wilkies_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_wilkies_conjecture/WorkspaceTest.lean +++ b/generated/annals_wilkies_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annals_zagier_hoffman_positive_char/WorkspaceTest.lean b/generated/annals_zagier_hoffman_positive_char/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annals_zagier_hoffman_positive_char/WorkspaceTest.lean +++ b/generated/annals_zagier_hoffman_positive_char/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annulus_theorem_dim_four/WorkspaceTest.lean b/generated/annulus_theorem_dim_four/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annulus_theorem_dim_four/WorkspaceTest.lean +++ b/generated/annulus_theorem_dim_four/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/annulus_theorem_high_dim/WorkspaceTest.lean b/generated/annulus_theorem_high_dim/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/annulus_theorem_high_dim/WorkspaceTest.lean +++ b/generated/annulus_theorem_high_dim/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/anosov_bowen_shadowing/WorkspaceTest.lean b/generated/anosov_bowen_shadowing/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/anosov_bowen_shadowing/WorkspaceTest.lean +++ b/generated/anosov_bowen_shadowing/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/aspherical_integer_homology_four_sphere/WorkspaceTest.lean b/generated/aspherical_integer_homology_four_sphere/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/aspherical_integer_homology_four_sphere/WorkspaceTest.lean +++ b/generated/aspherical_integer_homology_four_sphere/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/baer_suzuki/WorkspaceTest.lean b/generated/baer_suzuki/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/baer_suzuki/WorkspaceTest.lean +++ b/generated/baer_suzuki/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/bakerWustholz_linearForms_logs/WorkspaceTest.lean b/generated/bakerWustholz_linearForms_logs/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/bakerWustholz_linearForms_logs/WorkspaceTest.lean +++ b/generated/bakerWustholz_linearForms_logs/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/balanceable_bounded_partitions/WorkspaceTest.lean b/generated/balanceable_bounded_partitions/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/balanceable_bounded_partitions/WorkspaceTest.lean +++ b/generated/balanceable_bounded_partitions/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/banach_alaoglu_bourbaki/WorkspaceTest.lean b/generated/banach_alaoglu_bourbaki/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/banach_alaoglu_bourbaki/WorkspaceTest.lean +++ b/generated/banach_alaoglu_bourbaki/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/bauer_extreme_point_uniqueness/WorkspaceTest.lean b/generated/bauer_extreme_point_uniqueness/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/bauer_extreme_point_uniqueness/WorkspaceTest.lean +++ b/generated/bauer_extreme_point_uniqueness/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/bender_suzuki/WorkspaceTest.lean b/generated/bender_suzuki/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/bender_suzuki/WorkspaceTest.lean +++ b/generated/bender_suzuki/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/bezout_projective_multiplicity/WorkspaceTest.lean b/generated/bezout_projective_multiplicity/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/bezout_projective_multiplicity/WorkspaceTest.lean +++ b/generated/bezout_projective_multiplicity/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/boone_higman_embedding/WorkspaceTest.lean b/generated/boone_higman_embedding/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/boone_higman_embedding/WorkspaceTest.lean +++ b/generated/boone_higman_embedding/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/boone_higman_simple/WorkspaceTest.lean b/generated/boone_higman_simple/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/boone_higman_simple/WorkspaceTest.lean +++ b/generated/boone_higman_simple/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/bourgain_polynomial_ergodic/WorkspaceTest.lean b/generated/bourgain_polynomial_ergodic/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/bourgain_polynomial_ergodic/WorkspaceTest.lean +++ b/generated/bourgain_polynomial_ergodic/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/brauer_character_in_cyclotomic/WorkspaceTest.lean b/generated/brauer_character_in_cyclotomic/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/brauer_character_in_cyclotomic/WorkspaceTest.lean +++ b/generated/brauer_character_in_cyclotomic/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/brauer_fowler/WorkspaceTest.lean b/generated/brauer_fowler/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/brauer_fowler/WorkspaceTest.lean +++ b/generated/brauer_fowler/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/brauer_splitting_field/WorkspaceTest.lean b/generated/brauer_splitting_field/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/brauer_splitting_field/WorkspaceTest.lean +++ b/generated/brauer_splitting_field/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/brauer_suzuki/WorkspaceTest.lean b/generated/brauer_suzuki/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/brauer_suzuki/WorkspaceTest.lean +++ b/generated/brauer_suzuki/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/brouwer_fixed_point/WorkspaceTest.lean b/generated/brouwer_fixed_point/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/brouwer_fixed_point/WorkspaceTest.lean +++ b/generated/brouwer_fixed_point/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/brun_constant_converges/WorkspaceTest.lean b/generated/brun_constant_converges/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/brun_constant_converges/WorkspaceTest.lean +++ b/generated/brun_constant_converges/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/budney_gabai_knotted_three_spheres/WorkspaceTest.lean b/generated/budney_gabai_knotted_three_spheres/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/budney_gabai_knotted_three_spheres/WorkspaceTest.lean +++ b/generated/budney_gabai_knotted_three_spheres/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/bvp_comparison/WorkspaceTest.lean b/generated/bvp_comparison/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/bvp_comparison/WorkspaceTest.lean +++ b/generated/bvp_comparison/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/cauchy_kovalevskaya/WorkspaceTest.lean b/generated/cauchy_kovalevskaya/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/cauchy_kovalevskaya/WorkspaceTest.lean +++ b/generated/cauchy_kovalevskaya/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/cdt_linearIndependent/WorkspaceTest.lean b/generated/cdt_linearIndependent/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/cdt_linearIndependent/WorkspaceTest.lean +++ b/generated/cdt_linearIndependent/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/cerf_gamma_four/WorkspaceTest.lean b/generated/cerf_gamma_four/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/cerf_gamma_four/WorkspaceTest.lean +++ b/generated/cerf_gamma_four/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/chebyshev_sign_change/WorkspaceTest.lean b/generated/chebyshev_sign_change/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/chebyshev_sign_change/WorkspaceTest.lean +++ b/generated/chebyshev_sign_change/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/chen_theorem/WorkspaceTest.lean b/generated/chen_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/chen_theorem/WorkspaceTest.lean +++ b/generated/chen_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/choquet_representation_theorem/WorkspaceTest.lean b/generated/choquet_representation_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/choquet_representation_theorem/WorkspaceTest.lean +++ b/generated/choquet_representation_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/chudnovsky_formula_for_pi_inv/WorkspaceTest.lean b/generated/chudnovsky_formula_for_pi_inv/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/chudnovsky_formula_for_pi_inv/WorkspaceTest.lean +++ b/generated/chudnovsky_formula_for_pi_inv/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/ci_regenerate_main_check/WorkspaceTest.lean b/generated/ci_regenerate_main_check/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/ci_regenerate_main_check/WorkspaceTest.lean +++ b/generated/ci_regenerate_main_check/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/ckmrv_fourier_interpolation/WorkspaceTest.lean b/generated/ckmrv_fourier_interpolation/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/ckmrv_fourier_interpolation/WorkspaceTest.lean +++ b/generated/ckmrv_fourier_interpolation/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/classification_finite_simple_groups/WorkspaceTest.lean b/generated/classification_finite_simple_groups/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/classification_finite_simple_groups/WorkspaceTest.lean +++ b/generated/classification_finite_simple_groups/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/coc_strong_normalization/WorkspaceTest.lean b/generated/coc_strong_normalization/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/coc_strong_normalization/WorkspaceTest.lean +++ b/generated/coc_strong_normalization/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/coherent_cohomology_finite_dimensional/WorkspaceTest.lean b/generated/coherent_cohomology_finite_dimensional/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/coherent_cohomology_finite_dimensional/WorkspaceTest.lean +++ b/generated/coherent_cohomology_finite_dimensional/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/commProb_closed/WorkspaceTest.lean b/generated/commProb_closed/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/commProb_closed/WorkspaceTest.lean +++ b/generated/commProb_closed/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/compact_group_semisimple/WorkspaceTest.lean b/generated/compact_group_semisimple/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/compact_group_semisimple/WorkspaceTest.lean +++ b/generated/compact_group_semisimple/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/contractibleSpace_houseWithTwoRooms/WorkspaceTest.lean b/generated/contractibleSpace_houseWithTwoRooms/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/contractibleSpace_houseWithTwoRooms/WorkspaceTest.lean +++ b/generated/contractibleSpace_houseWithTwoRooms/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/conway_knot_not_smoothly_slice/WorkspaceTest.lean b/generated/conway_knot_not_smoothly_slice/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/conway_knot_not_smoothly_slice/WorkspaceTest.lean +++ b/generated/conway_knot_not_smoothly_slice/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/conway_knot_topologically_slice/WorkspaceTest.lean b/generated/conway_knot_topologically_slice/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/conway_knot_topologically_slice/WorkspaceTest.lean +++ b/generated/conway_knot_topologically_slice/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/conway_schneeberger_fifteen/WorkspaceTest.lean b/generated/conway_schneeberger_fifteen/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/conway_schneeberger_fifteen/WorkspaceTest.lean +++ b/generated/conway_schneeberger_fifteen/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/cubic_decay_asymptotic/WorkspaceTest.lean b/generated/cubic_decay_asymptotic/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/cubic_decay_asymptotic/WorkspaceTest.lean +++ b/generated/cubic_decay_asymptotic/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/cyclotomic_integer_house_between_two_and_76_33/WorkspaceTest.lean b/generated/cyclotomic_integer_house_between_two_and_76_33/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/cyclotomic_integer_house_between_two_and_76_33/WorkspaceTest.lean +++ b/generated/cyclotomic_integer_house_between_two_and_76_33/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/cyclotomic_integer_house_le_two/WorkspaceTest.lean b/generated/cyclotomic_integer_house_le_two/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/cyclotomic_integer_house_le_two/WorkspaceTest.lean +++ b/generated/cyclotomic_integer_house_le_two/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/darboux/WorkspaceTest.lean b/generated/darboux/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/darboux/WorkspaceTest.lean +++ b/generated/darboux/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/deBranges_theorem/WorkspaceTest.lean b/generated/deBranges_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/deBranges_theorem/WorkspaceTest.lean +++ b/generated/deBranges_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/def_hole_example/WorkspaceTest.lean b/generated/def_hole_example/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/def_hole_example/WorkspaceTest.lean +++ b/generated/def_hole_example/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/dehn_sommerville/WorkspaceTest.lean b/generated/dehn_sommerville/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/dehn_sommerville/WorkspaceTest.lean +++ b/generated/dehn_sommerville/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/derived_solidification_free_CW_homology/WorkspaceTest.lean b/generated/derived_solidification_free_CW_homology/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/derived_solidification_free_CW_homology/WorkspaceTest.lean +++ b/generated/derived_solidification_free_CW_homology/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/dimitrov/WorkspaceTest.lean b/generated/dimitrov/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/dimitrov/WorkspaceTest.lean +++ b/generated/dimitrov/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/direct_summand/WorkspaceTest.lean b/generated/direct_summand/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/direct_summand/WorkspaceTest.lean +++ b/generated/direct_summand/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/dirichlet_eigenvalues_eq_nat_sq/WorkspaceTest.lean b/generated/dirichlet_eigenvalues_eq_nat_sq/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/dirichlet_eigenvalues_eq_nat_sq/WorkspaceTest.lean +++ b/generated/dirichlet_eigenvalues_eq_nat_sq/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/duffin_schaeffer/WorkspaceTest.lean b/generated/duffin_schaeffer/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/duffin_schaeffer/WorkspaceTest.lean +++ b/generated/duffin_schaeffer/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/dvd_card_connectedComponent_markoffGraph/WorkspaceTest.lean b/generated/dvd_card_connectedComponent_markoffGraph/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/dvd_card_connectedComponent_markoffGraph/WorkspaceTest.lean +++ b/generated/dvd_card_connectedComponent_markoffGraph/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/e8_irrep_tensor_square_decomp/WorkspaceTest.lean b/generated/e8_irrep_tensor_square_decomp/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/e8_irrep_tensor_square_decomp/WorkspaceTest.lean +++ b/generated/e8_irrep_tensor_square_decomp/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/einsiedler_katok_lindenstrauss/WorkspaceTest.lean b/generated/einsiedler_katok_lindenstrauss/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/einsiedler_katok_lindenstrauss/WorkspaceTest.lean +++ b/generated/einsiedler_katok_lindenstrauss/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/entropy_dimension_lyapunov/WorkspaceTest.lean b/generated/entropy_dimension_lyapunov/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/entropy_dimension_lyapunov/WorkspaceTest.lean +++ b/generated/entropy_dimension_lyapunov/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/equichordal_point_unique/WorkspaceTest.lean b/generated/equichordal_point_unique/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/equichordal_point_unique/WorkspaceTest.lean +++ b/generated/equichordal_point_unique/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/erdos_unit_distance_conjecture_false/WorkspaceTest.lean b/generated/erdos_unit_distance_conjecture_false/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/erdos_unit_distance_conjecture_false/WorkspaceTest.lean +++ b/generated/erdos_unit_distance_conjecture_false/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/euler_lagrange_equation/WorkspaceTest.lean b/generated/euler_lagrange_equation/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/euler_lagrange_equation/WorkspaceTest.lean +++ b/generated/euler_lagrange_equation/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/exists_chiral_knot/WorkspaceTest.lean b/generated/exists_chiral_knot/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/exists_chiral_knot/WorkspaceTest.lean +++ b/generated/exists_chiral_knot/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/exists_complementary_polynomial_on_unit_circle/WorkspaceTest.lean b/generated/exists_complementary_polynomial_on_unit_circle/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/exists_complementary_polynomial_on_unit_circle/WorkspaceTest.lean +++ b/generated/exists_complementary_polynomial_on_unit_circle/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/exists_nonisotopic_knots/WorkspaceTest.lean b/generated/exists_nonisotopic_knots/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/exists_nonisotopic_knots/WorkspaceTest.lean +++ b/generated/exists_nonisotopic_knots/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/exists_nonisotopic_link/WorkspaceTest.lean b/generated/exists_nonisotopic_link/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/exists_nonisotopic_link/WorkspaceTest.lean +++ b/generated/exists_nonisotopic_link/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/exists_topologically_slice_not_smoothly_slice/WorkspaceTest.lean b/generated/exists_topologically_slice_not_smoothly_slice/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/exists_topologically_slice_not_smoothly_slice/WorkspaceTest.lean +++ b/generated/exists_topologically_slice_not_smoothly_slice/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/faltings/WorkspaceTest.lean b/generated/faltings/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/faltings/WorkspaceTest.lean +++ b/generated/faltings/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/families_of_maps_b01/WorkspaceTest.lean b/generated/families_of_maps_b01/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/families_of_maps_b01/WorkspaceTest.lean +++ b/generated/families_of_maps_b01/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/fang_xia_tiling_partition_transitive/WorkspaceTest.lean b/generated/fang_xia_tiling_partition_transitive/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/fang_xia_tiling_partition_transitive/WorkspaceTest.lean +++ b/generated/fang_xia_tiling_partition_transitive/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/fary_milnor/WorkspaceTest.lean b/generated/fary_milnor/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/fary_milnor/WorkspaceTest.lean +++ b/generated/fary_milnor/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/fatou_julia_dichotomy/WorkspaceTest.lean b/generated/fatou_julia_dichotomy/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/fatou_julia_dichotomy/WorkspaceTest.lean +++ b/generated/fatou_julia_dichotomy/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/feit_thompson/WorkspaceTest.lean b/generated/feit_thompson/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/feit_thompson/WorkspaceTest.lean +++ b/generated/feit_thompson/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/fermat_last_theorem/WorkspaceTest.lean b/generated/fermat_last_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/fermat_last_theorem/WorkspaceTest.lean +++ b/generated/fermat_last_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/finite_graph_ramsey_theorem/WorkspaceTest.lean b/generated/finite_graph_ramsey_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/finite_graph_ramsey_theorem/WorkspaceTest.lean +++ b/generated/finite_graph_ramsey_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/finite_group_isSolvable_of_card_eq_prime_pow_mul_prime_pow/WorkspaceTest.lean b/generated/finite_group_isSolvable_of_card_eq_prime_pow_mul_prime_pow/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/finite_group_isSolvable_of_card_eq_prime_pow_mul_prime_pow/WorkspaceTest.lean +++ b/generated/finite_group_isSolvable_of_card_eq_prime_pow_mul_prime_pow/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/five_transitive_card_classification/WorkspaceTest.lean b/generated/five_transitive_card_classification/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/five_transitive_card_classification/WorkspaceTest.lean +++ b/generated/five_transitive_card_classification/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/four_manifold_not_smooth/WorkspaceTest.lean b/generated/four_manifold_not_smooth/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/four_manifold_not_smooth/WorkspaceTest.lean +++ b/generated/four_manifold_not_smooth/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/fourier_dirichlet_fejer/WorkspaceTest.lean b/generated/fourier_dirichlet_fejer/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/fourier_dirichlet_fejer/WorkspaceTest.lean +++ b/generated/fourier_dirichlet_fejer/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/fraser_kakeya_fourier_decay/WorkspaceTest.lean b/generated/fraser_kakeya_fourier_decay/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/fraser_kakeya_fourier_decay/WorkspaceTest.lean +++ b/generated/fraser_kakeya_fourier_decay/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/friedlander_iwaniec/WorkspaceTest.lean b/generated/friedlander_iwaniec/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/friedlander_iwaniec/WorkspaceTest.lean +++ b/generated/friedlander_iwaniec/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/frobenius_group_determinant/WorkspaceTest.lean b/generated/frobenius_group_determinant/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/frobenius_group_determinant/WorkspaceTest.lean +++ b/generated/frobenius_group_determinant/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/frobenius_kernel_isNormal/WorkspaceTest.lean b/generated/frobenius_kernel_isNormal/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/frobenius_kernel_isNormal/WorkspaceTest.lean +++ b/generated/frobenius_kernel_isNormal/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/fundamental_topos_theory/WorkspaceTest.lean b/generated/fundamental_topos_theory/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/fundamental_topos_theory/WorkspaceTest.lean +++ b/generated/fundamental_topos_theory/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/furstenberg_measure/WorkspaceTest.lean b/generated/furstenberg_measure/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/furstenberg_measure/WorkspaceTest.lean +++ b/generated/furstenberg_measure/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/furstenberg_topological/WorkspaceTest.lean b/generated/furstenberg_topological/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/furstenberg_topological/WorkspaceTest.lean +++ b/generated/furstenberg_topological/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/g2_irrep_tensor_square_decomp/WorkspaceTest.lean b/generated/g2_irrep_tensor_square_decomp/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/g2_irrep_tensor_square_decomp/WorkspaceTest.lean +++ b/generated/g2_irrep_tensor_square_decomp/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/gauss_wantzel_constructible_polygon/WorkspaceTest.lean b/generated/gauss_wantzel_constructible_polygon/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/gauss_wantzel_constructible_polygon/WorkspaceTest.lean +++ b/generated/gauss_wantzel_constructible_polygon/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/glAction_range_eq_centralizer_symAction/WorkspaceTest.lean b/generated/glAction_range_eq_centralizer_symAction/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/glAction_range_eq_centralizer_symAction/WorkspaceTest.lean +++ b/generated/glAction_range_eq_centralizer_symAction/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/glauberman_zStar/WorkspaceTest.lean b/generated/glauberman_zStar/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/glauberman_zStar/WorkspaceTest.lean +++ b/generated/glauberman_zStar/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/gleason_theorem_finite/WorkspaceTest.lean b/generated/gleason_theorem_finite/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/gleason_theorem_finite/WorkspaceTest.lean +++ b/generated/gleason_theorem_finite/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/gleason_theorem_separable/WorkspaceTest.lean b/generated/gleason_theorem_separable/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/gleason_theorem_separable/WorkspaceTest.lean +++ b/generated/gleason_theorem_separable/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/golod_shafarevich_inequality/WorkspaceTest.lean b/generated/golod_shafarevich_inequality/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/golod_shafarevich_inequality/WorkspaceTest.lean +++ b/generated/golod_shafarevich_inequality/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/gorenstein_walter/WorkspaceTest.lean b/generated/gorenstein_walter/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/gorenstein_walter/WorkspaceTest.lean +++ b/generated/gorenstein_walter/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/green_tao/WorkspaceTest.lean b/generated/green_tao/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/green_tao/WorkspaceTest.lean +++ b/generated/green_tao/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/hSpace_sphere_iff/WorkspaceTest.lean b/generated/hSpace_sphere_iff/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/hSpace_sphere_iff/WorkspaceTest.lean +++ b/generated/hSpace_sphere_iff/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/hadwiger/WorkspaceTest.lean b/generated/hadwiger/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/hadwiger/WorkspaceTest.lean +++ b/generated/hadwiger/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/halmos_generic_weak_mixing/WorkspaceTest.lean b/generated/halmos_generic_weak_mixing/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/halmos_generic_weak_mixing/WorkspaceTest.lean +++ b/generated/halmos_generic_weak_mixing/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/hausdorff_absolute_continuity/WorkspaceTest.lean b/generated/hausdorff_absolute_continuity/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/hausdorff_absolute_continuity/WorkspaceTest.lean +++ b/generated/hausdorff_absolute_continuity/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/hausdorff_hildebrandt_schoenberg/WorkspaceTest.lean b/generated/hausdorff_hildebrandt_schoenberg/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/hausdorff_hildebrandt_schoenberg/WorkspaceTest.lean +++ b/generated/hausdorff_hildebrandt_schoenberg/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/hausdorff_positivity_criterion/WorkspaceTest.lean b/generated/hausdorff_positivity_criterion/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/hausdorff_positivity_criterion/WorkspaceTest.lean +++ b/generated/hausdorff_positivity_criterion/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/heat_kernel_solves_heat_equation/WorkspaceTest.lean b/generated/heat_kernel_solves_heat_equation/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/heat_kernel_solves_heat_equation/WorkspaceTest.lean +++ b/generated/heat_kernel_solves_heat_equation/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/higman_infinite_simple/WorkspaceTest.lean b/generated/higman_infinite_simple/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/higman_infinite_simple/WorkspaceTest.lean +++ b/generated/higman_infinite_simple/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/hilbert_smith_padic_dimension_three/WorkspaceTest.lean b/generated/hilbert_smith_padic_dimension_three/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/hilbert_smith_padic_dimension_three/WorkspaceTest.lean +++ b/generated/hilbert_smith_padic_dimension_three/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/hippocrates_lunes/WorkspaceTest.lean b/generated/hippocrates_lunes/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/hippocrates_lunes/WorkspaceTest.lean +++ b/generated/hippocrates_lunes/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/honeycomb_connective_constant/WorkspaceTest.lean b/generated/honeycomb_connective_constant/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/honeycomb_connective_constant/WorkspaceTest.lean +++ b/generated/honeycomb_connective_constant/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/hopf_rinow/WorkspaceTest.lean b/generated/hopf_rinow/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/hopf_rinow/WorkspaceTest.lean +++ b/generated/hopf_rinow/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/hopf_s6_complex_structure/WorkspaceTest.lean b/generated/hopf_s6_complex_structure/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/hopf_s6_complex_structure/WorkspaceTest.lean +++ b/generated/hopf_s6_complex_structure/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/hopf_umlaufsatz/WorkspaceTest.lean b/generated/hopf_umlaufsatz/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/hopf_umlaufsatz/WorkspaceTest.lean +++ b/generated/hopf_umlaufsatz/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/hurewicz_h1_abelianization/WorkspaceTest.lean b/generated/hurewicz_h1_abelianization/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/hurewicz_h1_abelianization/WorkspaceTest.lean +++ b/generated/hurewicz_h1_abelianization/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/instance_hole_example/WorkspaceTest.lean b/generated/instance_hole_example/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/instance_hole_example/WorkspaceTest.lean +++ b/generated/instance_hole_example/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/irreducible_nonnegative_matrix_has_positive_eigenvector_at_spectralRadius/WorkspaceTest.lean b/generated/irreducible_nonnegative_matrix_has_positive_eigenvector_at_spectralRadius/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/irreducible_nonnegative_matrix_has_positive_eigenvector_at_spectralRadius/WorkspaceTest.lean +++ b/generated/irreducible_nonnegative_matrix_has_positive_eigenvector_at_spectralRadius/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/ising_2d_phase_transition/WorkspaceTest.lean b/generated/ising_2d_phase_transition/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/ising_2d_phase_transition/WorkspaceTest.lean +++ b/generated/ising_2d_phase_transition/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/isoperimetric_inequality/WorkspaceTest.lean b/generated/isoperimetric_inequality/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/isoperimetric_inequality/WorkspaceTest.lean +++ b/generated/isoperimetric_inequality/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/jacobian_challenge_alggeo/WorkspaceTest.lean b/generated/jacobian_challenge_alggeo/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/jacobian_challenge_alggeo/WorkspaceTest.lean +++ b/generated/jacobian_challenge_alggeo/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/jacobian_challenge_diffgeo/WorkspaceTest.lean b/generated/jacobian_challenge_diffgeo/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/jacobian_challenge_diffgeo/WorkspaceTest.lean +++ b/generated/jacobian_challenge_diffgeo/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/jordan_brouwer/WorkspaceTest.lean b/generated/jordan_brouwer/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/jordan_brouwer/WorkspaceTest.lean +++ b/generated/jordan_brouwer/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/jordan_curve/WorkspaceTest.lean b/generated/jordan_curve/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/jordan_curve/WorkspaceTest.lean +++ b/generated/jordan_curve/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/jordan_normal_form/WorkspaceTest.lean b/generated/jordan_normal_form/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/jordan_normal_form/WorkspaceTest.lean +++ b/generated/jordan_normal_form/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/kakutani_fixed_point/WorkspaceTest.lean b/generated/kakutani_fixed_point/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/kakutani_fixed_point/WorkspaceTest.lean +++ b/generated/kakutani_fixed_point/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/kam_invariant_curve/WorkspaceTest.lean b/generated/kam_invariant_curve/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/kam_invariant_curve/WorkspaceTest.lean +++ b/generated/kam_invariant_curve/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/kepler_conjecture/WorkspaceTest.lean b/generated/kepler_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/kepler_conjecture/WorkspaceTest.lean +++ b/generated/kepler_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/kirk_normal_structure/WorkspaceTest.lean b/generated/kirk_normal_structure/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/kirk_normal_structure/WorkspaceTest.lean +++ b/generated/kirk_normal_structure/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/klartag_packing/WorkspaceTest.lean b/generated/klartag_packing/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/klartag_packing/WorkspaceTest.lean +++ b/generated/klartag_packing/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/kollar_lieblich_olsson_sawin/WorkspaceTest.lean b/generated/kollar_lieblich_olsson_sawin/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/kollar_lieblich_olsson_sawin/WorkspaceTest.lean +++ b/generated/kollar_lieblich_olsson_sawin/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/kolmogorov_arnold_superposition/WorkspaceTest.lean b/generated/kolmogorov_arnold_superposition/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/kolmogorov_arnold_superposition/WorkspaceTest.lean +++ b/generated/kolmogorov_arnold_superposition/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/koszul_formula/WorkspaceTest.lean b/generated/koszul_formula/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/koszul_formula/WorkspaceTest.lean +++ b/generated/koszul_formula/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/landsberg_schaar/WorkspaceTest.lean b/generated/landsberg_schaar/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/landsberg_schaar/WorkspaceTest.lean +++ b/generated/landsberg_schaar/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/lax_approximation/WorkspaceTest.lean b/generated/lax_approximation/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/lax_approximation/WorkspaceTest.lean +++ b/generated/lax_approximation/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/levi_civita_exists_unique/WorkspaceTest.lean b/generated/levi_civita_exists_unique/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/levi_civita_exists_unique/WorkspaceTest.lean +++ b/generated/levi_civita_exists_unique/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/lidskii_inequality/WorkspaceTest.lean b/generated/lidskii_inequality/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/lidskii_inequality/WorkspaceTest.lean +++ b/generated/lidskii_inequality/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/lidskii_last/WorkspaceTest.lean b/generated/lidskii_last/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/lidskii_last/WorkspaceTest.lean +++ b/generated/lidskii_last/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/lindemann/WorkspaceTest.lean b/generated/lindemann/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/lindemann/WorkspaceTest.lean +++ b/generated/lindemann/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/lindemann_weierstrass/WorkspaceTest.lean b/generated/lindemann_weierstrass/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/lindemann_weierstrass/WorkspaceTest.lean +++ b/generated/lindemann_weierstrass/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/linear_ode_asymptotic_stability/WorkspaceTest.lean b/generated/linear_ode_asymptotic_stability/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/linear_ode_asymptotic_stability/WorkspaceTest.lean +++ b/generated/linear_ode_asymptotic_stability/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/linnik/WorkspaceTest.lean b/generated/linnik/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/linnik/WorkspaceTest.lean +++ b/generated/linnik/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/liouville_arnold/WorkspaceTest.lean b/generated/liouville_arnold/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/liouville_arnold/WorkspaceTest.lean +++ b/generated/liouville_arnold/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/list_append_singleton_length/WorkspaceTest.lean b/generated/list_append_singleton_length/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/list_append_singleton_length/WorkspaceTest.lean +++ b/generated/list_append_singleton_length/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/lp_maximum_principle/WorkspaceTest.lean b/generated/lp_maximum_principle/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/lp_maximum_principle/WorkspaceTest.lean +++ b/generated/lp_maximum_principle/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/m23_irrep_tensor_square_decomp/WorkspaceTest.lean b/generated/m23_irrep_tensor_square_decomp/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/m23_irrep_tensor_square_decomp/WorkspaceTest.lean +++ b/generated/m23_irrep_tensor_square_decomp/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/mandelbar_not_path_connected/WorkspaceTest.lean b/generated/mandelbar_not_path_connected/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/mandelbar_not_path_connected/WorkspaceTest.lean +++ b/generated/mandelbar_not_path_connected/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/mandelbrot_boundary_dimh/WorkspaceTest.lean b/generated/mandelbrot_boundary_dimh/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/mandelbrot_boundary_dimh/WorkspaceTest.lean +++ b/generated/mandelbrot_boundary_dimh/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/mandelbrot_connected/WorkspaceTest.lean b/generated/mandelbrot_connected/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/mandelbrot_connected/WorkspaceTest.lean +++ b/generated/mandelbrot_connected/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/manolescu_triangulation_disproof/WorkspaceTest.lean b/generated/manolescu_triangulation_disproof/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/manolescu_triangulation_disproof/WorkspaceTest.lean +++ b/generated/manolescu_triangulation_disproof/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/margulis_ruelle/WorkspaceTest.lean b/generated/margulis_ruelle/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/margulis_ruelle/WorkspaceTest.lean +++ b/generated/margulis_ruelle/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/martinet_totally_real_towers/WorkspaceTest.lean b/generated/martinet_totally_real_towers/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/martinet_totally_real_towers/WorkspaceTest.lean +++ b/generated/martinet_totally_real_towers/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/mazur_torsion/WorkspaceTest.lean b/generated/mazur_torsion/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/mazur_torsion/WorkspaceTest.lean +++ b/generated/mazur_torsion/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/mem_convexHull_finset_extremePoints_of_mem_compact_convex/WorkspaceTest.lean b/generated/mem_convexHull_finset_extremePoints_of_mem_compact_convex/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/mem_convexHull_finset_extremePoints_of_mem_compact_convex/WorkspaceTest.lean +++ b/generated/mem_convexHull_finset_extremePoints_of_mem_compact_convex/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/mergelyan_theorem/WorkspaceTest.lean b/generated/mergelyan_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/mergelyan_theorem/WorkspaceTest.lean +++ b/generated/mergelyan_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/mihailescu/WorkspaceTest.lean b/generated/mihailescu/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/mihailescu/WorkspaceTest.lean +++ b/generated/mihailescu/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/milnor_exotic_sphere_seven/WorkspaceTest.lean b/generated/milnor_exotic_sphere_seven/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/milnor_exotic_sphere_seven/WorkspaceTest.lean +++ b/generated/milnor_exotic_sphere_seven/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/monge_kantorovich/WorkspaceTest.lean b/generated/monge_kantorovich/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/monge_kantorovich/WorkspaceTest.lean +++ b/generated/monge_kantorovich/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/moran_equality_affine/WorkspaceTest.lean b/generated/moran_equality_affine/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/moran_equality_affine/WorkspaceTest.lean +++ b/generated/moran_equality_affine/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/morley_categoricity_theorem/WorkspaceTest.lean b/generated/morley_categoricity_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/morley_categoricity_theorem/WorkspaceTest.lean +++ b/generated/morley_categoricity_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/morley_theorem/WorkspaceTest.lean b/generated/morley_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/morley_theorem/WorkspaceTest.lean +++ b/generated/morley_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/morse_inequality/WorkspaceTest.lean b/generated/morse_inequality/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/morse_inequality/WorkspaceTest.lean +++ b/generated/morse_inequality/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/mostow_rigidity/WorkspaceTest.lean b/generated/mostow_rigidity/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/mostow_rigidity/WorkspaceTest.lean +++ b/generated/mostow_rigidity/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/mountain_pass/WorkspaceTest.lean b/generated/mountain_pass/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/mountain_pass/WorkspaceTest.lean +++ b/generated/mountain_pass/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/mulCayley_connected_iff_closure_eq_top/WorkspaceTest.lean b/generated/mulCayley_connected_iff_closure_eq_top/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/mulCayley_connected_iff_closure_eq_top/WorkspaceTest.lean +++ b/generated/mulCayley_connected_iff_closure_eq_top/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/multi_hole_helpers_example/WorkspaceTest.lean b/generated/multi_hole_helpers_example/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/multi_hole_helpers_example/WorkspaceTest.lean +++ b/generated/multi_hole_helpers_example/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/nash_equilibrium_exists/WorkspaceTest.lean b/generated/nash_equilibrium_exists/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/nash_equilibrium_exists/WorkspaceTest.lean +++ b/generated/nash_equilibrium_exists/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/neukirch_uchida/WorkspaceTest.lean b/generated/neukirch_uchida/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/neukirch_uchida/WorkspaceTest.lean +++ b/generated/neukirch_uchida/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/newlander_nirenberg/WorkspaceTest.lean b/generated/newlander_nirenberg/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/newlander_nirenberg/WorkspaceTest.lean +++ b/generated/newlander_nirenberg/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/nikolov_segal/WorkspaceTest.lean b/generated/nikolov_segal/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/nikolov_segal/WorkspaceTest.lean +++ b/generated/nikolov_segal/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/noncomputable_hole_example/WorkspaceTest.lean b/generated/noncomputable_hole_example/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/noncomputable_hole_example/WorkspaceTest.lean +++ b/generated/noncomputable_hole_example/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/nonlinear_three_manifold_group/WorkspaceTest.lean b/generated/nonlinear_three_manifold_group/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/nonlinear_three_manifold_group/WorkspaceTest.lean +++ b/generated/nonlinear_three_manifold_group/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/normal_spectral_theorem/WorkspaceTest.lean b/generated/normal_spectral_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/normal_spectral_theorem/WorkspaceTest.lean +++ b/generated/normal_spectral_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/novikov_unsolvable/WorkspaceTest.lean b/generated/novikov_unsolvable/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/novikov_unsolvable/WorkspaceTest.lean +++ b/generated/novikov_unsolvable/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/nyquist_shannon_sampling/WorkspaceTest.lean b/generated/nyquist_shannon_sampling/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/nyquist_shannon_sampling/WorkspaceTest.lean +++ b/generated/nyquist_shannon_sampling/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/oppenheim_inequality/WorkspaceTest.lean b/generated/oppenheim_inequality/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/oppenheim_inequality/WorkspaceTest.lean +++ b/generated/oppenheim_inequality/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/ore_conjecture/WorkspaceTest.lean b/generated/ore_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/ore_conjecture/WorkspaceTest.lean +++ b/generated/ore_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/ornstein_weiss_rokhlin/WorkspaceTest.lean b/generated/ornstein_weiss_rokhlin/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/ornstein_weiss_rokhlin/WorkspaceTest.lean +++ b/generated/ornstein_weiss_rokhlin/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/parallel_postulate_independent/WorkspaceTest.lean b/generated/parallel_postulate_independent/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/parallel_postulate_independent/WorkspaceTest.lean +++ b/generated/parallel_postulate_independent/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/pardon_torus_knot_distortion/WorkspaceTest.lean b/generated/pardon_torus_knot_distortion/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/pardon_torus_knot_distortion/WorkspaceTest.lean +++ b/generated/pardon_torus_knot_distortion/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/pascal/WorkspaceTest.lean b/generated/pascal/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/pascal/WorkspaceTest.lean +++ b/generated/pascal/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/peano_existence/WorkspaceTest.lean b/generated/peano_existence/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/peano_existence/WorkspaceTest.lean +++ b/generated/peano_existence/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/pell_solution_convergent/WorkspaceTest.lean b/generated/pell_solution_convergent/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/pell_solution_convergent/WorkspaceTest.lean +++ b/generated/pell_solution_convergent/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/permute_to_unimodal/WorkspaceTest.lean b/generated/permute_to_unimodal/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/permute_to_unimodal/WorkspaceTest.lean +++ b/generated/permute_to_unimodal/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/pesin_formula/WorkspaceTest.lean b/generated/pesin_formula/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/pesin_formula/WorkspaceTest.lean +++ b/generated/pesin_formula/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/pi1_circle_mulEquiv_int/WorkspaceTest.lean b/generated/pi1_circle_mulEquiv_int/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/pi1_circle_mulEquiv_int/WorkspaceTest.lean +++ b/generated/pi1_circle_mulEquiv_int/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/pi3_sphere_two_mulEquiv_int/WorkspaceTest.lean b/generated/pi3_sphere_two_mulEquiv_int/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/pi3_sphere_two_mulEquiv_int/WorkspaceTest.lean +++ b/generated/pi3_sphere_two_mulEquiv_int/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/pi6_sphere_three_mulEquiv_zmod_twelve/WorkspaceTest.lean b/generated/pi6_sphere_three_mulEquiv_zmod_twelve/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/pi6_sphere_three_mulEquiv_zmod_twelve/WorkspaceTest.lean +++ b/generated/pi6_sphere_three_mulEquiv_zmod_twelve/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/pi_sphere_infinite_iff/WorkspaceTest.lean b/generated/pi_sphere_infinite_iff/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/pi_sphere_infinite_iff/WorkspaceTest.lean +++ b/generated/pi_sphere_infinite_iff/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/pi_succ_sphere_n_mulEquiv_zmod_two/WorkspaceTest.lean b/generated/pi_succ_sphere_n_mulEquiv_zmod_two/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/pi_succ_sphere_n_mulEquiv_zmod_two/WorkspaceTest.lean +++ b/generated/pi_succ_sphere_n_mulEquiv_zmod_two/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/pick/WorkspaceTest.lean b/generated/pick/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/pick/WorkspaceTest.lean +++ b/generated/pick/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/pin_sphere_n_mulEquiv_int/WorkspaceTest.lean b/generated/pin_sphere_n_mulEquiv_int/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/pin_sphere_n_mulEquiv_int/WorkspaceTest.lean +++ b/generated/pin_sphere_n_mulEquiv_int/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/platonic_classification/WorkspaceTest.lean b/generated/platonic_classification/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/platonic_classification/WorkspaceTest.lean +++ b/generated/platonic_classification/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/poincare_3d_smooth/WorkspaceTest.lean b/generated/poincare_3d_smooth/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/poincare_3d_smooth/WorkspaceTest.lean +++ b/generated/poincare_3d_smooth/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/poincare_3d_topological/WorkspaceTest.lean b/generated/poincare_3d_topological/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/poincare_3d_topological/WorkspaceTest.lean +++ b/generated/poincare_3d_topological/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/poincare_4d_topological/WorkspaceTest.lean b/generated/poincare_4d_topological/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/poincare_4d_topological/WorkspaceTest.lean +++ b/generated/poincare_4d_topological/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/poincare_bendixson/WorkspaceTest.lean b/generated/poincare_bendixson/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/poincare_bendixson/WorkspaceTest.lean +++ b/generated/poincare_bendixson/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/poincare_high_dim_topological/WorkspaceTest.lean b/generated/poincare_high_dim_topological/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/poincare_high_dim_topological/WorkspaceTest.lean +++ b/generated/poincare_high_dim_topological/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/poincare_siegel_linearisation/WorkspaceTest.lean b/generated/poincare_siegel_linearisation/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/poincare_siegel_linearisation/WorkspaceTest.lean +++ b/generated/poincare_siegel_linearisation/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/posSemidef_map_exp/WorkspaceTest.lean b/generated/posSemidef_map_exp/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/posSemidef_map_exp/WorkspaceTest.lean +++ b/generated/posSemidef_map_exp/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/q_tspp/WorkspaceTest.lean b/generated/q_tspp/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/q_tspp/WorkspaceTest.lean +++ b/generated/q_tspp/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/rado_riemannSurface/WorkspaceTest.lean b/generated/rado_riemannSurface/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/rado_riemannSurface/WorkspaceTest.lean +++ b/generated/rado_riemannSurface/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/radon_transform_inversion/WorkspaceTest.lean b/generated/radon_transform_inversion/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/radon_transform_inversion/WorkspaceTest.lean +++ b/generated/radon_transform_inversion/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/ramanujan_petersson/WorkspaceTest.lean b/generated/ramanujan_petersson/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/ramanujan_petersson/WorkspaceTest.lean +++ b/generated/ramanujan_petersson/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/rcf_quantifier_elimination/WorkspaceTest.lean b/generated/rcf_quantifier_elimination/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/rcf_quantifier_elimination/WorkspaceTest.lean +++ b/generated/rcf_quantifier_elimination/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/regular_value_ae/WorkspaceTest.lean b/generated/regular_value_ae/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/regular_value_ae/WorkspaceTest.lean +++ b/generated/regular_value_ae/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/riemann_hypothesis_iff_lagarias_elementary_criterion/WorkspaceTest.lean b/generated/riemann_hypothesis_iff_lagarias_elementary_criterion/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/riemann_hypothesis_iff_lagarias_elementary_criterion/WorkspaceTest.lean +++ b/generated/riemann_hypothesis_iff_lagarias_elementary_criterion/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/riesz_brothers_theorem/WorkspaceTest.lean b/generated/riesz_brothers_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/riesz_brothers_theorem/WorkspaceTest.lean +++ b/generated/riesz_brothers_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/rising_sun_lemma/WorkspaceTest.lean b/generated/rising_sun_lemma/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/rising_sun_lemma/WorkspaceTest.lean +++ b/generated/rising_sun_lemma/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/rokhlin_lemma/WorkspaceTest.lean b/generated/rokhlin_lemma/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/rokhlin_lemma/WorkspaceTest.lean +++ b/generated/rokhlin_lemma/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/rouche_zero_count_eq/WorkspaceTest.lean b/generated/rouche_zero_count_eq/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/rouche_zero_count_eq/WorkspaceTest.lean +++ b/generated/rouche_zero_count_eq/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/runge_theorem/WorkspaceTest.lean b/generated/runge_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/runge_theorem/WorkspaceTest.lean +++ b/generated/runge_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/sard_theorem/WorkspaceTest.lean b/generated/sard_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/sard_theorem/WorkspaceTest.lean +++ b/generated/sard_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/schauder_fixed_point/WorkspaceTest.lean b/generated/schauder_fixed_point/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/schauder_fixed_point/WorkspaceTest.lean +++ b/generated/schauder_fixed_point/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/schlafli_classification/WorkspaceTest.lean b/generated/schlafli_classification/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/schlafli_classification/WorkspaceTest.lean +++ b/generated/schlafli_classification/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/schmidt_subspace/WorkspaceTest.lean b/generated/schmidt_subspace/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/schmidt_subspace/WorkspaceTest.lean +++ b/generated/schmidt_subspace/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/schoenflies/WorkspaceTest.lean b/generated/schoenflies/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/schoenflies/WorkspaceTest.lean +++ b/generated/schoenflies/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/schreier_conjecture/WorkspaceTest.lean b/generated/schreier_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/schreier_conjecture/WorkspaceTest.lean +++ b/generated/schreier_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/semilinear_poisson_radial_symmetry/WorkspaceTest.lean b/generated/semilinear_poisson_radial_symmetry/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/semilinear_poisson_radial_symmetry/WorkspaceTest.lean +++ b/generated/semilinear_poisson_radial_symmetry/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/shafarevich_relation_rank_bound/WorkspaceTest.lean b/generated/shafarevich_relation_rank_bound/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/shafarevich_relation_rank_bound/WorkspaceTest.lean +++ b/generated/shafarevich_relation_rank_bound/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/shafarevich_solvable_galois/WorkspaceTest.lean b/generated/shafarevich_solvable_galois/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/shafarevich_solvable_galois/WorkspaceTest.lean +++ b/generated/shafarevich_solvable_galois/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/shannon_capacity_pentagon/WorkspaceTest.lean b/generated/shannon_capacity_pentagon/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/shannon_capacity_pentagon/WorkspaceTest.lean +++ b/generated/shannon_capacity_pentagon/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/smale_conjecture/WorkspaceTest.lean b/generated/smale_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/smale_conjecture/WorkspaceTest.lean +++ b/generated/smale_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/smooth_knot_has_quadrisecant/WorkspaceTest.lean b/generated/smooth_knot_has_quadrisecant/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/smooth_knot_has_quadrisecant/WorkspaceTest.lean +++ b/generated/smooth_knot_has_quadrisecant/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/sobolev_embedding_morrey/WorkspaceTest.lean b/generated/sobolev_embedding_morrey/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/sobolev_embedding_morrey/WorkspaceTest.lean +++ b/generated/sobolev_embedding_morrey/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/solvable_by_radicals_converse/WorkspaceTest.lean b/generated/solvable_by_radicals_converse/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/solvable_by_radicals_converse/WorkspaceTest.lean +++ b/generated/solvable_by_radicals_converse/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/space_groups_230/WorkspaceTest.lean b/generated/space_groups_230/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/space_groups_230/WorkspaceTest.lean +++ b/generated/space_groups_230/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/sphere_theorem_differentiable/WorkspaceTest.lean b/generated/sphere_theorem_differentiable/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/sphere_theorem_differentiable/WorkspaceTest.lean +++ b/generated/sphere_theorem_differentiable/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/sphere_theorem_topological/WorkspaceTest.lean b/generated/sphere_theorem_topological/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/sphere_theorem_topological/WorkspaceTest.lean +++ b/generated/sphere_theorem_topological/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/stable_unstable_manifolds/WorkspaceTest.lean b/generated/stable_unstable_manifolds/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/stable_unstable_manifolds/WorkspaceTest.lean +++ b/generated/stable_unstable_manifolds/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/strong_mason_conjecture/WorkspaceTest.lean b/generated/strong_mason_conjecture/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/strong_mason_conjecture/WorkspaceTest.lean +++ b/generated/strong_mason_conjecture/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/strong_subadditivity/WorkspaceTest.lean b/generated/strong_subadditivity/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/strong_subadditivity/WorkspaceTest.lean +++ b/generated/strong_subadditivity/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/sturm/WorkspaceTest.lean b/generated/sturm/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/sturm/WorkspaceTest.lean +++ b/generated/sturm/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/sturm_separation/WorkspaceTest.lean b/generated/sturm_separation/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/sturm_separation/WorkspaceTest.lean +++ b/generated/sturm_separation/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/substInv_X_sub_X_sq_eq_catalan/WorkspaceTest.lean b/generated/substInv_X_sub_X_sq_eq_catalan/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/substInv_X_sub_X_sq_eq_catalan/WorkspaceTest.lean +++ b/generated/substInv_X_sub_X_sq_eq_catalan/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/symAction_range_eq_centralizer_glAction/WorkspaceTest.lean b/generated/symAction_range_eq_centralizer_glAction/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/symAction_range_eq_centralizer_glAction/WorkspaceTest.lean +++ b/generated/symAction_range_eq_centralizer_glAction/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/symplectic_matrix_det/WorkspaceTest.lean b/generated/symplectic_matrix_det/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/symplectic_matrix_det/WorkspaceTest.lean +++ b/generated/symplectic_matrix_det/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/szemeredi/WorkspaceTest.lean b/generated/szemeredi/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/szemeredi/WorkspaceTest.lean +++ b/generated/szemeredi/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/ten_martini_problem/WorkspaceTest.lean b/generated/ten_martini_problem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/ten_martini_problem/WorkspaceTest.lean +++ b/generated/ten_martini_problem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/thue_siegel_roth/WorkspaceTest.lean b/generated/thue_siegel_roth/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/thue_siegel_roth/WorkspaceTest.lean +++ b/generated/thue_siegel_roth/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/topological_classification_of_surfaces/WorkspaceTest.lean b/generated/topological_classification_of_surfaces/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/topological_classification_of_surfaces/WorkspaceTest.lean +++ b/generated/topological_classification_of_surfaces/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/trace_cayley_hamilton_newton/WorkspaceTest.lean b/generated/trace_cayley_hamilton_newton/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/trace_cayley_hamilton_newton/WorkspaceTest.lean +++ b/generated/trace_cayley_hamilton_newton/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/turing_recursive_equiv/WorkspaceTest.lean b/generated/turing_recursive_equiv/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/turing_recursive_equiv/WorkspaceTest.lean +++ b/generated/turing_recursive_equiv/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/tverberg_theorem/WorkspaceTest.lean b/generated/tverberg_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/tverberg_theorem/WorkspaceTest.lean +++ b/generated/tverberg_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/two_ninety_theorem/WorkspaceTest.lean b/generated/two_ninety_theorem/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/two_ninety_theorem/WorkspaceTest.lean +++ b/generated/two_ninety_theorem/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/two_plus_two/WorkspaceTest.lean b/generated/two_plus_two/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/two_plus_two/WorkspaceTest.lean +++ b/generated/two_plus_two/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/uniformization/WorkspaceTest.lean b/generated/uniformization/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/uniformization/WorkspaceTest.lean +++ b/generated/uniformization/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/unit_distance_upper_bound/WorkspaceTest.lean b/generated/unit_distance_upper_bound/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/unit_distance_upper_bound/WorkspaceTest.lean +++ b/generated/unit_distance_upper_bound/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/upper_bound_simplicial_spheres/WorkspaceTest.lean b/generated/upper_bound_simplicial_spheres/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/upper_bound_simplicial_spheres/WorkspaceTest.lean +++ b/generated/upper_bound_simplicial_spheres/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/variable_binder_example/WorkspaceTest.lean b/generated/variable_binder_example/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/variable_binder_example/WorkspaceTest.lean +++ b/generated/variable_binder_example/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/vinogradov_mean_value/WorkspaceTest.lean b/generated/vinogradov_mean_value/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/vinogradov_mean_value/WorkspaceTest.lean +++ b/generated/vinogradov_mean_value/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/vonNeumann_doubleCommutant_tfae/WorkspaceTest.lean b/generated/vonNeumann_doubleCommutant_tfae/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/vonNeumann_doubleCommutant_tfae/WorkspaceTest.lean +++ b/generated/vonNeumann_doubleCommutant_tfae/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/wallpaper_groups_17/WorkspaceTest.lean b/generated/wallpaper_groups_17/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/wallpaper_groups_17/WorkspaceTest.lean +++ b/generated/wallpaper_groups_17/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/wang_zahl_kakeya_dimH/WorkspaceTest.lean b/generated/wang_zahl_kakeya_dimH/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/wang_zahl_kakeya_dimH/WorkspaceTest.lean +++ b/generated/wang_zahl_kakeya_dimH/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/watanabe_four_dim_smale_disproof/WorkspaceTest.lean b/generated/watanabe_four_dim_smale_disproof/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/watanabe_four_dim_smale_disproof/WorkspaceTest.lean +++ b/generated/watanabe_four_dim_smale_disproof/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/weak_goldbach/WorkspaceTest.lean b/generated/weak_goldbach/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/weak_goldbach/WorkspaceTest.lean +++ b/generated/weak_goldbach/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/weak_morse_inequality/WorkspaceTest.lean b/generated/weak_morse_inequality/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/weak_morse_inequality/WorkspaceTest.lean +++ b/generated/weak_morse_inequality/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/weil_conjectures/WorkspaceTest.lean b/generated/weil_conjectures/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/weil_conjectures/WorkspaceTest.lean +++ b/generated/weil_conjectures/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/weinstein_conjecture_dim3/WorkspaceTest.lean b/generated/weinstein_conjecture_dim3/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/weinstein_conjecture_dim3/WorkspaceTest.lean +++ b/generated/weinstein_conjecture_dim3/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/whitney_embedding/WorkspaceTest.lean b/generated/whitney_embedding/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/whitney_embedding/WorkspaceTest.lean +++ b/generated/whitney_embedding/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/wieferich_g_three/WorkspaceTest.lean b/generated/wieferich_g_three/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/wieferich_g_three/WorkspaceTest.lean +++ b/generated/wieferich_g_three/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/wiener_atom_detection/WorkspaceTest.lean b/generated/wiener_atom_detection/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/wiener_atom_detection/WorkspaceTest.lean +++ b/generated/wiener_atom_detection/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/wiener_inverse_closed/WorkspaceTest.lean b/generated/wiener_inverse_closed/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/wiener_inverse_closed/WorkspaceTest.lean +++ b/generated/wiener_inverse_closed/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/wiener_levy_analytic_calculus/WorkspaceTest.lean b/generated/wiener_levy_analytic_calculus/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/wiener_levy_analytic_calculus/WorkspaceTest.lean +++ b/generated/wiener_levy_analytic_calculus/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/wigner_semicircle/WorkspaceTest.lean b/generated/wigner_semicircle/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/wigner_semicircle/WorkspaceTest.lean +++ b/generated/wigner_semicircle/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/generated/zhang_bounded_prime_gaps/WorkspaceTest.lean b/generated/zhang_bounded_prime_gaps/WorkspaceTest.lean index b16470734..b63bbd35d 100644 --- a/generated/zhang_bounded_prime_gaps/WorkspaceTest.lean +++ b/generated/zhang_bounded_prime_gaps/WorkspaceTest.lean @@ -20,39 +20,19 @@ private def trustedSearchPath (roots : Array System.FilePath) (value : String) : catch _ => pure () return dirs.toString -/-- Resolve a tool using only the trusted search path, and reject workspace overrides. -/ -private def trustedTool (roots : Array System.FilePath) - (env : Array (String × Option String)) (envName fallback : String) : +/-- Use the executable supplied by the invoking Lake, outside writable build roots. -/ +private def trustedTool (roots : Array System.FilePath) (tool : System.FilePath) : IO String := do - let tool := (← IO.getEnv envName).getD fallback - let result ← IO.Process.output { - cmd := "which" - args := #["--", tool] - env - } - if result.exitCode != 0 then - throw <| IO.userError s!"Cannot find trusted tool for {envName}: {tool}" - let resolved ← IO.FS.realPath result.stdout.trimAscii.toString + let resolved ← IO.FS.realPath tool if withinWorkspace roots resolved then - throw <| IO.userError s!"{envName} must point outside the evaluation workspace and its writable cache: {resolved}" + throw <| IO.userError s!"Tool must point outside the evaluation workspace and its writable cache: {resolved}" return resolved.toString -/-- Invoke comparator on this workspace, forcing the external nanoda kernel on. - -nanoda is a global requirement of the eval, not a per-problem option: every -solution must be accepted by comparator **and** replayed through nanoda's -independent kernel. Rather than encode that in each workspace's `config.json`, -this harness reads the committed config, overrides `enable_nanoda := true`, and -hands the result to comparator — so nanoda runs regardless of what the file on -disk says. This mirrors the comparator-live "gold standard" setup, which forces -nanoda at the invocation site and leaves project configs untouched. - -Lake has already supplied LEAN_PATH when it starts this executable. Before -elaboration, remove workspace paths from executable/library lookup and pin all -comparator tools to absolute paths outside the workspace and its writable cache. Comparator's later -supervisor invocations must not resolve tools from submission-writable `.lake`. -/ +/-- Run the toolchain's comparator, enforcing bundled NanoDa as well as Lean. +Lake supplies LAKE, LEAN_SYSROOT, and LEAN_PATH to this trusted test driver. +Filter executable/library lookup before starting the outer supervisor; submission +elaboration belongs only inside comparator's sandboxes. -/ def main : IO UInt32 := do - let comparatorBin := (← IO.getEnv "COMPARATOR_BIN").getD "comparator" try let workspace ← IO.FS.realPath (← IO.currentDir) let roots := #[workspace, ← IO.FS.realPath (workspace / ".lake")] @@ -64,30 +44,28 @@ def main : IO UInt32 := do if let some value ← IO.getEnv envName then let value ← trustedSearchPath roots value env := env.push (envName, if value.isEmpty then none else some value) - let comparator ← trustedTool roots env "COMPARATOR_BIN" "comparator" - let landrun ← trustedTool roots env "COMPARATOR_LANDRUN" "landrun" - let exporter ← trustedTool roots env "COMPARATOR_LEAN4EXPORT" "lean4export" - let nanoda ← trustedTool roots env "COMPARATOR_NANODA" "nanoda_bin" - env := env ++ #[ - ("COMPARATOR_LANDRUN", some landrun), - ("COMPARATOR_LEAN4EXPORT", some exporter), - ("COMPARATOR_NANODA", some nanoda) - ] + let some lake ← IO.getEnv "LAKE" + | throw <| IO.userError "Run this driver with `lake test` (LAKE is missing)." + let some sysroot ← IO.getEnv "LEAN_SYSROOT" + | throw <| IO.userError "Run this driver with `lake test` (LEAN_SYSROOT is missing)." + let lake ← trustedTool roots lake + let nanoda ← trustedTool roots ((System.FilePath.mk sysroot) / "bin" / "nanoda_bin") let configText ← IO.FS.readFile "config.json" let config ← IO.ofExcept (Json.parse configText) - let config := config.setObjVal! "enable_nanoda" (Json.bool true) + let config := config.setObjVal! "enable_nanoda" (Json.bool false) + let config := config.setObjVal! "external_kernels" + (Json.mkObj [("nanoda", Json.arr #[Json.str nanoda])]) IO.FS.withTempFile fun handle enforcedPath => do handle.putStr config.pretty handle.flush let child ← IO.Process.spawn { - cmd := comparator - args := #[enforcedPath.toString] + cmd := lake + args := #["comparator", "--config", enforcedPath.toString] env } child.wait catch err => - IO.eprintln s!"Failed to run comparator via `{comparatorBin}`." - IO.eprintln "Install comparator, landrun, lean4export, and nanoda_bin outside this workspace, on PATH or through the COMPARATOR_* overrides." - IO.eprintln "See the root repository README for comparator setup details, including landrun, lean4export, and nanoda." + IO.eprintln "Failed to run `lake comparator`." + IO.eprintln "Install the pinned Lean toolchain and bubblewrap; run this workspace with `lake test`." IO.eprintln s!"Original error: {err}" - pure 1 + pure 2 diff --git a/scripts/install_bwrap.sh b/scripts/install_bwrap.sh new file mode 100644 index 000000000..f9d6bb3b0 --- /dev/null +++ b/scripts/install_bwrap.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +# Build bubblewrap from the pinned upstream release tarball, in the trusted phase, and +# print the path of the resulting binary. Palomar binds into candidate-written trees on +# every phase after the first, which is the pattern GHSA-pxhw-h44j-8pfx (fixed in 0.12.0) +# concerns, so the distribution's older package is not used. +# +# On kernels where unprivileged user namespaces are AppArmor-restricted (Ubuntu 24.04: +# kernel.apparmor_restrict_unprivileged_userns=1) a profile naming this binary is loaded; +# it grants nothing but the `userns` permission, and only to this path. +set -euo pipefail + +BWRAP_VERSION="0.12.0" +BWRAP_SHA256="9760d007363e3abba7c747489910f9f82d9fca53ba3bd3282e396fa3c97a3314" +PREFIX="${1:?usage: install_bwrap.sh }" +case "$PREFIX" in + /*) ;; + *) echo "install_bwrap: the install directory must be an absolute path" >&2; exit 2 ;; +esac +if [[ "$PREFIX" =~ [[:space:]] ]]; then + # The path is written into an AppArmor profile attachment, where a space + # would need quoting that the profile syntax and this script do not share. + echo "install_bwrap: the install directory must not contain whitespace" >&2 + exit 2 +fi + +mkdir -p "$PREFIX" +PREFIX="$(cd "$PREFIX" && pwd -P)" +work="$(mktemp -d)" +trap 'rm -rf "$work"' EXIT +curl --fail --location --silent --show-error --proto '=https' --tlsv1.2 \ + --output "$work/bubblewrap.tar.xz" \ + "https://github.com/containers/bubblewrap/releases/download/v${BWRAP_VERSION}/bubblewrap-${BWRAP_VERSION}.tar.xz" +echo "${BWRAP_SHA256} $work/bubblewrap.tar.xz" | sha256sum --check --quiet +tar -xJf "$work/bubblewrap.tar.xz" -C "$work" +( + cd "$work/bubblewrap-${BWRAP_VERSION}" + meson setup build -Dselinux=disabled -Dman=disabled -Dbash_completion=disabled \ + -Dzsh_completion=disabled -Dtests=false >/dev/null + ninja -C build >/dev/null +) +install -m 0755 "$work/bubblewrap-${BWRAP_VERSION}/build/bwrap" "$PREFIX/bwrap" + +if [ "$(sysctl -n kernel.apparmor_restrict_unprivileged_userns 2>/dev/null || echo 0)" = 1 ]; then + if ! command -v apparmor_parser >/dev/null; then + echo "install_bwrap: user namespaces are AppArmor-restricted and apparmor_parser is missing" >&2 + exit 1 + fi + profile="/etc/apparmor.d/palomar-bwrap" + printf '%s\n' 'abi ,' 'include ' \ + "profile palomar-bwrap $PREFIX/bwrap flags=(unconfined) {" ' userns,' '}' \ + | sudo tee "$profile" >/dev/null + sudo apparmor_parser -r "$profile" +fi +"$PREFIX/bwrap" --version >&2 +echo "$PREFIX/bwrap" diff --git a/scripts/sandbox_engaged_probe.py b/scripts/sandbox_engaged_probe.py index d7191bac3..37ca24276 100644 --- a/scripts/sandbox_engaged_probe.py +++ b/scripts/sandbox_engaged_probe.py @@ -1,340 +1,72 @@ #!/usr/bin/env python3 -""" -Assert that comparator's landrun sandbox actually restricts writes from -inside `Submission.lean` elaboration. - -This is the CI-gating probe required by SECURITY.md > "Validations done -at submission time" > sandbox-engaged. It exists because landrun is run -with `--best-effort`, which silently degrades to "no sandbox" when the -host kernel lacks landlock support or when a writable-path rule is -silently dropped — both of which would let an attacker's Submission -escape the sandbox without any visible failure. - -How it works: - -1. Build a synthetic comparator workspace under a tempdir, mirroring the - `generated//` shape but with Lean stdlib only (no Mathlib, so the - probe runs in seconds rather than minutes). -2. The synthetic `Submission.lean` contains an `initialize` block that - attempts five writes and records the outcome of each to a results - file inside `.lake/probe/results.txt` (the only path the sandbox is - allowed to touch under our policy). -3. Run `lake env comparator config.json` to exercise comparator's sandbox - directly. Comparator builds Solution - (which imports Submission), elaborating the initialize block inside - landrun. -4. Read the results file and the inside-ok marker. Assert: the four - forbidden writes were denied AND the one allowed write succeeded. - Anything else is a hard failure. - -Failure modes this probe catches that a hand-rolled landrun call would -miss: - - landrun's flag set drifts away from what comparator passes - - landrun silently runs without sandbox on a kernel missing landlock - (the `--best-effort` failure mode that motivated this probe) - - the sandbox is over-broad on some path that's not /tmp - - symlink resolution lets an inside-allowed path escape via a symlink - - the executable-path rules let writes through that the rwx rules - were supposed to block - -False negatives a future maintainer should still beware of: if -comparator changes the order in which it builds Challenge vs Solution -and exports them, the initialize block may run in a different sandbox -configuration. Re-run this probe after any comparator pin bump. -""" +"""Check host isolation and private writable build/temp directories through lake test.""" from __future__ import annotations import argparse import json -import os -import pathlib -import shutil -import subprocess -import sys +from pathlib import Path import tempfile -REPO_ROOT = pathlib.Path(__file__).resolve().parent.parent -TOOLCHAIN = (REPO_ROOT / "lean-toolchain").read_text(encoding="utf-8").strip() - +from security_probes.common import assert_exit, compare, require_tools, workspace -SUBMISSION_LEAN = r""" -import Lean - -open IO.FS in -private def tryWrite (label : String) (path : System.FilePath) : IO String := do - try - -- Attempt the write. If the sandbox is engaged the write must fail. - IO.FS.writeFile path "x" - return s!"ALLOWED {label} {path}" - catch e => - return s!"DENIED {label} {path} :: {e.toString.take 200}" +def main() -> None: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--require-tools", action="store_true") + args = parser.parse_args() + if not require_tools(args.require_tools): + return + with tempfile.TemporaryDirectory(prefix="sandbox-probe-") as tmp: + base = Path(tmp) + outside = base / "outside" + outside.mkdir() + marker = outside / "marker" + marker.write_text("host-only") + private_path = base / "private-tmp" + submission = r'''import Lean initialize do - -- We are inside Submission's elaboration, which Comparator runs inside - -- landrun with `--rwx /.lake`. Only writes that resolve - -- (after symlink resolution) under `/.lake/...` should - -- succeed. Everything else must be denied by landrun. - let cwd ← IO.currentDir - let resultsDir : System.FilePath := cwd / ".lake" / "probe" - -- Create our results dir up front. This itself is a probe of the - -- inside-ok policy: if this fails, the whole probe fails loudly - -- because we have nowhere to write outcomes. - IO.FS.createDirAll resultsDir - let resultsPath : System.FilePath := resultsDir / "results.txt" - let insideOkPath : System.FilePath := resultsDir / "inside-ok-probe" - - let attempts : List (String × System.FilePath) := [ - ("tmp", ⟨"/tmp/sandbox-bypass-probe"⟩), - ("home", ⟨((← IO.getEnv "HOME").getD "/no-home") ++ "/sandbox-bypass-probe"⟩), - ("dotdot", cwd / ".." / "outside-workspace-probe"), - ("symlink-out", cwd / ".lake" / "escape" / "via-symlink-probe"), - ("inside-ok", insideOkPath), - ] - - let mut lines : Array String := #[] - for (label, path) in attempts do - lines := lines.push (← tryWrite label path) - IO.FS.writeFile resultsPath (String.intercalate "\n" lines.toList ++ "\n") -""" - - -CHALLENGE_LEAN = """\ --- Probe-internal: a trivially-true theorem so the sandbox-engaged probe --- can run comparator end-to-end without depending on Mathlib. -theorem sandbox_engaged_probe_thm : True := True.intro -""" - -SUBMISSION_THM_LEAN = """\ --- The Submission must export a theorem of the same statement so the --- comparator's verifyMatch step succeeds and we exercise the full path --- (build Solution -> export Solution -> verify). The interesting work --- is in `Submission.lean`'s initialize block above; this file just --- supplies the proof. + IO.FS.createDirAll ".lake/probe" + let mut lines : List String := [] + for (label, path) in [("source", "source-marker"), ("symlink", ".lake/escape/changed"), + ("build", ".lake/probe/inside"), ("home", "/tmp/home/private")] do + try + IO.FS.writeFile path "probe" + lines := lines ++ [label ++ "=allowed"] + catch _ => + lines := lines ++ [label ++ "=denied"] + try + let _ ← IO.FS.readFile HOST_MARKER + lines := lines ++ ["host=visible"] + catch _ => + lines := lines ++ ["host=hidden"] + IO.FS.createDirAll PRIVATE_PATH + IO.FS.writeFile (System.FilePath.mk PRIVATE_PATH / "marker") "private" + let routes ← IO.FS.readFile "/proc/net/route" + IO.FS.writeFile ".lake/probe/routes" routes + IO.FS.writeFile ".lake/probe/results" ("\n".intercalate lines) namespace Submission - -theorem sandbox_engaged_probe_thm : True := True.intro - +theorem target : True := True.intro end Submission -""" - -SOLUTION_LEAN = """\ -import Submission -import Submission.Thm - -theorem sandbox_engaged_probe_thm : True := Submission.sandbox_engaged_probe_thm -""" - -LAKEFILE_TOML = """\ -name = "sandbox_engaged_probe" -defaultTargets = ["Challenge", "Solution", "Submission"] - -[[lean_lib]] -name = "Challenge" - -[[lean_lib]] -name = "Solution" - -[[lean_lib]] -name = "Submission" - -""" - -CONFIG_JSON = { - "challenge_module": "Challenge", - "solution_module": "Solution", - "theorem_names": ["sandbox_engaged_probe_thm"], - "permitted_axioms": ["propext", "Quot.sound", "Classical.choice"], - "enable_nanoda": False, -} - -EXPECTED_RESULTS = { - "tmp": "DENIED", - "home": "DENIED", - "dotdot": "DENIED", - "symlink-out": "DENIED", - "inside-ok": "ALLOWED", -} - - -class ProbeError(Exception): - """Raised when the probe detects a sandbox-policy violation.""" - - -def _check_tools(require: bool) -> list[str]: - missing: list[str] = [] - for tool in ("lake", "lean", "landrun", "comparator"): - if shutil.which(tool) is None: - missing.append(tool) - if missing and require: - raise ProbeError( - f"Required tools not on PATH: {', '.join(missing)}. " - "Install via the same procedure CI uses; see SECURITY.md > " - "'Bumping pinned dependencies'." - ) - return missing - - -def _write_workspace(workspace: pathlib.Path) -> None: - (workspace / "lakefile.toml").write_text(LAKEFILE_TOML, encoding="utf-8") - (workspace / "lean-toolchain").write_text(TOOLCHAIN + "\n", encoding="utf-8") - (workspace / "Challenge.lean").write_text(CHALLENGE_LEAN, encoding="utf-8") - (workspace / "Solution.lean").write_text(SOLUTION_LEAN, encoding="utf-8") - (workspace / "Submission.lean").write_text(SUBMISSION_LEAN, encoding="utf-8") - submission_dir = workspace / "Submission" - submission_dir.mkdir(parents=True, exist_ok=True) - (submission_dir / "Thm.lean").write_text(SUBMISSION_THM_LEAN, encoding="utf-8") - (workspace / "config.json").write_text( - json.dumps(CONFIG_JSON, indent=2, sort_keys=True) + "\n", encoding="utf-8" - ) - # Set up the symlink-out vector before comparator runs. landrun must - # deny writes through this symlink because the resolved path - # (`/tmp/sandbox_engaged_probe_escape`) is not under any --rwx rule. - lake_dir = workspace / ".lake" - lake_dir.mkdir(parents=True, exist_ok=True) - escape_target = pathlib.Path(tempfile.mkdtemp(prefix="sandbox_engaged_probe_escape_")) - escape_link = lake_dir / "escape" - if escape_link.exists() or escape_link.is_symlink(): - escape_link.unlink() - escape_link.symlink_to(escape_target) - - -def _run_comparator(workspace: pathlib.Path) -> subprocess.CompletedProcess[str]: - # Lake update + cache get are needed even for a stdlib-only project - # to populate `.lake/build/` enough that comparator's safeLakeBuild - # finds a working setup. With no Mathlib require we expect this to - # be a no-op-ish but still required. - for cmd in (["lake", "update"], ["lake", "exe", "cache", "get"]): - # `cache get` only exists when mathlib is required; skip cleanly. - result = subprocess.run( - cmd, cwd=workspace, capture_output=True, text=True, check=False - ) - if cmd[1] == "exe" and result.returncode != 0: - # Expected: no `cache` exe in a stdlib-only workspace. - continue - if result.returncode != 0 and cmd[1] != "exe": - raise ProbeError( - f"`{' '.join(cmd)}` failed in {workspace}:\n{result.stderr.strip()}" - ) - # Exercise comparator's sandbox directly under Lake's environment. - # tool_path_probe.py separately checks the production test driver. - return subprocess.run( - ["lake", "env", "comparator", "config.json"], - cwd=workspace, - capture_output=True, - text=True, - check=False, - ) - - -def _parse_results(workspace: pathlib.Path) -> dict[str, str]: - results_path = workspace / ".lake" / "probe" / "results.txt" - if not results_path.is_file(): - raise ProbeError( - f"Results file not produced at {results_path}. The Submission's " - "initialize block did not run, OR the inside-ok write failed " - "(which would mean even the writable-path rule was dropped — a " - "different sandbox failure)." - ) - parsed: dict[str, str] = {} - for line in results_path.read_text(encoding="utf-8").splitlines(): - if not line.strip(): - continue - # Expected shape: "DENIED