Files
felhom.eu/documentation/audits/space-list-2026-11-10/tools/check-pointers.py
T
admin 47e372a5f4
gates / gates (push) Successful in 1m58s
Space list (pilot of the gap review): 45 places, eight questions each
Read-only measurement on demo-hp, demo-felhom and Tester 1, two readings.
Audit folder documentation/audits/space-list-2026-11-10/ (README, TABLE,
MATRIX, evidence, tools). 360 answers: A 294, D 0, K 19, N 47.

Register 225 -> 230: R-1368 (host places that only grow: kernels, agent
binaries), R-1369 (no written way out of a full disk), R-1370 (no space
budget for the host disk), R-1371 (no space alarm; host-disk mail goes to
the household), R-1372 (small guest places). A dated line on nine existing
rows. Section headings set to the real counts; R-1268 and R-1312 moved to
their category's section.

STATUS: new Updated paragraph, decisions D67-D70. N100 diary line.
Two stale facts corrected in 05-hub-architecture.md and 11-os-updates.md.
Nothing was changed on any machine.

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-11-10 10:50:44 +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())