cockpit: a scan that missed a pin deletes nothing and concludes nothing

The registry scan read the pins from the clone's scripts; one read while a checkout rewrote it (gone, empty
or cut short) left a pin out, and the pinned checkpoint read stray: job_delete_strays deleted it, and the
Library offered to fetch what was on the disk. The first fix (dafaff6) caught only a file not read, and
handed the old scan back, which the delete then acted on.

A scan is partial when a pin of rg.PIN_MODELS is not found, a pin file is not read, or a target's installer
pins none of its files: it refuses every deletion with the reason, says each such target "unknown" (the
Library: "not read", no Download), lists what it missed in "partial", and is never cached. The tests fail
on v1.48.1 (the delete) and on dafaff6.

Also: the comment of the conformity cache's key, and the wall reads conformity.SIDE once.
Found by the third review of v1.49.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hasan BasbunarandClaude Opus 5.5 committed 2026-11-15 15:58:53 +01:00
1 parent 2b8e10db6f
commit 46579ffb5e
6 files changed
+95 -37

No files matched your search

+7
View File
@@ -41,6 +41,13 @@ the SHA-1 of the snapshot's revision and the file's path in it, 40 hexadecimal c
revision; the other engines' `--revision` is read as before. A box on v6.56 or older serving that lane says the
revision alone and shares nothing with one on v6.57: the two boxes of a pair update together.
**The Library deletes nothing on a scan that missed a pin.** The cockpit reads the pins from the clone's scripts. A
script read while a checkout rewrote it (gone, empty or cut short) left a pin out, and the scan took the checkpoint that
pin names for a stray revision: Delete stray revisions would have deleted it, and the Library offered to download what
was on the disk. Such a scan now says what it missed, deletes nothing and offers no download (the target reads "not
read"), and is not kept, so the next one reads again. Found by the review of this release; the test that deletes
nothing fails on v1.48.1.
## v1.48.1 (2026-11-14): three themes for the cockpit, by x42en, and a vLLM lane stopped while it loads ends stopped
**Three themes for the cockpit (pull request #71, by x42en).** The cockpit draws every color from role tokens (`--surface`,
+25 -16
View File
@@ -2424,9 +2424,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, 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.
# the units of the two text lanes, of the proxy and of the Kolibri, image, video and Unsloth GGUF
# 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 conformity.py reads (its SIDE) and CHANGELOG.md.
_CONFORM_CACHE: dict = {}
@@ -6117,12 +6117,17 @@ def registry_snapshot(max_age: float = 300.0) -> dict:
if REGISTRY_CACHE["data"] and time.time() - REGISTRY_CACHE["ts"] < max_age:
return REGISTRY_CACHE["data"]
pins = {}
unread = [] # the repository's files not read this time (a checkout rewriting one, say)
# What this scan could not read, if anything: a pin file gone, or read empty or cut short (a checkout rewriting
# it), leaves a pin of this release missing. Without it a pinned checkpoint reads absent, or stray and so
# deletable (second and third reviews of v1.49.0): such a scan concludes nothing of what it misses and deletes
# nothing, and is not kept, so the next call reads again.
partial = []
for f in rg.PIN_FILES:
try:
pins.update(rg.parse_pins((REPO_DIR / f).read_text()))
except OSError:
unread.append(f)
partial.append(f"{f} not read")
partial += [f"{var} not found" for var in sorted(set(rg.PIN_MODELS) - set(pins))]
caches = lane_caches()
models = []
for d in caches:
@@ -6138,6 +6143,10 @@ def registry_snapshot(max_age: float = 300.0) -> dict:
for r in m["revisions"]:
if r.get("status") != "stray":
continue
if partial:
r["delete"] = {"refused": "this scan could not read every pin (" + ", ".join(partial[:3])
+ "): a pinned revision would read stray; scan again"}
continue
if r["rev"] in named:
r["delete"] = {"refused": "an installed unit or launcher names it"}
continue
@@ -6197,8 +6206,15 @@ def registry_snapshot(max_age: float = 300.0) -> dict:
try:
files = target_files(t)
except OSError:
unread.append(TARGET_FILES[t][0])
files = None
files = []
if not rev or (t in TARGET_FILES and not files):
# its pin, or the files its installer pins, not read this time: not "absent", which offers a Download
# of what may be on the disk, but unknown until the next scan
if t in TARGET_FILES and not files and rev:
partial.append(f"{TARGET_FILES[t][0]}: {t}'s files not found")
targets.append({"target": t, "repo": repo, "rev": rev, "state": "unknown",
"installed": target_unit(t).exists()})
continue
state = ckpt_state(t, repo, rev, files or allow, files)
dvar = TARGET_DRAFT_PIN.get(t)
if dvar:
@@ -6216,16 +6232,9 @@ def registry_snapshot(max_age: float = 300.0) -> dict:
"disk_bytes": m["disk_bytes"]}
for m in models if not m["managed"]],
"images": [i for i in images if i["engine"]],
"partial": partial,
"ts": time.time()}
if unread:
# without a pin file, its checkpoints read absent or stray and the Library offers to fetch what is on the
# disk (second review of v1.49.0): what was said before stands, and nothing of this read is kept, so the
# next call reads again
if REGISTRY_CACHE["data"]:
return REGISTRY_CACHE["data"]
REGISTRY_CACHE.update(ts=0.0, data=None)
return data
REGISTRY_CACHE.update(ts=time.time(), data=data)
REGISTRY_CACHE.update(ts=0.0 if partial else time.time(), data=None if partial else data)
return data
LOGIN_FAILS: dict[str, list] = {}
LOGIN_LOCK = threading.Lock()
+2
View File
@@ -472,6 +472,8 @@ async function scanRegistry(fresh = true){
const tr = tt.insertRow(); tr.insertCell().textContent = TARGET_NAME[t.target] || t.target;
tr.insertCell().textContent = String(t.repo || '').split('/').pop();
const st = tr.insertCell();
// unknown: its pin was not read this time (a checkout rewriting its installer): nothing offered until the next scan
if (t.state === 'unknown'){ st.append(tag('not read', 'warn'), ' ', el('span', 'muted', 'its pin was not read this time; the next scan reads it again')); return; }
st.append(tag(t.state === 'complete' ? 'on disk' : t.state === 'incomplete' ? 'begun' : 'not downloaded', t.state === 'complete' ? 'cool' : 'warn'));
// a lane installed on demand and not prepared yet: the download runs in the image or the
// venv its first Load builds, so that Load is what downloads it
@@ -96,6 +96,34 @@ class Delete(unittest.TestCase):
self.assertEqual(sorted(b.name for b in (self.repo / "blobs").iterdir()),
sorted(["config.json", f"{self.pinned[:4]}-w.safetensors"]))
def test_a_scan_that_misses_a_pin_deletes_nothing(self):
# a checkout rewriting the file that pins this repository: read empty, its pin is not found and the pinned
# revision reads stray. The scan deletes nothing, pinned or not, and says why (third review of v1.49.0: the
# job deleted what such a scan called stray)
pin_file = next(f for f in self.cp.rg.PIN_FILES
if "DRAFT_REV" in self.cp.rg.parse_pins((REPO / f).read_text()))
half = self.tmp / "half-repo"
shutil.rmtree(half, ignore_errors=True)
half.mkdir()
for f in REPO.iterdir():
if f.name != pin_file:
(half / f.name).symlink_to(f)
(half / pin_file).write_text("")
real = self.cp.REPO_DIR
self.cp.REPO_DIR = half
self.addCleanup(setattr, self.cp, "REPO_DIR", real)
code, body = self.act()
self.assertEqual((code, body["result"].get("deleted")), (202, 0), body)
self.assertTrue((self.repo / "snapshots" / self.pinned / "w.safetensors").exists())
self.assertTrue((self.repo / "snapshots" / self.stray).is_dir())
self.assertTrue(any("kept" in ln and "could not read every pin" in ln for ln in body["lines"]), body["lines"])
self.assertIsNone(self.cp.REGISTRY_CACHE["data"], "a scan that missed a pin is not kept")
# read whole again, the stray goes and the pinned stays
self.cp.REPO_DIR = real
code, body = self.act()
self.assertEqual(body["result"].get("deleted"), 1, body)
self.assertTrue((self.repo / "snapshots" / self.pinned / "w.safetensors").exists())
def test_what_a_ref_or_a_unit_names_is_kept_and_said(self):
(self.repo / "refs").mkdir()
(self.repo / "refs" / "main").write_text(self.stray)
+30 -20
View File
@@ -157,9 +157,9 @@ class Fetch(unittest.TestCase):
self.assertEqual(states(), ("incomplete", "absent"))
def test_an_installer_not_read_this_time_concludes_nothing(self):
# a checkout rewriting install-flash-unsloth.sh: its pins and its targets' files unread, the two GGUF targets
# read absent and the Library offered to fetch 85 GB on the disk, for the cache's 5 minutes (second review of
# v1.49.0). What was said stands, and the next call reads again.
# a checkout rewriting install-flash-unsloth.sh: gone, or read empty. Its pins and its targets' files not read,
# the two GGUF targets read absent and the Library offered to fetch 85 GB on the disk (second and third reviews
# of v1.49.0). They read unknown, the scan says it is partial, and it is not kept: the next call reads again.
import re
text = (REPO / "install-flash-unsloth.sh").read_text()
snap = self.hub / "models--unsloth--Qwen3.8-Flash-Next-GGUF" / "snapshots" / self.pins["FLASH_UNSLOTH_REV"]
@@ -170,26 +170,36 @@ class Fetch(unittest.TestCase):
/ re.search(r'^FLASH_UNSLOTH_DRAFT="([^"=]+)=', text, re.M).group(1))
draft.parent.mkdir(parents=True)
draft.write_text("w")
said = {t: self.targets()[t]["state"] for t in ("flash-unsloth", "flash-unsloth-iq3")}
self.assertEqual(said, {"flash-unsloth": "complete", "flash-unsloth-iq3": "complete"})
# the same repository without that one file
half = self.tmp / "half-repo"
shutil.rmtree(half, ignore_errors=True)
half.mkdir()
for f in REPO.iterdir():
if f.name != "install-flash-unsloth.sh":
(half / f.name).symlink_to(f)
both = ("flash-unsloth", "flash-unsloth-iq3")
reg = self.cp.registry_snapshot(max_age=0.0)
self.assertEqual(reg["partial"], [])
self.assertEqual({t["target"]: t["state"] for t in reg["targets"] if t["target"] in both},
{"flash-unsloth": "complete", "flash-unsloth-iq3": "complete"})
real = self.cp.REPO_DIR
self.cp.REPO_DIR = half
self.addCleanup(setattr, self.cp, "REPO_DIR", real)
got = self.targets()
self.assertEqual({t: got[t]["state"] for t in said}, said)
# nothing said before: this read is handed, and not kept
self.cp.REGISTRY_CACHE.update(ts=0.0, data=None)
self.targets()
self.assertIsNone(self.cp.REGISTRY_CACHE["data"])
# cut where its pins of the revision end and its targets' parts begin
cut = text[:text.index("FLASH_UNSLOTH_PART1=")]
for how, content in (("gone", None), ("read empty", ""), ("cut short", cut)):
with self.subTest(how):
half = self.tmp / "half-repo"
shutil.rmtree(half, ignore_errors=True)
half.mkdir()
for f in REPO.iterdir():
if f.name != "install-flash-unsloth.sh":
(half / f.name).symlink_to(f)
if content is not None:
(half / "install-flash-unsloth.sh").write_text(content)
self.cp.REPO_DIR = half
reg = self.cp.registry_snapshot(max_age=0.0)
self.assertTrue(reg["partial"], "the scan says it missed something")
self.assertEqual({t["target"]: t["state"] for t in reg["targets"] if t["target"] in both},
dict.fromkeys(both, "unknown"))
self.assertIsNone(self.cp.REGISTRY_CACHE["data"], "not kept")
self.assertEqual(self.cp.registry_snapshot()["partial"], reg["partial"], "the next call reads again")
self.cp.REPO_DIR = real
self.assertEqual({t: self.targets()[t]["state"] for t in said}, said)
reg = self.cp.registry_snapshot(max_age=0.0)
self.assertEqual(({t["target"]: t["state"] for t in reg["targets"] if t["target"] in both}, reg["partial"]),
({"flash-unsloth": "complete", "flash-unsloth-iq3": "complete"}, []))
def test_the_action_runs_the_switch_with_fetch_and_nothing_else(self):
code, body = self.cp.start_action("fetch", {"target": "kolibri-nvfp4"})
+3 -1
View File
@@ -17,6 +17,7 @@ from the units the test says are enabled.
"""
import atexit
import datetime
import functools
import importlib.util
import json
import os
@@ -102,8 +103,9 @@ def walled(script="install.sh", at=None, after=False, units=None):
return str(copy)
@functools.lru_cache(maxsize=1)
def side_installers():
"""The installers conformity.py reads its side lanes' values from (its SIDE), sorted."""
"""The installers conformity.py reads its side lanes' values from (its SIDE), sorted (read once)."""
spec = importlib.util.spec_from_file_location("conformity_for_the_wall", REPO / "conformity.py")
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)