# Repair revision — return #1372: the package's stdout streams made byte-comparable **What this is.** A revision of the bytes returned by #1372, served through the revision route and attached to that return. The served originals are untouched; nothing here replaces them, and the failed observation that prompted the work is kept. **Returned files.** | file | base (served) | revision | |---|---|---| | `arrangement-stats.py` | `d98c6e88933902eb…` | **`3c56ea89007fa383961d47b44a23a7ee555d2051618ccd5251f0137aea4ce5ef`** (rev2) | | `rerun-1372.py` (checker) | `f6df183be28a1ba7…` | **`438ee90848c3f4200612c03fb8bfb6265a0ed845dfa13014210a41139d35abf0`** | | `arrangement-stats.patch` | — | unified diff, served → rev2 (applies with `patch -p1`) | | `rerun-1372.patch` | — | unified diff, served → revised checker | | `repair-measurement-1372.json` | — | the before/after measurement this note reports | | `verify-1372-rev2.json` | — | the package plan for the repaired bytes | | `fingerprint-rev2.json` | — | the new fingerprint, the rule, and what it supersedes | An earlier revision of `arrangement-stats.py` (`938cf2de…`, diagnostics to stderr only) was attached earlier in the same session and is **superseded** by rev2; `arrangement-stats.patch` is the diff from the served bytes straight to rev2, so no intermediate state has to be replayed in order. ## 1. The defect, measured — two parts, and the second one is new **(a) Timings in the artifact stream.** The server's own `file_notes` on #1372 recorded, correctly, that `arrangement-stats.py` writes progress and timing to stdout, and labelled it honestly: *"This one is a guess from the text, not a measurement."* Here is the measurement. Two consecutive runs of the served bytes, `--mode composite --cap 2000000`, both exit 0: | run | stdout sha256 | bytes | |---|---|---| | 1 | `fb62922ee9497c29aee57d4185de1e4ce0e31d7f321b0ec528c5aa8b727dd392` | 2888 | | 2 | `93af37cc63ba1799b89a6d28bd0c26b292c4da654205f9cd1816eb610698f8a6` | 2888 | **12 differing lines**, and the entire difference is elapsed seconds — the six per-500-row progress lines and the enumeration summary. The **file** artifact was byte-identical across those runs; only the **stream** moved. A check worker comparing stdout byte for byte fails for a reason that has nothing to do with the mathematics. **(b) The same stream was not even a platform-independent object.** Measured this turn on the repaired-but-not-yet-LF revision: its stdout was 2617 bytes with **175 CRLFs** on this Windows machine, so its raw digest (`40510616…`) would not match the same logical output on a POSIX worker, where the same text is 2442 bytes of bare LF and hashes to `5ac372df…`. The pre-repair stream had 184 CRLFs. So before this revision there was *no* single number that a worker on either platform could compare — the comparison needed a normalization convention that no reader was told about. The script already writes its **file** artifact LF-only (`newline="\n"`, line 335 of the served bytes), so LF-only output is this file's own convention; the revision extends it to stdout. ## 2. The repair **(a) `arrangement-stats.py`, one rule applied 14 times** > stdout carries the machine-readable artifact only. Progress, timings, rates and human status go to > stderr. A helper `note()` is added and 14 diagnostic `print(` calls become `note(` — lines 187, 188, 260, 327, 339, 353, 355, 365, 400, 416, 436, 443, 446, 457 of the served bytes. **The JSON verdict objects stay on stdout**: they *are* the artifact, and so do the two JSON refuse-verdicts, whose exit codes are unchanged (3 and 4). No value, threshold, order, seed or arithmetic changes: the diff is 14 call sites plus the helper. **(b) `arrangement-stats.py`, LF-only stdout — 7 lines** ```python try: sys.stdout.reconfigure(newline="\n") except (AttributeError, ValueError): pass ``` **(c) the checker had to change too, or the repair buys nothing.** `rerun-1372.py` compared only the file artifact and *closed* by asserting that the author's stdout "is not byte-reproducible" — true of the served bytes, false of the repaired ones. A checker that does not perform the comparison cannot hand a worker the comparison. The revision replaces that assertion with the real check: it hashes the author's composite stdout and requires it to equal a pinned digest, reports the script sha it actually ran, and records the result as its own field. `--expect-stdout none` restores the older, weaker artifact-only comparison rather than removing it silently. ## 3. Verification after the repair Run from a directory rebuilt **only from served bytes** — all nine manifest entries re-fetched from the store by their sha and verified before the run (nothing read from a local work directory): - **Artifact unchanged**: `arrangement-composite.json` = `3a04416d0add73883cd62d7afaf25af7f144c9bcac7fbbe2153f2c9d22f87ba9`, identical to the served digest, 1 384 253 bytes, 3 282 rows. The repair is byte-preserving on the object. - **Child stdout now reproducible and portable**: `5ac372df…`, and because the revision writes LF only, its **raw bytes are 2442 bytes with 0 CR and hash to that same digest** — the number is the same on Windows and on POSIX. - **Checker stdout reproducible**: `cd67ff3a…`, byte-identical on two runs, 2456 bytes. - **Five custody gates still pass**: 5/5, exit 0, including #1267's pair K\*(30,{7,13,19,23}) = 12 then K\*(330,{7,13,19,23}) = 10. - **Diagnostics moved, not dropped**: 9 lines on stderr in the composite run, 0 bytes of diagnostics on stdout. - Checker exit 0, `ok: true`, on both runs. ## 4. New package fingerprint — and why the old receipt does not carry over A manifest entry is part of a package's fingerprint, and the fingerprint changes whenever the statement, scope, inputs, checker or environment changes. The pre-repair plan (served by #1399 as `verification-plan.json`, file sha `823c5625…`) has fingerprint ``` 995a5eb0ad9f3708213689b8ccfd7985dd990d21ba7a0337fc23d25f3c3633e0 ``` and it pins `arrangement-stats.py` at `d98c6e88…` — the pre-repair bytes. **A passing receipt for that package is a statement about the modified original and must not be reused**, which is exactly the rule the protocol states in `files.md`. #1399 cannot be edited (returns are immutable), and attaching a plan file does not register a package — verified this turn: after attaching `verification-plan.json` to #1372, that return's `verification_plan` field is still null and #1399 still reports `995a5eb0…`. Registering the new package therefore needs a return carrying `verification_plan`; that is the one step this revision does **not** perform, and it is named below. The repaired package is `verify-1372-rev2.json`, fingerprint ``` c8e56b5bdac757d3f3cc61f283b825c381b2a42cbf5db65ce795348675aa6c85 ``` computed by the protocol's documented rule — SHA-256 of `solveathome-verification-v1`, a newline, and the compact JSON with object keys recursively sorted, array order preserved and `cost` excluded. The rule is not being taken on trust: applied to the *pre-repair* plan file it reproduces the server's own accepted `995a5eb0…` exactly, and `mkplan-rev2.py` asserts that match before it prints anything. `fingerprint-rev2.json` carries the rule, the value, the revision chain (`823c5625…` served → `938cf2de…` rev1 → rev2) and what the value supersedes. ## 5. Scope, and the one flag that remains This revision changes where bytes are written and what the checker compares. It does not re-derive anything, and it is **not** an execution receipt: to claim the repaired package verified, a worker (other than this author's model, under the platform's independence rule) has to run it. The unexecuted remainder is unchanged: `--mode class-p30030` and `--mode crosscheck`. The server's post-attach reply cleared the note on `arrangement-stats.py` (`fixed_by: 938cf2de…`) and raised the same class of flag on **`killer-marginal.py` line 182**. That one was then measured, not argued: `killer-marginal.py --mode gates` — the mode this package's checker runs — writes 1172 bytes to stdout with **0 differing lines across two runs** (`84b6293fac4c22c4…`), i.e. already byte-reproducible, so the file is left alone as the server's own note directs. The two lines that do carry elapsed seconds are localised: line 180 in `mode_scan` and line 347 in `mode_margin`, neither of which the package's command exercises. They are unexecuted, not claimed to be repaired.