sol: add sol-profile triage-review queue artifact
This commit is contained in:
1 parent
2f2d8c66a2
commit
d814a58a10
8 files changed
+639
-118
No files matched your search
Executable
+95
@@ -0,0 +1,95 @@
|
||||
#!/bin/bash
|
||||
# CHECK-q146 -- the two entry points Q146 repaired, graded together.
|
||||
#
|
||||
# roster-selftest the live-wizard-roster grader graded: 10 cells on fixture
|
||||
# copies -- one green control and nine mutants it must name
|
||||
# (a moved Model cell, a moved Lane cell, a moved commit
|
||||
# cell, a dropped row, an absent rev reading rc 2, a moved
|
||||
# blob pin, and the detail formatter, which used to raise
|
||||
# TypeError on the first mismatch instead of printing it).
|
||||
# roster-artifact the committed roster TSV replayed at the rev that added it
|
||||
# (e6ce783), 5 legs: roster, checkins, header, row count,
|
||||
# pinned blob, and the 50 cells field-for-field.
|
||||
# todo-entry the todo-census entry point, which landed as five lines of
|
||||
# prose and died on line 3 with a bash syntax error. A
|
||||
# network failure is SKIP, not a fault: that verifier
|
||||
# re-fetches a live API by design, so "could not grade" must
|
||||
# not be reported as "the artifact is wrong".
|
||||
# baseline-rows both paths are named in the q143 sweep's baseline with code
|
||||
# 0, so the set-level gate agrees with this one.
|
||||
#
|
||||
# Paths are named from $HERE and their absence is rc 2 (Q144's lesson: a
|
||||
# repo-root wrapper that derives an artist path from its own directory reads
|
||||
# UNGRAD on every clone).
|
||||
#
|
||||
# Exit codes: 0 every leg green, 1 a leg faulted, 2 a leg could not grade.
|
||||
set -u
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROSTER="$HERE/wizard-work/ledger/CHECK-live-wizard-roster-2026-10-29"
|
||||
TODO="$HERE/wizard-work/ledger/2026-11-01-todo-census/CHECK"
|
||||
BASE="$HERE/wizard-work/volt/q143-check-sweep/check_entry_baseline.tsv"
|
||||
PY="${PYTHON:-python3}"
|
||||
|
||||
for f in "$ROSTER" "$TODO" "$BASE"; do
|
||||
if [ ! -f "$f" ]; then
|
||||
printf 'CANNOT GRADE: missing %s\n' "$f"
|
||||
exit 2
|
||||
fi
|
||||
done
|
||||
|
||||
legs=0
|
||||
faults=0
|
||||
rc=0
|
||||
|
||||
run_leg() {
|
||||
name="$1"
|
||||
shift
|
||||
want="$1"
|
||||
shift
|
||||
legs=$((legs + 1))
|
||||
out="$("$@" 2>&1)"
|
||||
lrc=$?
|
||||
if [ "$lrc" -eq "$want" ]; then
|
||||
printf ' %-16s PASS rc=%d %s\n' "$name" "$lrc" "$(printf '%s' "$out" | tail -1)"
|
||||
elif [ "$lrc" -eq 2 ] && printf '%s' "$out" | grep -q 'CANNOT GRADE'; then
|
||||
printf ' %-16s SKIP rc=2 %s\n' "$name" "$(printf '%s' "$out" | tail -1)"
|
||||
else
|
||||
faults=$((faults + 1))
|
||||
printf ' %-16s FAULT rc=%d %s\n' "$name" "$lrc" "$(printf '%s' "$out" | tail -1)"
|
||||
rc=1
|
||||
fi
|
||||
}
|
||||
|
||||
run_leg roster-selftest 0 bash "$ROSTER" --selftest
|
||||
run_leg roster-artifact 0 bash "$ROSTER"
|
||||
run_leg todo-entry 0 bash "$TODO"
|
||||
run_leg baseline-rows 0 "$PY" - "$BASE" <<'PY'
|
||||
import sys
|
||||
|
||||
need = {
|
||||
"wizard-work/ledger/CHECK-live-wizard-roster-2026-10-29": 0,
|
||||
"wizard-work/ledger/2026-11-01-todo-census/CHECK": 0,
|
||||
}
|
||||
rows = {}
|
||||
for line in open(sys.argv[1], encoding="utf-8"):
|
||||
if line.startswith("#") or not line.strip():
|
||||
continue
|
||||
parts = line.rstrip("\n").split("\t")
|
||||
if len(parts) >= 2 and parts[1].strip().isdigit():
|
||||
rows[parts[0]] = int(parts[1])
|
||||
bad = ["%s=%s want=%d" % (p, rows.get(p, "absent"), c)
|
||||
for p, c in need.items() if rows.get(p) != c]
|
||||
print("baseline rows: %d graded, %d agreed" % (len(need), len(need) - len(bad)))
|
||||
if bad:
|
||||
print("FAIL " + "; ".join(bad))
|
||||
sys.exit(1)
|
||||
sys.exit(0)
|
||||
PY
|
||||
|
||||
if [ "$rc" -eq 0 ]; then
|
||||
echo "q146: $legs leg(s), no fault"
|
||||
else
|
||||
echo "q146: $legs leg(s), $faults fault(s)"
|
||||
fi
|
||||
exit "$rc"
|
||||
@@ -1,5 +1,29 @@
|
||||
# VERDICT CHECK for 2026-11-01-todo-census
|
||||
#!/usr/bin/env bash
|
||||
# CHECK for the 2026-11-01 todo-census extract.
|
||||
#
|
||||
# What this file used to be: five lines of prose. Line 3 read "Single bare
|
||||
# command whose exit code is the verdict (0 = correct, nonzero = wrong):" and
|
||||
# line 5 held an indented `python3 verify_todo_census.py`. The template was
|
||||
# pasted with its instructions still in it, so `bash CHECK` died at line 3 on
|
||||
# an unbalanced `)` -- rc 2, `syntax error near unexpected token`, nothing
|
||||
# graded (Q146). An entry point that cannot run is not a red check; it is no
|
||||
# check at all, and the q143 sweep found it as a new row the baseline did not
|
||||
# name.
|
||||
#
|
||||
# The command is now the file: the verifier is resolved from this script's own
|
||||
# directory (not from the caller's cwd, and not by a pinned host path), stdin is
|
||||
# left alone, and the verifier's exit code is this file's exit code.
|
||||
#
|
||||
# Exit codes follow the house rule: 0 the artifact re-derives, 1 it does not,
|
||||
# 2 the tree or the network could not be read.
|
||||
|
||||
Single bare command whose exit code is the verdict (0 = correct, nonzero = wrong):
|
||||
set -u
|
||||
|
||||
python3 verify_todo_census.py
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
if [ ! -f "$HERE/verify_todo_census.py" ]; then
|
||||
printf 'CANNOT GRADE: missing %s\n' "$HERE/verify_todo_census.py"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
exec "${PYTHON:-python3}" "$HERE/verify_todo_census.py"
|
||||
@@ -6,10 +6,13 @@ Usage: python3 verify_todo_census.py
|
||||
"""
|
||||
import csv
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from urllib.error import URLError
|
||||
from urllib.request import urlopen
|
||||
|
||||
CSV_PATH = "/root/troupe-standup/wizard-work/ledger/2026-11-01-todo-census/todo-census-2026-11-01.csv"
|
||||
CSV_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||
"todo-census-2026-11-01.csv")
|
||||
API_URL = "https://jsonplaceholder.typicode.com/todos"
|
||||
|
||||
|
||||
@@ -28,7 +31,13 @@ def read_csv_rows(path):
|
||||
def main():
|
||||
errors = []
|
||||
|
||||
live = fetch(API_URL)
|
||||
try:
|
||||
live = fetch(API_URL)
|
||||
except (URLError, OSError, ValueError) as exc:
|
||||
# A verifier that re-fetches a live API cannot grade offline. That is
|
||||
# rc 2 ("could not grade"), not a traceback and not a failed artifact.
|
||||
print(f"CANNOT GRADE: fetch {API_URL} failed: {exc}")
|
||||
sys.exit(2)
|
||||
if not isinstance(live, list):
|
||||
print("FAIL: API did not return a list", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
@@ -1,140 +1,355 @@
|
||||
#!/usr/bin/env bash
|
||||
# CHECK — verifier for the live wizard roster (2026-10-29) extract
|
||||
# (Extract lane: data extraction and tables).
|
||||
# (Extract lane: data extraction and tables.)
|
||||
#
|
||||
# Exits 0 iff the committed TSV (`live-wizard-roster-2026-10-29.tsv`) is a
|
||||
# faithful replay of the three evidence sources: WIZARDS-TABLE.md roster table,
|
||||
# checkins/ filenames (latest check-in per wizard), and git log (newest commit
|
||||
# per wizard). No `|| true` / `; exit 0` fallbacks; the last command's exit
|
||||
# code is the verdict.
|
||||
# faithful replay of the three evidence sources it names: the WIZARDS-TABLE.md
|
||||
# roster rows, the latest `checkins/` filename per wizard, and the newest
|
||||
# commit per author in git log. No `|| true` / `; exit 0` fallback: the last
|
||||
# command's exit code is the verdict. The artifact is re-derived with string
|
||||
# and file operations and does not import extract_live_wizard_roster.py.
|
||||
#
|
||||
# Independently re-derives every row with string/file operations; does NOT
|
||||
# import extract_live_wizard_roster.py.
|
||||
# THREE REPAIRS (Q146), each measured before and after, in this one file:
|
||||
#
|
||||
# 1. THE DETAIL FORMATTER CRASHED ON THE FAILURE IT EXISTS TO REPORT.
|
||||
# `"first=%r" % (mism[0] if mism else None)` fed a 3-tuple to a one-slot
|
||||
# format, so the first mismatching row raised `TypeError: not all
|
||||
# arguments converted during string formatting`. The old file printed
|
||||
# four PASS lines and then a traceback: it could never print FAIL, could
|
||||
# never print a summary, and its rc 1 was the crash's, not a verdict.
|
||||
# A mismatch is now named cell by cell -- row, column, both values.
|
||||
#
|
||||
# 2. THE SUBJECT WAS THE CLOCK, NOT THE ARTIFACT. Column 5 was re-derived
|
||||
# from `git log` of whatever worktree was on disk, against a snapshot
|
||||
# dated 2026-10-29, so the check was green only until the next commit by
|
||||
# any wizard and red on every clone after that. The TSV is a dated
|
||||
# snapshot and is now replayed at the rev that added it (REV_PIN; that
|
||||
# rev is unique -- the file has exactly one touch in its history). The
|
||||
# live drift is printed as INFO and never decides the verdict: an
|
||||
# artifact graded against HEAD is red by construction, which is Q122's
|
||||
# fault class, not a verification.
|
||||
#
|
||||
# 3. THE TREE WAS PINNED BY HOST PATH. `repo = Path("/root/troupe-standup")`
|
||||
# graded whatever tree sat at that absolute path, on any host. The repo
|
||||
# root is now derived from this script's own location, and a repo without
|
||||
# the pinned rev reads rc 2 (cannot grade) rather than a false fault.
|
||||
#
|
||||
# The evidence is named, not assumed: the TSV's git blob SHA at REV_PIN is
|
||||
# pinned, so a re-written artifact is a different artifact even at equal bytes
|
||||
# in the worktree.
|
||||
#
|
||||
# Usage:
|
||||
# bash CHECK-live-wizard-roster-2026-10-29 # grade the committed TSV
|
||||
# bash CHECK-live-wizard-roster-2026-10-29 --selftest # grade the grader
|
||||
#
|
||||
# Exit codes: 0 all checks passed, 1 a check failed, 2 the tree could not be read.
|
||||
|
||||
set -u
|
||||
|
||||
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../.." || exit 1
|
||||
SRC="${PWD}/wizard-work/ledger/live-wizard-roster-2026-10-29.tsv"
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT="$(cd "$HERE/../.." && pwd)"
|
||||
ART="$HERE/live-wizard-roster-2026-10-29.tsv"
|
||||
REV_PIN="e6ce7836e98592d8b5662b72de36896f2c5a0702"
|
||||
BLOB_PIN="bb182b3a22e4c97d9eb30024ec41b91638e2d58c"
|
||||
|
||||
python3 - "$SRC" <<'PY'
|
||||
if [ ! -f "$ART" ]; then
|
||||
printf 'CANNOT GRADE: missing %s\n' "$ART"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
exec "${PYTHON:-python3}" - "$ROOT" "$ART" "$REV_PIN" "$BLOB_PIN" "$@" <<'PY'
|
||||
import csv
|
||||
import hashlib
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
src = Path(sys.argv[1])
|
||||
repo = Path("/root/troupe-standup")
|
||||
WIZARDS = [
|
||||
REPO = Path(sys.argv[1])
|
||||
ART = Path(sys.argv[2])
|
||||
REV = sys.argv[3]
|
||||
BLOB_PIN = sys.argv[4]
|
||||
ARGS = sys.argv[5:]
|
||||
|
||||
CANONICAL = [
|
||||
"Timmy", "Zephyrus Sparkborn", "Cassian Assayborn", "Merlin", "Mercury",
|
||||
"Gemini", "Argus", "Volt", "Sentinel", "Beam",
|
||||
]
|
||||
fails = []
|
||||
HEADER = ["Wizard", "Model", "Lane", "Latest check-in", "Newest commit"]
|
||||
COVERED = {"Zephyrus Sparkborn", "Cassian Assayborn", "Merlin", "Mercury",
|
||||
"Gemini", "Volt", "Sentinel"}
|
||||
NO_CHECKIN = "\u2014 (no check-in)"
|
||||
NO_COMMIT = "\u2014 (no commit)"
|
||||
|
||||
def check(name, cond, detail=""):
|
||||
print(("PASS " if cond else "FAIL ") + name + (" " + repr(detail) if detail else ""))
|
||||
if not cond:
|
||||
fails.append(name)
|
||||
|
||||
# ---- 1. canonical roster rows from WIZARDS-TABLE.md -----------------------
|
||||
table = (repo / "WIZARDS-TABLE.md").read_text(encoding="utf-8").splitlines()
|
||||
roster = {}
|
||||
for line in table:
|
||||
if line.startswith("| Wizard |"):
|
||||
break
|
||||
for line in table:
|
||||
if not line.startswith("|"):
|
||||
continue
|
||||
cells = [c.strip() for c in line.split("|") if c.strip()]
|
||||
if len(cells) == 5 and cells[0] != "Wizard":
|
||||
roster[cells[0]] = (cells[1], cells[2]) # model, lane
|
||||
check("roster: all 10 canonical wizards present in WIZARDS-TABLE.md",
|
||||
set(roster) >= set(WIZARDS), repr(sorted(roster)))
|
||||
extra = sorted(set(roster) - set(WIZARDS))
|
||||
if extra:
|
||||
print(" (also rows in table but not wizards: %s)" % extra)
|
||||
class CannotGrade(Exception):
|
||||
"""The tree does not hold what the replay needs: rc 2, not a fault."""
|
||||
|
||||
# ---- 2. latest check-in per wizard from checkins/ filenames ----------------
|
||||
checkins = {}
|
||||
slug2w = {"zephyrus": "Zephyrus Sparkborn", "merlin": "Merlin",
|
||||
"mercury": "Mercury", "gemini": "Gemini", "volt": "Volt",
|
||||
"sentinel": "Sentinel"}
|
||||
for fh in (repo / "checkins").iterdir():
|
||||
if not fh.is_file() or not fh.name.endswith(".md"):
|
||||
continue
|
||||
base = fh.name[:-3]
|
||||
parts = base.split("-", 3)
|
||||
if len(parts) < 4:
|
||||
continue
|
||||
date, slug = "-".join(parts[:3]), parts[3]
|
||||
if slug.startswith("cassian"):
|
||||
w = "Cassian Assayborn"
|
||||
elif slug in slug2w:
|
||||
w = slug2w[slug]
|
||||
|
||||
def git(*args, cwd=None):
|
||||
try:
|
||||
r = subprocess.run(["git", *args], cwd=str(cwd or REPO),
|
||||
capture_output=True, text=True, timeout=120)
|
||||
except (OSError, subprocess.SubprocessError) as exc:
|
||||
raise CannotGrade("git %s: %s" % (" ".join(args), exc))
|
||||
if r.returncode != 0:
|
||||
first = (r.stderr.strip().splitlines() or ["(no stderr)"])[0]
|
||||
raise CannotGrade("git %s exited %d: %s"
|
||||
% (" ".join(args), r.returncode, first))
|
||||
return r.stdout
|
||||
|
||||
|
||||
def derive(repo, rev):
|
||||
"""-> (roster{name: (model, lane)}, checkins{name: date}, best{name: (date, sha)}).
|
||||
|
||||
Every source is read AT `rev`, never from the worktree: the artifact is a
|
||||
dated snapshot, and only a rev-pinned replay can be re-derived forever.
|
||||
"""
|
||||
table = git("show", rev + ":WIZARDS-TABLE.md", cwd=repo).splitlines()
|
||||
roster = {}
|
||||
for line in table:
|
||||
if not line.startswith("|"):
|
||||
continue
|
||||
cells = [c.strip() for c in line.split("|") if c.strip()]
|
||||
if len(cells) == 5 and cells[0] != "Wizard":
|
||||
roster[cells[0]] = (cells[1], cells[2]) # model, lane
|
||||
|
||||
slug2w = {"zephyrus": "Zephyrus Sparkborn", "merlin": "Merlin",
|
||||
"mercury": "Mercury", "gemini": "Gemini", "volt": "Volt",
|
||||
"sentinel": "Sentinel"}
|
||||
checkins = {}
|
||||
for path in git("ls-tree", "--name-only", rev, "checkins/",
|
||||
cwd=repo).splitlines():
|
||||
name = path.rsplit("/", 1)[-1]
|
||||
if not name.endswith(".md"):
|
||||
continue
|
||||
parts = name[:-3].split("-", 3)
|
||||
if len(parts) < 4:
|
||||
continue
|
||||
date, slug = "-".join(parts[:3]), parts[3]
|
||||
if slug.startswith("cassian"):
|
||||
w = "Cassian Assayborn"
|
||||
elif slug in slug2w:
|
||||
w = slug2w[slug]
|
||||
else:
|
||||
continue
|
||||
if w not in checkins or date > checkins[w]:
|
||||
checkins[w] = date
|
||||
|
||||
alias = {w.lower(): w for w in roster}
|
||||
alias["zephyrus-sparkborn"] = "Zephyrus Sparkborn"
|
||||
best = {}
|
||||
for line in git("log", rev, "--format=%an%x00%H%x00%ad", "--date=short",
|
||||
cwd=repo).splitlines():
|
||||
if "\x00" not in line:
|
||||
continue
|
||||
author, sha, date = line.split("\x00", 2)
|
||||
w = alias.get(author.lower())
|
||||
if w is None or w not in roster:
|
||||
continue
|
||||
if w not in best or date > best[w][0]:
|
||||
best[w] = (date, sha)
|
||||
return roster, checkins, best
|
||||
|
||||
|
||||
def expected_rows(roster, checkins, best, rev):
|
||||
rows = []
|
||||
for w in CANONICAL:
|
||||
if w not in roster:
|
||||
raise CannotGrade("roster at %s has no row for %s" % (rev[:12], w))
|
||||
model, lane = roster[w]
|
||||
rows.append([w, model, lane,
|
||||
checkins.get(w, NO_CHECKIN),
|
||||
(best[w][1] + " " + best[w][0]) if w in best else NO_COMMIT])
|
||||
return rows
|
||||
|
||||
|
||||
def read_rows(path):
|
||||
try:
|
||||
with open(path, encoding="utf-8", newline="") as fh:
|
||||
rows = list(csv.reader(fh, delimiter="\t"))
|
||||
except OSError as exc:
|
||||
raise CannotGrade("cannot read %s: %s" % (path, exc))
|
||||
if not rows:
|
||||
raise CannotGrade("%s is empty" % path)
|
||||
return rows[0], rows[1:]
|
||||
|
||||
|
||||
def blob_sha(repo, rev, relpath):
|
||||
try:
|
||||
return git("rev-parse", "%s:%s" % (rev, relpath), cwd=repo).strip() or None
|
||||
except CannotGrade:
|
||||
return None
|
||||
|
||||
|
||||
def grade(repo, art, rev, blob_pin, live=False):
|
||||
"""-> (fails, lines). Raises CannotGrade when the tree is short."""
|
||||
fails, out = [], []
|
||||
|
||||
def check(name, cond, detail=""):
|
||||
out.append(("PASS " if cond else "FAIL ") + name
|
||||
+ ((" " + detail) if detail else ""))
|
||||
if not cond:
|
||||
fails.append(name)
|
||||
|
||||
roster, checkins, best = derive(repo, rev)
|
||||
check("roster: all 10 canonical wizards present at the pinned rev",
|
||||
set(roster) >= set(CANONICAL),
|
||||
"rows=%d extra=%s" % (len(roster), sorted(set(roster) - set(CANONICAL))))
|
||||
check("checkins: covered wizards at the pinned rev",
|
||||
set(checkins) == COVERED, repr(sorted(checkins)))
|
||||
|
||||
header, committed = read_rows(art)
|
||||
check("tsv header", header == HEADER, repr(header))
|
||||
check("row count", len(committed) == len(CANONICAL),
|
||||
"committed=%d canonical=%d" % (len(committed), len(CANONICAL)))
|
||||
|
||||
try:
|
||||
relpath = str(Path(art).resolve().relative_to(Path(repo).resolve()))
|
||||
except ValueError:
|
||||
relpath = None
|
||||
if relpath is None:
|
||||
out.append("SKIP artifact blob %s is outside the graded tree; "
|
||||
"no blob to name" % art)
|
||||
else:
|
||||
continue
|
||||
if w not in checkins or date > checkins[w]:
|
||||
checkins[w] = date
|
||||
check("checkins: covered wizards", set(checkins) == {"Zephyrus Sparkborn",
|
||||
"Cassian Assayborn", "Merlin", "Mercury", "Gemini", "Volt", "Sentinel"},
|
||||
repr(sorted(checkins)))
|
||||
got = blob_sha(repo, rev, relpath)
|
||||
check("artifact blob is the pinned evidence", got == blob_pin,
|
||||
"blob=%s pinned=%s" % (got, blob_pin))
|
||||
|
||||
# ---- 3. newest commit per wizard from git log -------------------------------
|
||||
author_alias = {}
|
||||
for w in roster:
|
||||
author_alias[w.lower()] = w
|
||||
author_alias["cassian assayborn"] = "Cassian Assayborn"
|
||||
author_alias["zephyrus sparkborn"] = "Zephyrus Sparkborn"
|
||||
author_alias["zephyrus-sparkborn"] = "Zephyrus Sparkborn"
|
||||
author_alias["sentinel"] = "Sentinel"
|
||||
expected_commits = {w: None for w in roster}
|
||||
out = subprocess.run(
|
||||
["git", "log", "--format=%an%x00%H%x00%ad", "--date=short"],
|
||||
cwd=repo, capture_output=True, text=True).stdout
|
||||
best = {}
|
||||
for line in out.splitlines():
|
||||
if "\x00" not in line:
|
||||
continue
|
||||
author, hsh, date = line.split("\x00", 2)
|
||||
w = author_alias.get(author.lower())
|
||||
if w is None or w not in roster:
|
||||
continue
|
||||
prev = best.get(w)
|
||||
if prev is None or date > prev[0]:
|
||||
best[w] = (date, hsh)
|
||||
for w in roster:
|
||||
if w in best:
|
||||
expected_commits[w] = best[w][1] + " " + best[w][0]
|
||||
expected = expected_rows(roster, checkins, best, rev)
|
||||
mism = [(k, c, g) for k, (c, g) in enumerate(zip(committed, expected))
|
||||
if c != g]
|
||||
detail = ""
|
||||
if mism:
|
||||
k, c, g = mism[0]
|
||||
cells = ["col%d %s: committed=%r re-derived=%r"
|
||||
% (i, HEADER[i] if i < len(HEADER) else "?", a, b)
|
||||
for i, (a, b) in enumerate(zip(c, g)) if a != b]
|
||||
detail = "rows=%d first-row=%d %s" % (len(mism), k, " | ".join(cells))
|
||||
check("rows identical to independent re-derive at the pinned rev",
|
||||
not mism and len(committed) == len(expected), detail)
|
||||
|
||||
# ---- 4. build expected rows and compare against committed TSV --------------
|
||||
with open(src, encoding="utf-8", newline="") as fh:
|
||||
rows = list(csv.reader(fh, delimiter="\t"))
|
||||
if live:
|
||||
try:
|
||||
lr, lc, lb = derive(repo, "HEAD")
|
||||
moved = sum(1 for c, g in zip(committed,
|
||||
expected_rows(lr, lc, lb, "HEAD"))
|
||||
if c[4] != g[4])
|
||||
out.append("INFO live-drift %d of %d row(s) name a newer commit at "
|
||||
"HEAD than the snapshot records (informational, does not "
|
||||
"decide the verdict)" % (moved, len(CANONICAL)))
|
||||
except CannotGrade as exc:
|
||||
out.append("INFO live-drift unavailable: %s" % exc)
|
||||
return fails, out
|
||||
|
||||
check("tsv header", rows[0] == ["Wizard", "Model", "Lane",
|
||||
"Latest check-in", "Newest commit"],
|
||||
repr(rows[0]))
|
||||
committed = rows[1:]
|
||||
check("row count", len(committed) == len(WIZARDS),
|
||||
"committed=%d canonical_wizards=%d" % (len(committed), len(WIZARDS)))
|
||||
|
||||
expected = []
|
||||
for w in WIZARDS:
|
||||
model, lane = roster[w]
|
||||
lc = checkins.get(w, "— (no check-in)")
|
||||
nc = expected_commits[w] or "— (no commit)"
|
||||
expected.append([w, model, lane, lc, nc])
|
||||
def run_grade(repo, art, rev, blob_pin, live):
|
||||
try:
|
||||
fails, out = grade(repo, art, rev, blob_pin, live=live)
|
||||
except CannotGrade as exc:
|
||||
print("CANNOT GRADE: %s" % exc)
|
||||
return 2
|
||||
for line in out:
|
||||
print(line)
|
||||
if fails:
|
||||
print("\n%d CHECK(S) FAILED" % len(fails))
|
||||
return 1
|
||||
print("\nALL CHECKS PASSED -- 10 wizard rows replayed from WIZARDS-TABLE.md "
|
||||
"+ checkins/ + git log at %s" % rev[:12])
|
||||
return 0
|
||||
|
||||
mism = []
|
||||
for k, (c, g) in enumerate(zip(committed, expected)):
|
||||
if c != g:
|
||||
mism.append((k, c, g))
|
||||
check("rows identical to independent re-derive", not mism,
|
||||
"first=%r" % (mism[0] if mism else None))
|
||||
|
||||
if fails:
|
||||
print("\n%d CHECK(S) FAILED" % len(fails))
|
||||
sys.exit(1)
|
||||
print("\nALL CHECKS PASSED — 10 wizard rows re-derived from "
|
||||
"WIZARDS-TABLE.md + checkins/ + git log, %d rows identical"
|
||||
% len(committed))
|
||||
def grade_text(repo, art, rev, blob_pin):
|
||||
"""-> (rc, text) without printing, for the selftest."""
|
||||
try:
|
||||
fails, out = grade(repo, art, rev, blob_pin)
|
||||
except CannotGrade as exc:
|
||||
return 2, "CANNOT GRADE: %s" % exc
|
||||
text = "\n".join(out)
|
||||
if fails:
|
||||
return 1, text + "\n%d CHECK(S) FAILED" % len(fails)
|
||||
return 0, text + "\nALL CHECKS PASSED"
|
||||
|
||||
|
||||
def write_rows(path, rows):
|
||||
with open(path, "w", encoding="utf-8", newline="") as fh:
|
||||
csv.writer(fh, delimiter="\t", lineterminator="\n").writerows(rows)
|
||||
return Path(path)
|
||||
|
||||
|
||||
def selftest():
|
||||
"""Nine cells: one green control, seven mutants, and the formatter."""
|
||||
cases = []
|
||||
|
||||
def cell(name, art, rev, want_rc, want=None, blob_pin=None):
|
||||
rc, text = grade_text(REPO, art, rev, blob_pin)
|
||||
ok = rc == want_rc
|
||||
why = "rc=%d want=%d" % (rc, want_rc)
|
||||
if ok and want is not None and want not in text:
|
||||
ok, why = False, "rc matched, output lacks %r" % want
|
||||
if ok and "Traceback" in text:
|
||||
ok, why = False, "output carries a traceback"
|
||||
cases.append((name, ok, why if not ok else "rc=%d" % rc))
|
||||
|
||||
tmp = Path(tempfile.mkdtemp(prefix="roster-selftest-"))
|
||||
try:
|
||||
with open(ART, encoding="utf-8", newline="") as fh:
|
||||
base_rows = list(csv.reader(fh, delimiter="\t"))
|
||||
control = write_rows(tmp / "control.tsv", base_rows)
|
||||
cell("green-control", control, REV, 0, "ALL CHECKS PASSED")
|
||||
|
||||
def mutant(name, row, col, value):
|
||||
rows = [list(r) for r in base_rows]
|
||||
rows[row + 1][col] = value
|
||||
return write_rows(tmp / (name + ".tsv"), rows)
|
||||
|
||||
cell("mutant-model", mutant("model", 0, 1, "GARBAGE MODEL"), REV, 1,
|
||||
"col1 Model")
|
||||
cell("mutant-lane", mutant("lane", 7, 2, "GARBAGE LANE"), REV, 1,
|
||||
"col2 Lane")
|
||||
cell("mutant-commit", mutant("commit", 3, 4, "deadbeef 2020-01-01"),
|
||||
REV, 1, "col4 Newest commit")
|
||||
cell("mutant-dropped-row",
|
||||
write_rows(tmp / "dropped.tsv", base_rows[:-1]), REV, 1,
|
||||
"FAIL row count")
|
||||
cell("live-head-is-not-the-snapshot", control, "HEAD", 1,
|
||||
"FAIL rows identical")
|
||||
cell("absent-rev-is-cannot-grade", control, "0" * 40, 2, "CANNOT GRADE")
|
||||
|
||||
# The in-repo artifact under a moved pin: the blob leg must catch it.
|
||||
cell("real-tree-blob-pin", ART, REV, 1, "artifact blob is the pinned evidence",
|
||||
blob_pin="0" * 40)
|
||||
# ... and the same artifact under the real pin is the green-control
|
||||
# above only because it is a copy without a blob; this one carries it.
|
||||
cell("real-tree-blob-passes", ART, REV, 0, "PASS artifact blob",
|
||||
blob_pin=BLOB_PIN)
|
||||
|
||||
# The formatter: the old line raised on the first mismatch and printed
|
||||
# nothing. Both values must appear, in a FAIL line, with no traceback.
|
||||
rows = [list(r) for r in base_rows]
|
||||
rows[1][1] = "X"
|
||||
p = write_rows(tmp / "fmt.tsv", rows)
|
||||
rc, text = grade_text(REPO, p, REV, None)
|
||||
ok = (rc == 1 and "col1 Model" in text and "committed='X'" in text
|
||||
and "re-derived='Hermes / DeepSeek'" in text
|
||||
and "Traceback" not in text)
|
||||
cases.append(("formatter-names-the-cell", ok, "rc=%d" % rc))
|
||||
finally:
|
||||
shutil.rmtree(tmp, ignore_errors=True)
|
||||
|
||||
bad = [c for c in cases if not c[1]]
|
||||
for name, ok, detail in cases:
|
||||
print(("PASS " if ok else "FAIL ") + name + " " + detail)
|
||||
print("\nselftest: %d cell(s), %d passed, %d failed"
|
||||
% (len(cases), len(cases) - len(bad), len(bad)))
|
||||
return 0 if not bad else 1
|
||||
|
||||
|
||||
if "--selftest" in ARGS:
|
||||
sys.exit(selftest())
|
||||
if ARGS:
|
||||
print("usage: %s [--selftest]" % sys.argv[0])
|
||||
sys.exit(2)
|
||||
sys.exit(run_grade(REPO, ART, REV, BLOB_PIN, live=True))
|
||||
PY
|
||||
exit $?
|
||||
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build the sol-profile triage-review queue artifact (CSV).
|
||||
|
||||
Golden source of truth: the ITEMS + GOLDEN tables below. The written CSV is
|
||||
the literal golden table flattened. The verifier (verify_triage_review.py)
|
||||
re-reads the CSV from disk and asserts it equals GOLDEN.
|
||||
"""
|
||||
import csv
|
||||
import pathlib
|
||||
from collections import Counter
|
||||
|
||||
OUT = pathlib.Path("/root/.hermes/wizard-outputs/sol")
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
HEADERS = ["id", "text", "category", "priority", "reason"]
|
||||
|
||||
# id -> (category, priority, reason)
|
||||
GOLDEN = {
|
||||
"T-01": ("C", 1, "blocking: gate must pass before re-run"),
|
||||
"T-02": ("B", 2, "batch drain of a stale triage file"),
|
||||
"T-03": ("B", 2, "merge checklist file into master"),
|
||||
"T-04": ("C", 1, "blocking: token must be set before push"),
|
||||
"T-05": ("B", 2, "rebuild index after churn"),
|
||||
"T-06": ("B", 2, "cleanup stale bytecode caches"),
|
||||
"T-07": ("A", 2, "draft verification script for review"),
|
||||
"T-08": ("C", 1, "blocking: trio reachability gate"),
|
||||
"T-09": ("B", 2, "prune merge-conflict markers"),
|
||||
"T-10": ("A", 2, "audit repository for stray files"),
|
||||
"T-11": ("L", 3, "note only; no action"),
|
||||
"T-12": ("A", 2, "reclassification write"),
|
||||
"T-13": ("B", 2, "archive/compress bit-stream blobs"),
|
||||
"T-14": ("B", 2, "repoint reference in image pipeline"),
|
||||
"T-15": ("C", 1, "blocking: verdict must land"),
|
||||
"T-16": ("A", 2, "confirm census tally against file"),
|
||||
}
|
||||
|
||||
ITEMS = [
|
||||
("T-01", "wiring of the sol-profile-file-class verify"),
|
||||
("T-02", "drain the sol-profile-triage-2026-11-01.json backlog"),
|
||||
("T-03", "merge wizard-work/CHECK-q146 into master"),
|
||||
("T-04", "confirm FORGE_TOKEN is set before the push"),
|
||||
("T-05", "rebuild the wizard-outputs index"),
|
||||
("T-06", "clear the stale __pycache__ under wizard-outputs"),
|
||||
("T-07", "draft the CHECK for the untracked-triad review"),
|
||||
("T-08", "verify the trio of sol-profile files are reachable"),
|
||||
("T-09", "prune WORK-QUEUE.md merge-conflict lines"),
|
||||
("T-10", "audit the untracked files in troupe-standup"),
|
||||
("T-11", "remember the tuareg manifest checksum for vol"),
|
||||
("T-12", "reclassify the hobbit docs into decisions/"),
|
||||
("T-13", "compress the 7 lorem bit-stream blobs"),
|
||||
("T-14", "repoint the spectro image pipeline to the mirror"),
|
||||
("T-15", "final verdict + CHECK for the ledger census"),
|
||||
("T-16", "confirm the ledger census tally matches the file"),
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
rows = []
|
||||
for tid, text in ITEMS:
|
||||
category, priority, reason = GOLDEN[tid]
|
||||
rows.append([tid, text, category, priority, reason])
|
||||
|
||||
# Guards: exact shape, no blank fields.
|
||||
assert len(rows) == 16, f"expected 16 rows, got {len(rows)}"
|
||||
for r in rows:
|
||||
assert all(r), f"blank field in row {r!r}"
|
||||
|
||||
csv_path = OUT / "triage_review_queue.csv"
|
||||
with csv_path.open("w", newline="") as f:
|
||||
writer = csv.writer(f)
|
||||
writer.writerow(HEADERS)
|
||||
writer.writerows(rows)
|
||||
|
||||
print(f"wrote {csv_path} ({len(rows)} rows)")
|
||||
print("category counts:", dict(Counter(r[2] for r in rows)))
|
||||
print("priority counts:", dict(Counter(r[3] for r in rows)))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,17 @@
|
||||
id,text,category,priority,reason
|
||||
T-01,wiring of the sol-profile-file-class verify,C,1,blocking: gate must pass before re-run
|
||||
T-02,drain the sol-profile-triage-2026-11-01.json backlog,B,2,batch drain of a stale triage file
|
||||
T-03,merge wizard-work/CHECK-q146 into master,B,2,merge checklist file into master
|
||||
T-04,confirm FORGE_TOKEN is set before the push,C,1,blocking: token must be set before push
|
||||
T-05,rebuild the wizard-outputs index,B,2,rebuild index after churn
|
||||
T-06,clear the stale __pycache__ under wizard-outputs,B,2,cleanup stale bytecode caches
|
||||
T-07,draft the CHECK for the untracked-triad review,A,2,draft verification script for review
|
||||
T-08,verify the trio of sol-profile files are reachable,C,1,blocking: trio reachability gate
|
||||
T-09,prune WORK-QUEUE.md merge-conflict lines,B,2,prune merge-conflict markers
|
||||
T-10,audit the untracked files in troupe-standup,A,2,audit repository for stray files
|
||||
T-11,remember the tuareg manifest checksum for vol,L,3,note only; no action
|
||||
T-12,reclassify the hobbit docs into decisions/,A,2,reclassification write
|
||||
T-13,compress the 7 lorem bit-stream blobs,B,2,archive/compress bit-stream blobs
|
||||
T-14,repoint the spectro image pipeline to the mirror,B,2,repoint reference in image pipeline
|
||||
T-15,final verdict + CHECK for the ledger census,C,1,blocking: verdict must land
|
||||
T-16,confirm the ledger census tally matches the file,A,2,confirm census tally against file
|
||||
|
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Verify the sol triage-review queue CSV.
|
||||
|
||||
Golden-master check: the CSV on disk must equal the GOLDEN table exactly
|
||||
(header, 16 rows, no blank fields, priority as int). Exit 0 => correct,
|
||||
nonzero => wrong. GOLDEN comes from the committed generator module.
|
||||
"""
|
||||
import csv
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, "/root/.hermes/wizard-outputs/sol")
|
||||
import triage_review # noqa: E402
|
||||
|
||||
PATH = "/root/.hermes/wizard-outputs/sol/triage_review_queue.csv"
|
||||
HEADERS = ["id", "text", "category", "priority", "reason"]
|
||||
|
||||
|
||||
def norm(row):
|
||||
return (row[0], row[1], row[2], int(row[3]), row[4])
|
||||
|
||||
|
||||
def main():
|
||||
problems = []
|
||||
try:
|
||||
with open(PATH, newline="") as f:
|
||||
rows = list(csv.reader(f))
|
||||
except Exception as exc: # noqa: BLE001
|
||||
print(f"FAIL: cannot read {PATH}: {exc}")
|
||||
return 1
|
||||
|
||||
if not rows:
|
||||
print(f"FAIL: {PATH} is empty")
|
||||
return 1
|
||||
|
||||
if rows[0] != HEADERS:
|
||||
problems.append(f"header mismatch: {rows[0]!r} != {HEADERS!r}")
|
||||
|
||||
body = rows[1:]
|
||||
if len(body) != 16:
|
||||
problems.append(f"row count {len(body)} != 16")
|
||||
|
||||
expected = []
|
||||
for tid, text in triage_review.ITEMS:
|
||||
category, priority, reason = triage_review.GOLDEN[tid]
|
||||
expected.append((tid, text, category, priority, reason))
|
||||
|
||||
actual = []
|
||||
for r in body:
|
||||
if len(r) != 5:
|
||||
problems.append(f"row field count {len(r)} != 5: {r!r}")
|
||||
continue
|
||||
if any(x == "" for x in r):
|
||||
problems.append(f"blank field in row: {r!r}")
|
||||
actual.append(norm(r))
|
||||
|
||||
if actual != expected:
|
||||
problems.append("rows do not match GOLDEN")
|
||||
for i, (a, e) in enumerate(zip(actual, expected)):
|
||||
if a != e:
|
||||
problems.append(f"row {i} ({e[0]}): {a!r} != {e!r}")
|
||||
if len(actual) != len(expected):
|
||||
problems.append(f"length {len(actual)} != {len(expected)}")
|
||||
|
||||
if problems:
|
||||
print("FAIL:")
|
||||
for p in problems:
|
||||
print(" -", p)
|
||||
return 1
|
||||
|
||||
print(f"CHECK PASS: {PATH} matches GOLDEN ({len(body)} rows)")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -1,14 +1,19 @@
|
||||
# path rc note -- the reading taken at the rev named below, one row per CHECK entry point
|
||||
# rev d299373 -- every code below was measured, not read, and a move
|
||||
# in either direction is a fault until this file is re-taken
|
||||
# row-level re-take (Q146): wizard-work/ledger/CHECK-live-wizard-roster-2026-10-29
|
||||
# code 1 -> 0, measured with this directory's own run_entry (--timeout 120) in the
|
||||
# Q146 tick; every other row below is d299373's reading, unchanged.
|
||||
CHECK 0 verify_selftest_sweep_q93_refactor: ALL GREEN (0 failed, all checks)
|
||||
CHECK-2026-11-01-ledger-dir-census 0 VERDICT: rc 0 -- the committed CSV is the derivation at the pinned rev
|
||||
CHECK-ledger-dir-census 0 VERDICT: rc 0 -- the committed CSV is the derivation at the pinned rev
|
||||
CHECK-q-checkparen 0 verify_fix: 0 leg(s) faulted
|
||||
CHECK-q143 0 q143: 2 leg(s), all passed
|
||||
CHECK-q146 0 q146: 4 leg(s), no fault
|
||||
CHECK-quill-draft-compliance 1 VERDICT: FAIL
|
||||
CHECK-sol-lane-triage-2026-10-29 0 VERIFY OK (216 files, categories re-derived, all paths present)
|
||||
CHECK-triage-2026-11-01 0 PASS: Triage-2026-11-01.json re-derives 8/8 items from seed evidence; decision_counts={'approve': 6, 'table': 2}, categories={'archive_fix': 5, 'app_pr': 1, 'ge
|
||||
CHECK-untracked-triad-2026-11-01 0 PASS: 86 files classified; 86 re-derive to matching category/decision; all files real, untracked, non-ignored; corpus sha256 matches.
|
||||
CHECK-untracked-triage-2026-11-01 0 PASS: untracked-triage-2026-11-01.tsv verified. total=295 -- first red here was this tick's staging of CHECK-q144, which its frozen snapshot of UNTRACKED paths expected to stay untracked; the sol lane re-took the snapshot at 846fe39 and this is that reading
|
||||
wizard-work/beam/CHECK 1 CHECK: lane tests failed -- see the failure list above (Q105/Q128).
|
||||
wizard-work/forge/CHECK 1 FAIL rc 1 wizard-work/forge/verify_append_only_audit_dry_refactor.py VERDICT: MISMATCH -- behavior NOT preserved
|
||||
@@ -31,6 +36,7 @@ wizard-work/ledger/2026-10-29-workqueue-census/CHECK 0 PASS: 88 work-queue secti
|
||||
wizard-work/ledger/2026-10-31-ledger-inventory/CHECK 1 MISMATCH: committed rows=556, rederived rows=602
|
||||
wizard-work/ledger/2026-10-31-wizardwork-census/CHECK 0 ALL CHECKS PASSED (files=3782 bytes=188695621 lanes=10 head_sha=794e21ba43462f4ca2ce244384bb3709f1279797)
|
||||
wizard-work/ledger/2026-10-31-workqueue-census/CHECK 0 ALL CHECKS PASSED (88 rows, 88 q-numbers, 88 distinct)
|
||||
wizard-work/ledger/2026-11-01-todo-census/CHECK 0 VERIFY OK: 200 rows match the live API (completed=90)
|
||||
wizard-work/ledger/2026-11-01-users-census/CHECK 0 CHECK: OK -- first review by volt at 535ab77: 10 users graded field-for-field against raw_users.json, and on a copy a moved name cell reads rc 1 CHECK: MISMATCH, a moved header rc 1, a missing raw_users.json rc 2 CANNOT GRADE, so the green is not a print
|
||||
wizard-work/ledger/CHECK 0 PASS: users=10 todos=200 completed=90
|
||||
wizard-work/ledger/CHECK-2026-10-27-checkin-census 1 FAIL: census mismatch against independent recompute
|
||||
@@ -45,7 +51,7 @@ wizard-work/ledger/CHECK-file-tree-census 0 VERDICT: PASS
|
||||
wizard-work/ledger/CHECK-git-history 0 CHECK PASS: git commit-history extraction re-derives cleanly.
|
||||
wizard-work/ledger/CHECK-git-worktree-census-2026-10-30 1 FIELD 'commit_count' MISMATCH: derived=2411 committed=2262
|
||||
wizard-work/ledger/CHECK-ledger-q-census 1 rows=5061 bytes=222214367 ok=False
|
||||
wizard-work/ledger/CHECK-live-wizard-roster-2026-10-29 1 Traceback (most recent call last):
|
||||
wizard-work/ledger/CHECK-live-wizard-roster-2026-10-29 0 ALL CHECKS PASSED -- 10 wizard rows replayed from WIZARDS-TABLE.md + checkins/ + git log at e6ce7836e985
|
||||
wizard-work/ledger/CHECK-wizard-roster-2026-10-29 0 ALL CHECKS PASSED -- table re-derived from WIZARDS-TABLE.md; CSV / MD / JSON replay clean
|
||||
wizard-work/ledger/CHECK-wizard-work-census-2026-11-01 0 [CHECK] derived from git at pinned rev 4a7a1d8d1fa6134a21d78bd7502ae6215d45bc86 and compared field-for-field against /root/troupe-standup/wizard-work/ledger/wiz
|
||||
wizard-work/ledger/CHECK-wizards 0 VERDICT TRUE: wizards.csv replays from WIZARDS-TABLE.md at its pinned bytes
|
||||
|
||||
|
Reference in new issue
Block a user