Files
alzeo/tests/test_install_token_map_rev.py
T
Hasan BasbunarandClaude Opus 5.5 795b97a270 install.sh: an update that changes nothing restarts nothing; a moved branch or tag restarts the engine; summaries that point at the right things
- I18: the proxy, the cockpit and opencode-web restart only when they are not
  running, when the run changed what they run, or when they started before a
  file they read changed (stale_since); units, the proxy copy and the
  generated opencode config are written only when their content changes.
  The proxy still follows an engine restart. On 1m, step 7 keeps a fitted
  pair under the table's bounds (oc-merge-limits.py --keep-lower, and the
  generator), instead of writing the bounds for the end fit to undo: 49
  opencode-web and 36 cockpit starts on 2026-09-23, 79 config backups
- I13: engine-inputs.py resolves a branch revision through refs/ and counts
  the ref, and reads the image wherever it is named (a moving tag); the flash
  draft vocabulary is built for MODEL_REV=main
- I14: an explicit CONTEXT_MODE=native writes the native opencode limits
- I15: an oc at ~/.local/bin/oc that is not ours is left alone; the command
  offered instead carries OPENCODE_CONFIG (I35)
- I16/I17: the summary sends clients to the proxy; --no-service names what
  ./uninstall.sh --list shows, the key-reading provider included
- tests: the smoke extraction ends at its own last check; the abort test's
  fake engine registers a request before its headers, as SGLang does (an
  abort landed in that gap once in a CI run)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 17:00:07 +02:00

44 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""The flash draft vocabulary is built for a branch revision too.
install.sh looked for the checkpoint at snapshots/$MODEL_REV, and with MODEL_REV=main (a
documented setting) that folder never exists: snapshots are named by the commit that
refs/main holds, so the reduced draft vocabulary was skipped on every run, with a note
saying the checkpoint was not in place yet (found in review, 2026-09-24).
"""
import pathlib
import subprocess
import tempfile
import unittest
REPO = pathlib.Path(__file__).resolve().parents[1]
TEXT = (REPO / "install.sh").read_text()
A = TEXT.index('echo "building the reduced draft vocabulary')
START = TEXT.index("\n", A) + 1
BLOCK = TEXT[START:TEXT.index('if [ -z "$SNAP_DIR" ]; then', START)]
def snap_dir(rev, with_ref):
hf = pathlib.Path(tempfile.mkdtemp(prefix="map-rev-"))
repo = hf / "hub" / "models--org--flash"
(repo / "snapshots" / "abc123").mkdir(parents=True)
if with_ref:
(repo / "refs").mkdir()
(repo / "refs" / "main").write_text("abc123")
script = f'set -euo pipefail\nHF_CACHE="{hf}"; MODEL_REPO=org/flash; MODEL_REV={rev}\n' + BLOCK + 'echo "SNAP=$SNAP_DIR"\n'
r = subprocess.run(["bash", "-c", script], capture_output=True, text=True, timeout=30)
line = next((ln for ln in r.stdout.splitlines() if ln.startswith("SNAP=")), "SNAP=")
return line[5:]
class TheSnapshotOfABranch(unittest.TestCase):
def test_main_leads_to_the_commit_it_names(self):
self.assertTrue(snap_dir("main", with_ref=True).endswith("/snapshots/abc123"))
def test_a_commit_still_leads_to_itself(self):
self.assertTrue(snap_dir("abc123", with_ref=False).endswith("/snapshots/abc123"))
if __name__ == "__main__":
unittest.main(verbosity=2)