From 7ebb8b3704a50a376b6cb64c879fa0dd2bb74ed7 Mon Sep 17 00:00:00 2001 From: Dylan Roy Date: Wed, 23 Sep 2026 22:11:51 +0000 Subject: [PATCH] Give the hardening lane its bytes back, and make the binding visible here MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `research/bands/ladder.py` is pinned by SHA-256 as a source identity of two certificates on `chatgpt/drive-github-hardening-20260919`: `research/parallel/h3/candidate.json` and `research/rn/candidates/inner_wedge_20260920_v1.json`. Their `tools/twelve_project_check.py` fails closed on a mismatch. Nothing in this repository said so. Commit 4cc0f7a added a NON-CERTIFYING docstring to `AdjacentBand.label` and two literal lines to `format_report`, moving the file from 9ea57670…/26286 B to 14d1eeb3…/26721 B, and broke a binding no checker here could see. The damage was invisible on either branch alone and surfaced only on a merge: 58 failures and 4 errors, 19 of them cascading from that one line, against 3,273 passing. An AST diff over both revisions, docstrings stripped, shows the only non-docstring change in the file was two `out.append()` calls in `format_report`. No expression, constant, bound or return value moved. So the cheapest correct fix is to stop changing the file, not to ask the other lane to re-pin a provenance binding over a labelling edit. The bytes are restored exactly. The label moves to `DECLARED` in `tools/noncertifying_check.py`, which is the mechanism that exists for a float site whose reason is recorded outside the file, and the reason recorded there is more informative than the docstring was: it names both pinning files and says why the label cannot live in the source. `tests/test_noncertifying.py` gains the control that would have caught this: the file's digest and byte count are asserted against the pinned values, with a failure message saying that re-pinning both JSON files on the hardening lane is the remedy and that editing the constant here is not -- the constant is not the authority, their pins are. A mutation control proves one appended byte fails it. This establishes no mathematics. A byte pin is identity, not correctness: it says these are the bytes those certificates were produced against, and nothing about whether the certificates hold. No claim, premise, obligation or gate moved; `OBL-H5-JETMOD` stays OPEN and the rung ladder is untouched. 21/21 checkers pass; 1,927 passed, 1 skipped. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01Cz7WZybv8znP64SpPj6sWY --- research/bands/ladder.py | 10 +------ tests/test_noncertifying.py | 55 ++++++++++++++++++++++++++++++++++-- tools/noncertifying_check.py | 14 +++++++++ 3 files changed, 67 insertions(+), 12 deletions(-) diff --git a/research/bands/ladder.py b/research/bands/ladder.py index ab20ad7a8..ee3c100da 100644 --- a/research/bands/ladder.py +++ b/research/bands/ladder.py @@ -258,13 +258,7 @@ def name(self) -> str: @property def label(self) -> str: - """A decimal rendering for reading. The exact endpoints are ``name``. - - NON-CERTIFYING. This is the only float path on the band object: the - endpoints are exact rationals and `name` prints them as such. A decimal - rendering is for a human reading a report, and no bound may be taken - from it. - """ + """A decimal rendering for reading. The exact endpoints are ``name``.""" return f"[{float(self.r_lo):.6f}, {float(self.r_hi):.6f}]" @property @@ -556,8 +550,6 @@ def format_report(kappa: F = DISPLAYED_KAPPA, prec: int = 40, out: List[str] = [] out.append("H5 rung ladder -- published point certifications (line: %s)" % line) out.append("=" * 72) - out.append("Every decimal below is a NON-CERTIFYING display of an exact value;") - out.append("the returned objects carry the exact rationals. Read those for a bound.") for p in points_for_line(line): dg = p.totals_digest[:16] + "..." if p.totals_digest else "(no digest quoted)" out.append(f" r = {float(p.r):<10.6f} I_hi/r^3 = {float(p.value):<12.4f}" diff --git a/tests/test_noncertifying.py b/tests/test_noncertifying.py index 031b91e03..3038acacd 100644 --- a/tests/test_noncertifying.py +++ b/tests/test_noncertifying.py @@ -11,6 +11,7 @@ """ from __future__ import annotations +import hashlib import os import subprocess import sys @@ -187,12 +188,60 @@ def test_the_repository_passes_and_actually_found_float_sites(): def test_the_known_float_bearing_modules_are_labelled_or_declared(): - """The eight that were unlabelled when the checker landed.""" - for rel in ("research/bands/ladder.py", "research/rn/moment_envelope.py", + """The eight that were unlabelled when the checker landed. + + ``research/bands/ladder.py`` was labelled in-file until the pin + reconciliation below moved it into ``DECLARED``; see that test for why. + """ + for rel in ("research/rn/moment_envelope.py", "tests/test_rn_moment_envelope.py"): with open(os.path.join(ROOT, rel), encoding="utf-8") as f: assert NCC.LABEL in f.read(), rel for rel in ("tools/registers_import.py", "tools/drive_index.py", "tests/test_bridge.py", "tests/test_hermite_envelope.py", - "tests/test_lpw_headline.py"): + "tests/test_lpw_headline.py", "research/bands/ladder.py"): assert rel in NCC.DECLARED, rel + + +#: The bytes two certificates on the ``chatgpt/drive-github-hardening-20260919`` +#: lane bind as a source identity. Recorded here so an edit to the file fails +#: loudly in this repository rather than silently in theirs. +LADDER_PINNED_SHA256 = \ + "9ea576708e146aa54fdc3c6859274d2c35a81218438bcdb34283afe9f79ac0c5" +LADDER_PINNED_BYTES = 26286 + + +def test_ladder_py_still_matches_the_digest_two_certificates_pin(): + """A cross-lane byte binding, made visible from inside this repository. + + ``research/parallel/h3/candidate.json`` and + ``research/rn/candidates/inner_wedge_20260920_v1.json`` on the hardening + lane record this file's SHA-256 as a source identity of their certificates, + and ``tools/twelve_project_check.py`` there fails closed on a mismatch. + Nothing in *this* repository said so, so commit ``4cc0f7a`` added a + NON-CERTIFYING docstring and two ``format_report`` lines, changed the bytes, + and broke a binding no checker here could see -- 19 failures in a merged + tree, none of them reproducible on either branch alone. + + The label now lives in ``NCC.DECLARED`` instead and the bytes are back. + This control is the part that keeps it that way: it is a repository-side + record of somebody else's dependency. + + If this fails, the file was edited. That is not forbidden -- but it + invalidates two certificates' provenance, so re-pin both JSON files on the + hardening lane in the same change, or revert the edit. Do not simply + update the constant here; the constant is not the authority, their pins are. + """ + path = os.path.join(ROOT, "research", "bands", "ladder.py") + raw = open(path, "rb").read() + assert len(raw) == LADDER_PINNED_BYTES, ( + f"{len(raw)} bytes, pinned at {LADDER_PINNED_BYTES}") + assert hashlib.sha256(raw).hexdigest() == LADDER_PINNED_SHA256 + + +def test_negative_control_a_changed_ladder_is_caught(): + """Flipping one byte must fail the pin, or the control above is decoration.""" + raw = open(os.path.join(ROOT, "research", "bands", "ladder.py"), "rb").read() + mutated = raw + b"\n" + assert hashlib.sha256(mutated).hexdigest() != LADDER_PINNED_SHA256 + assert len(mutated) != LADDER_PINNED_BYTES diff --git a/tools/noncertifying_check.py b/tools/noncertifying_check.py index 615a32d58..37da3cd4e 100644 --- a/tools/noncertifying_check.py +++ b/tools/noncertifying_check.py @@ -79,6 +79,20 @@ "tests/test_lpw_headline.py": "one `parse_decimal(6.239e-44)`, a negative control asserting a float " "literal is refused where an exact decimal string is required.", + "research/bands/ladder.py": + "`AdjacentBand.label` renders the exact endpoints as decimals for a " + "human reading a report, and `format_report` prints them; the endpoints " + "themselves are exact rationals and `name` prints them as such, so no " + "bound passes through either. DECLARED here rather than labelled in the " + "file because these bytes are content-pinned: " + "`research/parallel/h3/candidate.json` and " + "`research/rn/candidates/inner_wedge_20260920_v1.json` on the " + "`chatgpt/drive-github-hardening-20260919` lane bind this file by " + "SHA-256 (`9ea57670…`, 26286 bytes) as a source identity of their " + "certificates. An in-file label changes those bytes and breaks the " + "binding, and re-pinning is a judgement about their certificates' " + "provenance rather than ours to make. The label therefore lives here, " + "where it costs them nothing.", }