Files
alzeo/tests/test_run_fix_hint.py
T
Hasan BasbunarandClaude Opus 5.5 8d7b750e8a lanes.sh: one record of the text lane the box comes back to
Until v1.29 every switch to a side lane (image, video, Kolibri) wrote a link to the lane it took
the boot from, install.sh followed those links with six order-dependent lines, and three
uninstalls followed them their own ways: a round trip between side lanes made two links name
each other (close_lane_loop closed that in v1.29), a side lane removed left another's link
naming a unit that was gone (the image and video uninstalls then left no lane at boot), and
every new lane meant editing all of it (found in review, 2026-10-14). One record now,
text-lane, the SGLang text unit the box had at boot last: switch-model.sh notes it when it
leaves a text lane or switches to a text target, install.sh when it makes its lane the boot
lane, and install.sh's resolution and every uninstall read it from lanes.sh, which they all
source. With no chain there is no loop to close. A box switched before keeps its answer: the
links are read once, while the side lane is still the one at boot, and become the record. An
uninstall whose noted lane is gone gives the boot to whichever text lane is installed, the 27B
first, where a link that led nowhere left the box with nothing.

Tests: every sequence of switches up to six lanes long (1,364) through switch-model.sh's own
notes, install.sh's own resolution and the uninstalls' give-back resolves the last text lane
served; the library itself; the migration from the links (the reference box's three, one of
them stale); the harnesses that copy the scripts carry the library. test_lane_before_loops.py
tested the links and goes with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 14:13:41 +02:00

40 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""The command run.sh offers to restore native configs is one install.sh accepts.
run.sh refuses to start on YaRN-patched configs and names the fix. It named
`CONTEXT_MODE=native ./install.sh --no-service --no-start`, and install.sh refuses
--no-service with --no-start, so the way out it offered was itself refused (found in
review, 2026-09-24). This runs the command's flags through install.sh's own flag parser.
"""
import pathlib
import re
import subprocess
import tempfile
import unittest
REPO = pathlib.Path(__file__).resolve().parents[1]
RUN = (REPO / "run.sh").read_text()
class TheHintIsAccepted(unittest.TestCase):
def test_the_offered_flags_pass_install_sh_parsing(self):
prep = re.search(r'^PREP="\./install\.sh ([^"]*)"', RUN, re.M).group(1).split()
hint = re.search(r'restore the native configs with: CONTEXT_MODE=native \$PREP([^"]*)"', RUN).group(1).split()
flags = prep + hint
self.assertNotIn("--no-start", flags, "install.sh refuses --no-service with --no-start")
# and install.sh itself does not refuse them, at the flag stage (stopped right after)
text = (REPO / "install.sh").read_text()
cut = text.index('step "1/10 Preflight checks"')
d = pathlib.Path(tempfile.mkdtemp(prefix="run-hint-"))
(d / "install.sh").write_text(text[:cut] + 'echo "FLAGS OK"; exit 0\n')
(d / "lanes.sh").write_text((REPO / "lanes.sh").read_text()) # sourced by the scripts since v1.30
(d / "install.sh").chmod(0o755)
r = subprocess.run([str(d / "install.sh"), *flags], capture_output=True, text=True, timeout=60,
cwd=str(REPO), env={"PATH": "/usr/bin:/bin", "HOME": str(d),
"CONTEXT_MODE": "native", "MODEL_CHOICE": "stock"})
self.assertIn("FLAGS OK", r.stdout, r.stdout + r.stderr)
if __name__ == "__main__":
unittest.main(verbosity=2)