Files
Sylpheed/tools/port/check-authored-vs-declared
Sylpheed port agent 50be9578c5 recover: the F5/F6 port work from the deleted auto/port-p6-audio
A snapshot of the non-game files as of 0148cb8 ("port: F5/F6 hand-off --
one-minute human checks, and a refutation attempt that survived",
2026-09-04), the tip of auto/port-p6-audio. The branch was deleted from the
server on 2026-09-17 during the consolidation cleanup; issue #7 asks for
this work as a reviewable PR, so it is recovered here before the commits
are garbage collected.

Contents: the 84 files the branch changed relative to its fork point
b305aa4, which is this commit's parent. The tree is therefore 0148cb8's
tree with the 854 exported game assets left out -- export-probe/,
export-probe2/, three .wav renders of game audio and adv-v2-screenlog.tsv.
Game data stays out of git; the exporter regenerates those from the disc.
docs/port/DECISIONS.md still refers to them by name.

Not recovered: the branch's own 366 commits. Keeping them would make those
assets reachable again, so this is one snapshot instead. The original
commits stay unreferenced in the server's object store, and in this clone
under the local branch archive/port-p6-audio, until either is garbage
collected.

Refs #7. The OPTIONS work that issue #6 asks for is a subset of this
branch, also recovered as recover/options-menu.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 20:48:47 +02:00

108 lines
4.3 KiB
Python
Executable File

#!/usr/bin/env python3
"""Do the authored numbers that MIRROR declared data still match it?
tools/port/check-authored-vs-declared [--selftest]
🔴 WHY. The other agent reported that three of their corrections were a LABEL
being wrong rather than a measurement -- the right number pointed at the wrong
element -- and warned: *"if you are carrying any figure of mine that names an
element, that is the class to re-check first, not the arithmetic."*
An audit answered it once. This answers it every run.
📌 The port turned out to be protected, and NOT by discipline: every element-named
figure it carries is also declared on the disc, so each was independently
checkable and each checked out. That protection is worth making structural,
because it fails silently in both directions:
* a RELAYED number pointed at the wrong element drifts from the declared one;
* a RE-EXPORT that re-times a keyframe moves the declared one underneath an
authored value that was correct when written.
Both look like nothing. Neither is caught by `audit-kinds`, which checks that a
`why` cites something, not that the number still agrees with the disc.
⚠️ NAME THE RECORD, NOT JUST THE ELEMENT. An audit of these values was read by
the other agent as covering `ptbtn00f`'s peak alpha, and they reported it
undeclared -- because they looked at `ptbtn00.rat`'s LEAF, which declares
`ptbtn00.t32` at a flat `0:255`. The pulse is in a DIFFERENT record,
`ptbtn00f.rat`, reached through `focus_link`, and it declares
`0:0 6:6 29:74 35:80 50:80 58:74 97:6 105:0`. Both records carry a 120-unit
loop. Saying "declared" without saying *in which record* cost a round trip, so
this prints the record it compared against.
⚠️ SCOPE, deliberately narrow. Only values with a declared counterpart are
checkable here. A measured constant with no disc equivalent -- the leaf rate
itself, for instance -- cannot be verified this way and is not pretended to be.
"""
import json
import sys
EXPORT, AUTHORED = "export", "authored"
def screen(group, name):
return json.load(open(f"{EXPORT}/screens/{group}/{name}.json"))
def element(d, eid):
return next((e for e in d["elements"] if e["id"] == eid), None)
def checks():
"""(label, authored value, declared value) triples."""
out = []
timing = json.load(open(f"{AUTHORED}/timing.json"))
for key, cfg in timing.get("looping_focus_records", {}).items():
if key == "_":
continue
scr, parent = key.split("/", 1)
d = screen("title", scr)
el = element(d, parent)
if el is None:
out.append((f"looping_focus_records {key}: parent exists", parent, None))
continue
focus = el.get("focus", {})
got = [f["id"] for f in focus.get("elements", [])]
rec = focus.get("record", "?")
out.append((f"{key} record_element [{rec}]", cfg.get("record_element"),
got[0] if got else None))
out.append((f"{key} period_units [{rec}]", float(cfg.get("period_units", -1)),
float(focus.get("loop_length_units", -1))))
return out
def main():
if "--selftest" in sys.argv:
# 🔴 A CHECK THAT CANNOT FAIL IS NOT A CHECK. Compare a value against a
# deliberately wrong counterpart and require the mismatch to be seen.
ok_pass = _verdict([("x", 120.0, 120.0)]) == 0
ok_fail = _verdict([("x", 120.0, 244.0)]) == 1
print("selftest: match accepted=%s, mismatch rejected=%s -> %s"
% (ok_pass, ok_fail, "ok" if ok_pass and ok_fail else "🔴 BROKEN"))
return 0 if (ok_pass and ok_fail) else 2
rows = checks()
print("authored values with a DECLARED counterpart: %d" % len(rows))
return _verdict(rows, show=True)
def _verdict(rows, show=False):
bad = 0
for label, authored, declared in rows:
same = authored == declared
if show:
print(" %-46s authored %-12s declared %-12s %s"
% (label, authored, declared, "ok" if same else "🔴 DIFFERS"))
if not same:
bad += 1
if bad:
if show:
print("\n🔴 an authored number no longer matches the disc. Either it was "
"pointed at the wrong element, or a re-export re-timed it.")
return 1
return 0
if __name__ == "__main__":
raise SystemExit(main())