From e9a57e216761ccf1910b8b0edf41ecacc0dff97f Mon Sep 17 00:00:00 2001 From: Sylpheed port agent Date: Thu, 3 Sep 2026 20:25:33 +0000 Subject: [PATCH] port: a standing check that authored numbers still match the disc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Decoder reported that three of their corrections were a LABEL being wrong rather than a measurement -- the right number pointed at the wrong element -- and asked me to re-check any figure of theirs that names an element. Audited all five the port carries. All clean: ptloop01's 30-unit ramp, pteff03's 600-unit loop, ptbtn00f's 120-unit pulse and peak alpha 80, looping_focus_records' period and record_element, and F6's parent gate. šŸ“Œ And the reason is worth naming: the port was protected NOT by discipline but because every element-named figure it carries is ALSO declared on the disc, so each was independently checkable. That protection is now structural rather than a one-off audit, because it fails silently in both directions -- a relayed number pointed at the wrong element drifts from the declared one, and a re-export that re-times a keyframe moves the declared one underneath an authored value that was right when written. audit-kinds cannot see either: it checks that a why CITES something, not that the number still agrees. āš ļø Scope is deliberately narrow: only values with a declared counterpart are checkable. A measured constant with no disc equivalent -- the leaf rate itself -- cannot be verified this way and is not pretended to be. Selftest in both directions; in check-all. --- tools/port/check-all | 2 + tools/port/check-authored-vs-declared | 97 +++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100755 tools/port/check-authored-vs-declared diff --git a/tools/port/check-all b/tools/port/check-all index 2d6d8085..8a4155f7 100755 --- a/tools/port/check-all +++ b/tools/port/check-all @@ -156,6 +156,8 @@ step decisions-index must-pass tools/port/index-decisions --check # is merely on a peer's unmerged branch is reported, because the fix is a merge # and nobody in this container can make it. step trajectory-fit must-pass tools/port/fit-trajectory --selftest +step authored-declared must-pass tools/port/check-authored-vs-declared +step authored-decl-ctl must-pass tools/port/check-authored-vs-declared --selftest step doc-citations must-pass tools/port/check-citations step citations-control must-pass tools/port/check-citations --selftest # A refuted claim asserted outside its correction is a lie the corpus tells a diff --git a/tools/port/check-authored-vs-declared b/tools/port/check-authored-vs-declared new file mode 100755 index 00000000..0240bc27 --- /dev/null +++ b/tools/port/check-authored-vs-declared @@ -0,0 +1,97 @@ +#!/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. + +āš ļø 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", [])] + out.append((f"{key} record_element", cfg.get("record_element"), + got[0] if got else None)) + out.append((f"{key} period_units", 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())