Explorar el Código

fix(host): put toolchain PATH in L0 so buf is found during go test

TestGenProfileNoDrift requires L0_CONTRACT_CHECK_PASS; offline PARTIAL was caused by buf missing from the inherited PATH.

Co-authored-by: Cursor <cursoragent@cursor.com>
root hace 3 meses
padre
commit
fb5b48c87d
Se han modificado 1 ficheros con 18 adiciones y 0 borrados
  1. 18 0
      tools/l0_contract_check.py

+ 18 - 0
tools/l0_contract_check.py

@@ -6,6 +6,7 @@ from __future__ import annotations
 import argparse
 import hashlib
 import json
+import os
 import subprocess
 import sys
 import tempfile
@@ -14,6 +15,22 @@ from pathlib import Path
 HOST = Path(__file__).resolve().parents[1]
 REPO = HOST.parent
 SKIP_GO_PREFIXES = ("internal/gen/",)
+TOOLCHAIN_PATH_PREFIX = (
+    "/data/prod2u/bin",
+    "/data/prod2u/opt/go1.25.13/bin",
+    "/opt/python-3.12/bin",
+    "/usr/bin",
+    "/bin",
+)
+
+
+def _ensure_toolchain_path() -> None:
+    cur = os.environ.get("PATH", "")
+    parts = [p for p in TOOLCHAIN_PATH_PREFIX if p]
+    for p in cur.split(os.pathsep):
+        if p and p not in parts:
+            parts.append(p)
+    os.environ["PATH"] = os.pathsep.join(parts)
 
 
 def sha256(path: Path) -> str:
@@ -90,6 +107,7 @@ def maybe_buf() -> str:
 
 
 def main() -> int:
+    _ensure_toolchain_path()
     ap = argparse.ArgumentParser()
     ap.add_argument("--repo-root", type=Path, default=None)
     ap.add_argument("--evidence-root", type=Path, default=None)