Files
felhom.eu/documentation/audits/endings-list-2026-11-10/tools/make-table.py
T
admin 807175c27d
gates / gates (push) Successful in 2m1s
audits: the Endings list (2026-11-10) — 67 endings, 536 answers, 22 not found in 6 classes
What every thing a customer can end leaves behind, and who is told.
- documentation/audits/endings-list-2026-11-10/: README (one page), TABLE (67 endings x 8 questions,
  each answer with a mark and a pointer), MATRIX, the search list with controls, the helpers' raw
  answers, and the ageing drill on scratch guest 9202 (five rounds, put back).
- Marks: A 499, D 0, K 15, N 22. 9 endings are not named in the architecture folder.
- Register: six new rows, one per class (R-1373 … R-1378); 230 -> 236 open rows. Nine existing rows
  get a dated pointer line; none is closed, merged or re-ranked.
- STATUS.md: four decisions for the operator (D71 … D74).

No code change. No release. Machines: scratch guest 9202 only, put back.

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-11-10 13:52:31 +01:00

128 lines
6.4 KiB
Python

#!/usr/bin/env python3
"""make-table.py — build TABLE.md from the helpers' answers (evidence/helpers/resolved-*.json) and marks.py.
A cell with an entry in marks.py carries the MAIN SESSION's words: it was written after the source was read by eye.
Every other cell carries the helper's words and the mark A; its pointers were opened by resolve-helper.py (the file
and the line exist; the name the helper gave stands at the line). A dead pointer is dropped here. Read-only but for TABLE.md.
"""
import json, os, re, subprocess, sys
import marks
HERE = os.path.dirname(os.path.abspath(__file__)); AUDIT = os.path.dirname(HERE)
REPO = os.path.abspath(os.path.join(HERE, "..", "..", "..", "..")); WS = os.path.dirname(REPO)
PREFIX = {"AG": os.path.join(WS, "felhom-agent"), "CT": os.path.join(WS, "felhom-controller", "controller"),
"CAT": os.path.join(WS, "app-catalog-felhom.eu"), "HUB": os.path.join(REPO, "hub", "internal"), "E": REPO,
"AR": os.path.join(REPO, "documentation", "architecture"), "RB": os.path.join(REPO, "documentation", "runbooks"),
"EV": os.path.join(AUDIT, "evidence")}
TOK = re.compile(r"`((?:AG|CT|CAT|HUB|E|AR|RB|EV)/[^`:\s]+)(?::(\d+)(?:-(\d+))?)?`")
R = {h: json.load(open(os.path.join(AUDIT, "evidence", "helpers", f"resolved-{h}.json")))["endings"] for h in ("controller", "agent", "hub")}
Q = ["what ends, who starts it", "what the thing created", "what the ending removes and keeps on purpose", "what it leaves by accident",
"can it be undone, until when", "who is told", "half-way state", "how do we know"]
dropped = []
def live(tok):
m = TOK.fullmatch(tok)
pre, rest = m.group(1).split("/", 1)
p = os.path.join(PREFIX[pre], rest)
if not os.path.exists(p):
return False
if m.group(2):
n = sum(1 for _ in open(p, encoding="utf-8", errors="replace"))
return int(m.group(3) or m.group(2)) <= n
return True
def split(ans, eid, q):
"""helper answer -> (plain text, [live pointers])"""
ptrs = []
for m in TOK.finditer(ans):
t = m.group(0)
if live(t):
if t not in ptrs:
ptrs.append(t)
else:
dropped.append(f"{eid}-{q} {t}")
t = TOK.sub("", ans)
t = re.sub(r"`~?:\d+(?:-\d+)?`", "", t) # a short pointer the resolver could not place
t = re.sub(r"\(\s*(?:called|creator|see)?\s*[,;]?\s*\)", "", t)
t = re.sub(r"\s+([,.;:)])", r"\1", t)
t = re.sub(r"\(\s+", "(", t)
t = re.sub(r"([,;:])(?:\s*[,;:])+", r"\1", t)
t = re.sub(r"\s{2,}", " ", t).replace("|", "/").strip(" ;,·")
t = re.sub(r"\(\)", "", t)
if len(t) > 380:
cut = max(t.rfind(". ", 0, 380), t.rfind("; ", 0, 380))
t = t[:cut + 1 if cut > 150 else 377].rstrip(" ;") + " …"
return t, ptrs
def named(m):
kind, why = m["named"]
if kind != "grep":
return kind, f"architecture: {why}"
r = subprocess.run(["/usr/bin/grep", "-rEic", "--include=*.md", why, PREFIX["AR"]], capture_output=True, text=True)
files = [l for l in r.stdout.split("\n") if l and not l.endswith(":0")]
lines = sum(int(l.rsplit(":", 1)[1]) for l in files)
return ("MENTIONED" if lines else "UNNAMED"), f"architecture folder: {lines} lines in {len(files)} files match `/{why}/` (a machine count, not a reading)"
def main():
out = [open(os.path.join(HERE, "table-head.md"), encoding="utf-8").read().rstrip(), ""]
seedmap, bad = {}, []
body = []
for eid, m in sorted(marks.M.items()):
e = R[m["src"][0]][m["src"][1]]
st, why = named(m)
worst = "A"
rows = []
for q in range(1, 9):
if q in m["o"]:
mark, text, ptr = m["o"][q]
if ptr is None:
_, ps = split(e["answers"].get(str(q), ""), eid, q)
ptr = " ".join(ps[:4])
else:
mark = "A"
text, ps = split(e["answers"].get(str(q), ""), eid, q)
ptr = " ".join(ps[:4])
if q == 8 and eid in marks.DRILL:
text = marks.DRILL[eid] + " · " + text
ptr = ("`EV/drill/diff-all.txt` " + ptr).strip()
if mark == "A" and "`" not in ptr: # borrow the code path from question 3, then 1
for alt in (3, 1):
_, ps = split(e["answers"].get(str(alt), ""), eid, alt)
if ps:
ptr = " ".join(ps[:2]) + f" (the code path of question {alt})"
break
if mark == "A" and "`" not in ptr:
bad.append(f"{eid}-{q}: A with no pointer")
if not text:
bad.append(f"{eid}-{q}: empty answer")
for t in TOK.findall(ptr):
pass
rows.append(f"| {q} | {text} | {mark} | {ptr} |")
worst = max(worst, mark, key="ADKN".index)
seedmap.setdefault(m["seed"], []).append((eid, st, worst))
body += [f"### {eid} — {m['name']} · {m['seed']} · {st}", "",
f"{why} · helper section: {m['src'][0]} „{e['title'].strip()}”", "",
"| # | Answer | Mark | Pointer |", "|---|---|---|---|"] + rows + ["", f"**Hand step in a runbook?** {m['rb']}", ""]
out += ["## The seed kinds, and where each ending is", "", "| Seed kind | Endings (worst mark) | Named · mentioned · named nowhere |", "|---|---|---|"]
for seed in ("App", "Drive", "Copies", "Box", "Household", "Access", "Versions", "Outside"):
v = seedmap.get(seed, [])
c = {s: sum(1 for x in v if x[1] == s) for s in ("NAMED", "MENTIONED", "UNNAMED")}
out.append(f"| {seed} | " + ", ".join(f"{x[0]} ({x[2]})" for x in v) + f" | {c['NAMED']} · {c['MENTIONED']} · {c['UNNAMED']} |")
out += ["", "## Seed endings that no code path carries", "", "| Ending | Mark | Answer | Pointer |", "|---|---|---|---|"]
out += [f"| {a} | {b} | {c} | {d} |" for a, b, c, d in marks.NO_DOOR]
out += ["", "## Not in the table", "",
"**Tiny endings that cannot grow (named once, not tabled):** " + " · ".join(marks.TINY) + ".", "",
"**Left out for another reason:**", ""] + [f"- {a} — {b}." for a, b in marks.LEFT_OUT]
out += ["", "---", ""] + body
open(os.path.join(AUDIT, "TABLE.md"), "w", encoding="utf-8").write("\n".join(out).rstrip() + "\n")
print(f"endings {len(marks.M)} · dead pointers dropped {len(dropped)} · broken {len(bad)}")
for b in bad + dropped:
print(" " + b)
return 1 if bad else 0
sys.exit(main())