conformity: the side lanes' checkpoints are listed, recorded and kept

The Kolibri lane's checkpoint (fp8 or nvfp4), the image lane's model
and the video lane's variant stayed across updates as their units named
them, and the list before step 1 said nothing of them (Hasan,
2026-10-17: record them from v1.36.0). conformity.py compares them like
a text lane's target: read back from the units the way their installers
read them, recommended from the installers' own default lines, and,
since no release installed another one by default, a choice. A switch
to kolibri-nvfp4 or image-turbo records it, the way back erases it, and
install.sh records the three when they are set on its command line. The
cockpit reads the list again when one of those units or installers
changes, and names them. The walled copies of install.sh carry the side
installers, whose defaults the list now reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hasan BasbunarandClaude Opus 5.5 committed 2026-10-17 10:54:09 +02:00
1 parent da911ecad1
commit 6e9a9a33b1
11 files changed
+221 -11

No files matched your search

+41 -3
View File
@@ -38,10 +38,12 @@ FIRST_RELEASE = "v1.36.0"
# to keep a value is always NAME=value ./install.sh. A lane's target is not a variable of its
# own (MODEL_CHOICE picks the lane too), hence target.27b and target.flash; DRAFT2 is the 27B
# drafter as a whole (repository, quantization, depth), because the old default is the three
# together: the same repository at depth 16 was somebody's choice.
# together: the same repository at depth 16 was somebody's choice. The side lanes' checkpoints
# are compared too (2026-10-17): install.sh hands KOLIBRI_VARIANT, IMAGE_MODEL and VIDEO_VARIANT
# to their installers, which keep the unit's otherwise.
KNOBS = ("target.27b", "target.flash", "DRAFT2", "CONTEXT_MODE", "ENGINE_BIND", "PROXY_BIND",
"PORT", "PROXY_PORT", "HF_CACHE", "PLE_DIR", "FLASH_TIER", "SPEC_TOKEN_MAP_SIZE",
"FLASH_REPLAYSSM_SPEC")
"FLASH_REPLAYSSM_SPEC", "KOLIBRI_VARIANT", "IMAGE_MODEL", "VIDEO_VARIANT")
# Settings that belong to the site rather than to a release: where the checkpoints live, which
# ports clients were given. Listed apart and never moved by an update (decided 2026-10-16).
SITE = ("PORT", "PROXY_PORT", "HF_CACHE", "PLE_DIR")
@@ -107,6 +109,26 @@ def targets(repo_dir=REPO):
re.findall(r'^ {2}([a-z0-9-]+)\)\s+MODEL_REPO="\$([A-Z][A-Z0-9_]*_REPO)"', text, re.M)}
def _side(repo_dir, script, pattern):
"""A value a side lane's installer writes (its default, a pinned repository), read from the
line that writes it: KeyError when the installer no longer writes it that way."""
m = re.search(pattern, _read(Path(repo_dir) / script) or "", re.M)
if not m:
raise KeyError(f"{script}: {pattern}")
return m.group(1)
# The lines of the side lanes' installers that write their defaults and their two Kolibri
# checkpoints (tests/test_conformity_side_lanes.py runs the installers' own lines against them).
SIDE = {
"KOLIBRI_VARIANT": ("install-kolibri.sh", r'^\s*""\)\s*VARIANT=([a-z0-9]+);'),
"IMAGE_MODEL": ("install-image.sh", r'^IMAGE_MODEL_PIN="([^"]+)"'),
"VIDEO_VARIANT": ("install-video.sh", r'VARIANT="\$\{VARIANT:-([a-z0-9]+)\}"'),
"fp8": ("install-kolibri.sh", r'^KOLIBRI_FP8_REPO="([^"]+)"'),
"nvfp4": ("install-kolibri.sh", r'^KOLIBRI_NVFP4_REPO="([^"]+)"'),
}
def recommended(repo_dir=REPO, home=None):
"""{knob: value} a box installed today with no variable set ends up with. A default install.sh
no longer writes the way this reads raises KeyError rather than recommend nothing."""
@@ -139,6 +161,7 @@ def recommended(repo_dir=REPO, home=None):
"FLASH_TIER": val("FLASH_TIER"),
"SPEC_TOKEN_MAP_SIZE": val("SPEC_TOKEN_MAP_SIZE"),
"FLASH_REPLAYSSM_SPEC": val("FLASH_REPLAYSSM_SPEC"),
**{knob: _side(repo_dir, *SIDE[knob]) for knob in ("KOLIBRI_VARIANT", "IMAGE_MODEL", "VIDEO_VARIANT")},
}
@@ -213,6 +236,20 @@ def observe(units_dir=UNITS, config_dir=None, lane="27b", repo_dir=REPO):
v = _first(pattern, proxy)
if v:
out[knob] = v
# The side lanes' checkpoints, read back as their installers read them: Kolibri's by the
# repository before its --revision, the image's by --model-path, the video's by
# --model-variant (fl2va, the installer's default, when the unit names none).
kolibri = _read(Path(units_dir) / "qwen38-kolibri.service")
if kolibri is not None:
for variant in ("fp8", "nvfp4"):
if f"{_side(repo_dir, *SIDE[variant])} --revision" in kolibri:
out["KOLIBRI_VARIANT"] = variant
image = _read(Path(units_dir) / "qwen38-image.service")
if image is not None and _first(r"--model-path ([^ ]+)", image):
out["IMAGE_MODEL"] = _first(r"--model-path ([^ ]+)", image)
video = _read(Path(units_dir) / "qwen38-video.service")
if video is not None:
out["VIDEO_VARIANT"] = _first(r"--model-variant ([a-z0-9]+)", video) or _side(repo_dir, *SIDE["VIDEO_VARIANT"])
return out
@@ -375,7 +412,8 @@ def plan(config_dir, lane, chose=None, repo_dir=REPO, units_dir=UNITS, home=None
# The settings that are no variable of their own, as the list names them.
PLAN_NAMES = {"target.27b": "27B target", "target.flash": "flash target", "DRAFT2": "27B drafter"}
PLAN_NAMES = {"target.27b": "27B target", "target.flash": "flash target", "DRAFT2": "27B drafter",
"KOLIBRI_VARIANT": "Kolibri checkpoint", "IMAGE_MODEL": "image model", "VIDEO_VARIANT": "video variant"}
def plan_lines(items, release):
+7 -4
View File
@@ -1678,8 +1678,9 @@ def refresh_owed():
# This box against what its clone recommends (v1.36.0, 2026-10-17): conformity.py's plan for the
# text lane the box serves from, with nothing set on a command line, so the same list the next
# ./install.sh prints before its first step. Read again only once a file it reads has changed:
# the units of the two text lanes and of the proxy, the flash launcher, installed.json, the API
# key (whose date is the age of a box with no record), the clone's install.sh and CHANGELOG.md.
# the units of the two text lanes, of the proxy and of the Kolibri, image and video lanes, the
# flash launcher, installed.json, the API key (whose date is the age of a box with no record),
# the clone's install.sh, the installers of those three lanes (their defaults) and CHANGELOG.md.
_CONFORM_CACHE: dict = {}
@@ -1703,9 +1704,11 @@ def conformity_state():
except OSError:
noted = ""
lane = "flash" if noted == "qwen38-flash.service" else "27b"
files = ([UNIT_DIR / n for n in ("qwen38-sglang.service", "qwen38-flash.service", "qwen38-keepalive.service")]
files = ([UNIT_DIR / n for n in ("qwen38-sglang.service", "qwen38-flash.service", "qwen38-keepalive.service",
"qwen38-kolibri.service", "qwen38-image.service", "qwen38-video.service")]
+ [CONFIG_DIR / n for n in ("launch-flash.sh", "installed.json", "api-key", "text-lane")]
+ [REPO_DIR / "install.sh", REPO_DIR / "CHANGELOG.md"])
+ [REPO_DIR / n for n in ("install.sh", "install-kolibri.sh", "install-image.sh", "install-video.sh",
"CHANGELOG.md")])
key = (lane,) + tuple(_mtime_ns(f) for f in files)
if _CONFORM_CACHE.get("key") != key:
items = mod.plan(CONFIG_DIR, lane, {}, repo_dir=REPO_DIR, units_dir=UNIT_DIR)
+2 -1
View File
@@ -909,7 +909,8 @@ function applyBusy(){
// ── banners: what you did not go looking for ──────────────────────────────────
// The settings conformity.py compares that are no variable of their own, as the page names them
// (v1.36.0): the same names install.sh's list gives them.
const CF_NAME = {'target.27b': '27B target', 'target.flash': 'flash target', DRAFT2: '27B drafter'};
const CF_NAME = {'target.27b': '27B target', 'target.flash': 'flash target', DRAFT2: '27B drafter',
KOLIBRI_VARIANT: 'Kolibri checkpoint', IMAGE_MODEL: 'image model', VIDEO_VARIANT: 'video variant'};
const cfName = i => CF_NAME[i.knob] || i.knob;
function wedgeNext(){
const c = F.config || {};
@@ -108,6 +108,20 @@ class TheUpdateTierCarriesIt(unittest.TestCase):
self.assertEqual(len(calls), 2)
self.assertEqual([i["knob"] for i in got["items"]], ["ENGINE_BIND"])
def test_a_side_lanes_switch_is_read_again(self):
# ./switch-model.sh kolibri-nvfp4 rewrites the Kolibri unit: its checkpoint is listed
# since 2026-10-17, so its unit is one of the files the cache follows
cp, units, cfg = self.box("cockpit_conform_side", key_at=OLD_BOX)
self.assertEqual(cp.conformity_state()["items"], [])
unit = units / "qwen38-kolibri.service"
unit.write_text(unit.read_text().replace("Aleph-Alpha/Kolibri-1 --revision",
"Quantinine/Kolibri-1-NVFP4A16-FP8 --revision"))
later = time.time() + 5
os.utime(unit, (later, later))
got = cp.conformity_state()
self.assertEqual([(i["knob"], i["value"], i["group"]) for i in got["items"]],
[("KOLIBRI_VARIANT", "nvfp4", "yours")])
def test_what_cannot_be_read_is_not_said(self):
cp, _, _ = self.box("cockpit_conform_e", key_at=OLD_BOX)
mod = cp._conformity()
+5
View File
@@ -72,6 +72,8 @@ _ENV_PLE_DIR="${PLE_DIR:-}"; FLASH_TIER_ENV="${FLASH_TIER:-}"
_ENV_SPEC_TOKEN_MAP_SIZE="${SPEC_TOKEN_MAP_SIZE:-}"; _ENV_FLASH_REPLAYSSM_SPEC="${FLASH_REPLAYSSM_SPEC:-}"
_ENV_DRAFT2_REPO="${DRAFT2_REPO:-}"; _ENV_DRAFT2_REV="${DRAFT2_REV:-}"
_ENV_DRAFT2_QUANT="${DRAFT2_QUANT:-}"; _ENV_DRAFT2_TOKENS="${DRAFT2_TOKENS:-}"
# the side lanes' checkpoints, which their installers read from the environment (2026-10-17)
_ENV_KOLIBRI_VARIANT="${KOLIBRI_VARIANT:-}"; _ENV_IMAGE_MODEL="${IMAGE_MODEL:-}"; _ENV_VIDEO_VARIANT="${VIDEO_VARIANT:-}"
# A run installs the text lane that does not serve as well, beside the one it serves: it
# starts this script again for that lane, with QWEN38_SECONDARY naming it (27b or flash).
# That run converges on that lane's own installed choices, installs its unit without
@@ -1345,6 +1347,9 @@ collect_choices() {
if [ -n "$FLASH_TIER_ENV" ]; then CHOSE+=(--chose "FLASH_TIER=$FLASH_TIER"); fi
if [ -n "$_ENV_SPEC_TOKEN_MAP_SIZE" ]; then CHOSE+=(--chose "SPEC_TOKEN_MAP_SIZE=$SPEC_TOKEN_MAP_SIZE"); fi
if [ -n "$_ENV_FLASH_REPLAYSSM_SPEC" ]; then CHOSE+=(--chose "FLASH_REPLAYSSM_SPEC=$FLASH_REPLAYSSM_SPEC"); fi
if [ -n "$_ENV_KOLIBRI_VARIANT" ]; then CHOSE+=(--chose "KOLIBRI_VARIANT=$_ENV_KOLIBRI_VARIANT"); fi
if [ -n "$_ENV_IMAGE_MODEL" ]; then CHOSE+=(--chose "IMAGE_MODEL=$_ENV_IMAGE_MODEL"); fi
if [ -n "$_ENV_VIDEO_VARIANT" ]; then CHOSE+=(--chose "VIDEO_VARIANT=$_ENV_VIDEO_VARIANT"); fi
return 0
}
# This box against what this release recommends, in one list before anything changes
+7
View File
@@ -199,6 +199,10 @@ if [ "$CHOICE" = "kolibri" ] || [ "$CHOICE" = "kolibri-nvfp4" ]; then
systemctl is-active --quiet "$u" 2>/dev/null && RUNNING="$u"
done
printf '\n\033[1;32mSwitch queued: %s (%s)\033[0m\n' "$KOL_MODEL" "$KOLIBRI_UNIT_NAME"
# The checkpoint is the operator's choice from here, as a text lane's target (2026-10-17):
# recorded in an installed.json that exists, erased when it is the recommended one.
python3 "$REPO_DIR/conformity.py" choose --config-dir "$CONFIG_DIR" --repo-dir "$REPO_DIR" \
KOLIBRI_VARIANT "$([ "$KOL_MODEL" = "$KOLIBRI_NVFP4_REPO" ] && echo nvfp4 || echo fp8)" || true
if [ -n "$RUNNING" ]; then
echo "Effective after: sudo systemctl stop $RUNNING && sudo systemctl start $KOLIBRI_UNIT_NAME (or next reboot)"
elif systemctl is-active --quiet "$KOLIBRI_UNIT_NAME" 2>/dev/null; then
@@ -572,6 +576,9 @@ if [ "$CHOICE" = "image" ] || [ "$CHOICE" = "image-turbo" ]; then
systemctl is-active --quiet "$u" 2>/dev/null && RUNNING="$u"
done
printf '\n\033[1;32mSwitch queued: %s (%s)\033[0m\n' "$IMG_MODEL" "$IMAGE_UNIT_NAME"
# Its checkpoint is the operator's choice from here, as Kolibri's (2026-10-17).
python3 "$REPO_DIR/conformity.py" choose --config-dir "$CONFIG_DIR" --repo-dir "$REPO_DIR" \
IMAGE_MODEL "$IMG_MODEL" || true
if [ -n "$RUNNING" ]; then
echo "Effective after: sudo systemctl stop $RUNNING && sudo systemctl start $IMAGE_UNIT_NAME (or next reboot)"
elif systemctl is-active --quiet "$IMAGE_UNIT_NAME" 2>/dev/null; then
+4
View File
@@ -87,6 +87,10 @@ def walled(script="install.sh", at=None, after=False, units=None):
# and conformity.py (since v1.36.0), which the convergence asks whether an installed value
# is a default of an older release or a choice
(d / "conformity.py").write_text((REPO / "conformity.py").read_text())
# and the side lanes' installers, whose defaults it recommends (since v1.36.0): read only,
# so written without the execute bit, and a run that reached one would stop on it
for side in ("install-kolibri.sh", "install-image.sh", "install-video.sh"):
(d / side).write_text((REPO / side).read_text())
# and the head of the CHANGELOG, whose first heading names the release the list before
# step 1 compares the box with (since v1.36.0)
(d / "CHANGELOG.md").write_text("".join((REPO / "CHANGELOG.md").read_text().splitlines(keepends=True)[:3]))
+14 -2
View File
@@ -57,10 +57,11 @@ def box(context="1m", host="127.0.0.1", port="30000", hf=None, target27="RadixAr
draft=("maurienne-ai/Qwen3.8-27B-DFlash2-NVFP4-RTNcal", "bd7a934213c47a9e7ef69eef36bb3325f47fd1f1",
"modelopt_fp4", "16"),
flash=True, flash_target="RadixArk/Qwen3.8-Flash-Next-NVFP4", tier="concurrency", replay="1",
token_map="65536", ple=None, proxy_bind="0.0.0.0", proxy_port="30001", key_at=None, record=None):
token_map="65536", ple=None, proxy_bind="0.0.0.0", proxy_port="30001", key_at=None, record=None,
side=True, kolibri="Aleph-Alpha/Kolibri-1", image_model="Qwen/Qwen-Image-2.1", video_variant="fl2va"):
"""(units dir, config dir) of a box whose units are the templates rendered with these values
(the recommended ones by default). key_at: the mtime of its API key (None: no key);
record: installed.json, as a dict or as raw text."""
record: installed.json, as a dict or as raw text; side: the Kolibri, image and video units."""
units, cfg = wall._tmp("units-"), wall._tmp("cfg-")
hf = hf or f"{HOME}/.cache/huggingface"
common = {"HOME": HOME, "USER": "u", "GROUP": "u", "PORT": port, "ENGINE_BIND": host, "HF_CACHE": hf,
@@ -82,6 +83,17 @@ def box(context="1m", host="127.0.0.1", port="30000", hf=None, target27="RadixAr
(units / "qwen38-keepalive.service").write_text(render("qwen38-keepalive.service.template", {
**common, "PROXY_PORT": proxy_port, "PROXY_BIND": proxy_bind, "PROMPT_CEILING": "0",
"FLASH_PROMPT_CEILING": "250000"}))
if side:
(units / "qwen38-kolibri.service").write_text(render("qwen38-kolibri.service.template", {
**common, "PORT": "30030", "GMU": "0.80", "IMAGE": "qwen38-kolibri:x", "MODEL": kolibri, "REV": "e" * 40}))
lanes = f"{HOME}/.local/share"
(units / "qwen38-image.service").write_text(render("qwen38-image.service.template", {
**common, "IMAGE_BIND": host, "IMAGE_PORT": "30010", "IMAGE_LANE_DIR": f"{lanes}/qwen38-image",
"IMAGE_VENV": f"{lanes}/qwen38-image/venv", "IMAGE_MODEL": image_model}))
(units / "qwen38-video.service").write_text(render("qwen38-video.service.template", {
**common, "VIDEO_BIND": host, "VIDEO_PORT": "30022", "VIDEO_LANE_DIR": f"{lanes}/qwen38-video",
"VIDEO_VENV": f"{lanes}/qwen38-video/venv", "VIDEO_MODEL": "MiniMaxAI/MiniMax-H3",
"VIDEO_VARIANT": video_variant}))
if key_at is not None:
(cfg / "api-key").write_text("not-a-key\n")
t = datetime.datetime.fromisoformat(key_at).timestamp()
+84
View File
@@ -0,0 +1,84 @@
#!/usr/bin/env python3
"""The side lanes' checkpoints in the list (v1.36.0, 2026-10-17).
The Kolibri, image and video lanes keep the checkpoint their unit names across updates (an
operator switched to kolibri-nvfp4 or image-turbo, or installed another video variant), and
the list said nothing of them (Hasan, 2026-10-17: record them from v1.36.0). They are compared
like the text lanes' targets: read back from their units the way their installers read them,
recommended as each installer installs a new box, and, since no release installed another one
by default, a different one is always a choice.
"""
import os
import pathlib
import re
import subprocess
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from test_conformity_classify import REC, box, classes # noqa: E402
REPO = pathlib.Path(__file__).resolve().parents[1]
sys.path.insert(0, str(REPO))
import conformity # noqa: E402
NVFP4 = "Quantinine/Kolibri-1-NVFP4A16-FP8"
TURBO = "Qwen/Qwen-Image-2.1-Turbo"
def bash(script):
r = subprocess.run(["bash", "-c", "set -eu\n" + script], capture_output=True, text=True, timeout=30,
env={"PATH": "/usr/bin:/bin"})
assert r.returncode == 0, r.stderr
return r.stdout.strip()
def line(script, pattern):
"""The one line of an installer that matches pattern."""
found = [ln for ln in (REPO / script).read_text().splitlines() if re.search(pattern, ln)]
assert len(found) == 1, (script, pattern, found)
return found[0]
class TheRecommendedOnesAreWhatTheInstallersInstall(unittest.TestCase):
"""Each installer's own lines, run with no variable and no unit, as on a new box."""
def test_kolibri_installs_its_fp8_checkpoint(self):
text = (REPO / "install-kolibri.sh").read_text()
start = text.index('case "${KOLIBRI_VARIANT:-}" in')
block = text[start:text.index("esac", start) + 4]
got = bash(f'INSTALLED_MODEL=""; KOLIBRI_NVFP4_REPO={NVFP4}\ndie(){{ exit 3; }}\n{block}\necho "$VARIANT"')
self.assertEqual(got, "fp8")
self.assertEqual(REC["KOLIBRI_VARIANT"], got)
def test_the_image_lane_installs_its_pinned_model(self):
got = bash('unit_flag(){ :; }\nkept_flag(){ :; }\n' + line("install-image.sh", r'^MODEL="\$\{IMAGE_MODEL:-') + '\necho "$MODEL"')
self.assertEqual(got, "Qwen/Qwen-Image-2.1")
self.assertEqual(REC["IMAGE_MODEL"], got)
def test_the_video_lane_installs_fl2va(self):
got = bash('unit_flag(){ :; }\nkept_flag(){ :; }\n' + line("install-video.sh", r'^VARIANT="\$\{VIDEO_VARIANT:-') + '\necho "$VARIANT"')
self.assertEqual(got, "fl2va")
self.assertEqual(REC["VIDEO_VARIANT"], got)
class EachOneIsReadBackFromItsUnit(unittest.TestCase):
def test_another_checkpoint_is_a_choice_no_release_made_the_default(self):
for kw, knob, value in ((dict(kolibri=NVFP4), "KOLIBRI_VARIANT", "nvfp4"),
(dict(image_model=TURBO), "IMAGE_MODEL", TURBO),
(dict(video_variant="ref2va"), "VIDEO_VARIANT", "ref2va")):
with self.subTest(knob=knob):
units, cfg = box(**kw)
self.assertEqual(conformity.observe(units, cfg)[knob], value)
self.assertEqual(classes(units, cfg), {knob: ("choice", "never-default")})
def test_a_box_without_the_side_lanes_says_nothing_of_them(self):
units, cfg = box(side=False)
seen = conformity.observe(units, cfg)
for knob in ("KOLIBRI_VARIANT", "IMAGE_MODEL", "VIDEO_VARIANT"):
self.assertNotIn(knob, seen)
self.assertEqual(classes(units, cfg), {})
if __name__ == "__main__":
unittest.main()
+2 -1
View File
@@ -30,7 +30,8 @@ TEXT = (REPO / "install.sh").read_text()
LINES = TEXT.splitlines()
CONFORMITY = str(REPO / "conformity.py")
NO_ENV = ("MODEL_CHOICE", "PORT", "HF_CACHE", "CONTEXT_MODE", "PROXY_PORT", "ENGINE_BIND", "PROXY_BIND", "PLE_DIR",
"SPEC_TOKEN_MAP_SIZE", "FLASH_REPLAYSSM_SPEC", "DRAFT2_REPO", "DRAFT2_REV", "DRAFT2_QUANT", "DRAFT2_TOKENS")
"SPEC_TOKEN_MAP_SIZE", "FLASH_REPLAYSSM_SPEC", "DRAFT2_REPO", "DRAFT2_REV", "DRAFT2_QUANT", "DRAFT2_TOKENS",
"KOLIBRI_VARIANT", "IMAGE_MODEL", "VIDEO_VARIANT")
def git_head():
+41
View File
@@ -124,5 +124,46 @@ class SwitchModelCallsIt(unittest.TestCase):
self.assertIn(f"target.{lane}", conformity.KNOBS)
class TheSideLanesRecordTheirCheckpoint(unittest.TestCase):
"""kolibri-nvfp4 and image-turbo are choices the box keeps across updates (2026-10-17): the
switch records them as it records a text lane's target, and the way back erases them."""
TEXT = (REPO / "switch-model.sh").read_text()
def test_kolibri_nvfp4_is_recorded_and_fp8_erases_it(self):
cfg = config(a_record())
rec, changed = conformity.choose(cfg, "KOLIBRI_VARIANT", "nvfp4", now=NOW)
self.assertEqual((changed, rec["choices"]["KOLIBRI_VARIANT"]["value"]), ("recorded", "nvfp4"))
rec, changed = conformity.choose(cfg, "KOLIBRI_VARIANT", "fp8", now=LATER)
self.assertEqual(changed, "erased")
self.assertNotIn("KOLIBRI_VARIANT", rec["choices"])
def test_the_image_turbo_is_recorded_and_the_base_erases_it(self):
cfg = config(a_record())
rec, changed = conformity.choose(cfg, "IMAGE_MODEL", "Qwen/Qwen-Image-2.1-Turbo", now=NOW)
self.assertEqual(changed, "recorded")
rec, changed = conformity.choose(cfg, "IMAGE_MODEL", "Qwen/Qwen-Image-2.1", now=LATER)
self.assertEqual(changed, "erased")
def test_each_side_switch_records_once_queued_and_never_fails_for_it(self):
for queued, call in (('"$KOL_MODEL" "$KOLIBRI_UNIT_NAME"',
'KOLIBRI_VARIANT "$([ "$KOL_MODEL" = "$KOLIBRI_NVFP4_REPO" ] && echo nvfp4 || echo fp8)" || true\n'),
('"$IMG_MODEL" "$IMAGE_UNIT_NAME"', 'IMAGE_MODEL "$IMG_MODEL" || true\n')):
with self.subTest(call=call.split()[0]):
at = self.TEXT.index("Switch queued: %s (%s)\\033[0m\\n' " + queued)
tail = self.TEXT[at:at + 500]
self.assertIn('python3 "$REPO_DIR/conformity.py" choose --config-dir "$CONFIG_DIR" --repo-dir "$REPO_DIR" \\\n', tail)
self.assertIn(call, tail)
def test_the_kolibri_choice_names_the_checkpoint_the_switch_serves(self):
kol = (REPO / "install-kolibri.sh").read_text()
repos = dict(re.findall(r'^(KOLIBRI_(?:FP8|NVFP4)_REPO)="([^"]+)"', kol, re.M))
expr = '$([ "$KOL_MODEL" = "$KOLIBRI_NVFP4_REPO" ] && echo nvfp4 || echo fp8)'
for model, want in ((repos["KOLIBRI_NVFP4_REPO"], "nvfp4"), (repos["KOLIBRI_FP8_REPO"], "fp8")):
with self.subTest(want=want):
out = subprocess.run(["bash", "-c", f'KOLIBRI_NVFP4_REPO="{repos["KOLIBRI_NVFP4_REPO"]}"; '
f'KOL_MODEL="{model}"; echo "{expr}"'], capture_output=True, text=True, timeout=30)
self.assertEqual(out.stdout.strip(), want)
if __name__ == "__main__":
unittest.main(verbosity=2)