Files
club-3090/scripts/tests/test-compose-status-drift.sh
T
1182d6b2c3 feat(registry): slug health/availability flag (#265)
* feat(registry): add slug health/availability flag

Add a lifecycle `status` to every registry slug so `switch.sh --list`,
launch, and switch are no longer blind to a compose's health. Previously
status lived only in compose-header comments, which drifted: the Genesis
dual compose declared "Working (with Genesis)" while its pin is parked and
it won't boot clean — a user could boot a broken slug unknowingly.

- compose_registry.py: `_entry()` gains keyword-only `status`
  (default "production") + `status_note`, validated against the enum
  (production/caveats/experimental/preview/upstream-gated/deprecated).
  Add `compose_header_status()` mapping a compose's profile-schema
  `Status:` emoji to that enum.
- Sweep every compose `Status:` header to a canonical enum value and
  re-flag the non-functional slugs: all *genesis* + gemma-4-31b single
  fp8 -> upstream-gated; carnice -> caveats; qwopus + qwen-a3b-preview
  -> preview; bf16/int8 A/Bs, llamacpp bounded-thinking, PRISM/APEX eval
  lanes, gemma-4-26b-a4b onboarding -> experimental; tq3-mtp -> deprecated.
- registry-emit.sh emits `status` + `status_note` as the last two VARIANT
  fields; both loaders + the parity tests read the extended field list.
- switch.sh --list: status marker (caveats -> "(caveats)", the NA set ->
  "(NA: <word>)"); model/topology grouping preserved. Launch/switch gate:
  production launches, caveats launches with a notice, NA warns + requires
  --force. launch.sh surfaces the flag before delegating to switch.sh.
- New drift-guard test test-compose-status-drift.sh: registry status in
  enum, compose header maps to enum, and the two agree.

45 entries unchanged; kv-calc calibration 17/17; full suite green (only
the pre-existing test-submit-bench fixture failure remains).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* feat(switch): add model/variant counts to --list

Header line shows supported-model count + total variants with the health
split (N production · N caveats · N NA); each model group shows its variant
count. Widen the marker column so the (NA: …)/(caveats) markers align.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: noonghunna <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
2026-05-30 21:10:49 +05:00

68 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Drift-guard for the slug health/availability flag (PR-A, design §12.5).
#
# Asserts that the registry `status` field and the compose-header `Status:`
# enum can't silently diverge again. Three checks:
# (a) every registry `status` is in the canonical enum (STATUS_VALUES);
# (b) every registered compose's profile-schema `Status:` header maps to the
# enum (i.e. it carries a canonical leading emoji — no "Working (with
# Genesis)"-style non-enum strings);
# (c) the registry `status` is consistent with its compose header.
set -euo pipefail
ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$ROOT_DIR"
export PYTHONPATH="$ROOT_DIR${PYTHONPATH:+:$PYTHONPATH}"
python3 - <<'PY'
from pathlib import Path
from scripts.lib.profiles.compose_registry import (
COMPOSE_REGISTRY,
STATUS_VALUES,
compose_header_status,
)
failures = []
def check(cond, msg):
if cond:
print(f"PASS: {msg}")
else:
print(f"FAIL: {msg}")
failures.append(msg)
enum = set(STATUS_VALUES)
for key, entry in sorted(COMPOSE_REGISTRY.items()):
status = entry.get("status")
# (a) registry status in the enum.
check(status in enum, f"{key}: registry status {status!r} in enum")
compose_path = Path(entry["compose_path"])
if not compose_path.exists():
check(False, f"{key}: compose file exists at {compose_path}")
continue
header = compose_header_status(compose_path.read_text(encoding="utf-8"))
# (b) compose header maps to the enum (canonical leading emoji present).
check(
header in enum,
f"{key}: compose Status header maps to enum (got {header!r} "
f"from {compose_path.as_posix()})",
)
# (c) registry status consistent with the compose header.
check(
header == status,
f"{key}: registry status ({status!r}) consistent with compose "
f"header ({header!r})",
)
if failures:
raise SystemExit(f"{len(failures)} status-drift checks failed")
PY
echo "test-compose-status-drift: ok"