Files
felhom.eu/documentation/audits/endings-list-2026-11-10/tools/check-pointers.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

79 lines
3.0 KiB
Python

#!/usr/bin/env python3
"""Print the text behind every pointer in a table file, so a person can read it.
Read-only by construction: it opens files for reading and prints. It runs on DooPlex against the
git clones only; it never touches a box.
Usage: check-pointers.py [FILE ...] (default: ../TABLE.md)
check-pointers.py --quiet [FILE] (only the verdict lines; rc 1 when a pointer is dead)
A pointer is a backticked token `PREFIX/path[:line[-line]]` with one of the prefixes below.
A pointer is DEAD when the file is missing or the line range lies beyond the end of the file.
The script cannot judge whether the line says what the table claims — that is the reader's job.
"""
import os
import re
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
AUDIT = os.path.dirname(HERE)
REPO = os.path.abspath(os.path.join(AUDIT, "..", "..", "..")) # felhom.eu
WORKSPACE = os.path.dirname(REPO)
PREFIX = {
"AG": os.path.join(WORKSPACE, "felhom-agent"),
"CT": os.path.join(WORKSPACE, "felhom-controller", "controller"),
"CAT": os.path.join(WORKSPACE, "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"),
}
TOKEN = re.compile(r"`((?:%s)/[^`:\s]+)(?::(\d+)(?:-(\d+))?)?`" % "|".join(PREFIX))
def main() -> int:
args = [a for a in sys.argv[1:] if a != "--quiet"]
quiet = "--quiet" in sys.argv[1:]
files = args or [os.path.join(AUDIT, "TABLE.md")]
seen, dead, total = set(), 0, 0
for table in files:
with open(table, encoding="utf-8") as fh:
text = fh.read()
for m in TOKEN.finditer(text):
key = m.group(0)
if key in seen:
continue
seen.add(key)
total += 1
pre, rest = m.group(1).split("/", 1)
path = os.path.join(PREFIX[pre], rest)
first = int(m.group(2)) if m.group(2) else None
last = int(m.group(3)) if m.group(3) else first
if not os.path.exists(path):
dead += 1
print(f"DEAD {key} (no such file: {path})")
continue
if first is None:
if not quiet:
print(f"OK {key} (file exists)")
continue
with open(path, encoding="utf-8", errors="replace") as fh:
lines = fh.readlines()
if last > len(lines):
dead += 1
print(f"DEAD {key} (file has {len(lines)} lines)")
continue
if quiet:
continue
print(f"OK {key}")
for n in range(first, min(last, first + 11) + 1):
print(f" {n:>5} {lines[n - 1].rstrip()[:200]}")
print(f"pointers: {total} dead: {dead}")
return 1 if dead else 0
if __name__ == "__main__":
sys.exit(main())