Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 155 additions & 0 deletions research/selected-final-stage-portability/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Selected final stage: interpreter matrix and canonical-payload comparison

**Verifier engineering / portability receipt; no new kappa, no change to any
selected, pinned or frozen file.** Card `portable-replay` (priority revision 3,
chooser seed `e95bc9807d1d236e2d6d663b2945e09b`), refined to one stage and one
comparison; see [TASK.json](TASK.json). Base `0b1cccf8`.

## Question

The selected #1094 replay (`make frontier1094-verify`) has exactly one stage
after its #1042 baseline:
[`complex-t16-rare-pattern-exchanges/verify.py`](../complex-t16-rare-pattern-exchanges/verify.py),
which runs the frozen PR1087 strict verifier on Rohan Arun's owner exchanges.
Its README says "Python 3.12+", and the selected-replay CI pins 3.12. Does the
stage pass on other CPython versions, and is its output the same as the
reviewed run archived in
[`community-frontier1094-audit/selected-replay.tar.gz`](../community-frontier1094-audit/selected-replay.tar.gz)?
If the output differs, is the difference in proof-relevant content, or only in
container bytes, absolute paths and timings?

## Result

The stage was rerun from the committed #1042 `slots/local` (all ten files match
the #1042 receipt's hashes). It passed on all five interpreters and five
hash-seed settings, with kappa `0.001672660197076918` each time. Each rerun's
105 output files compare with the reviewed run as follows:

| Class | Files | What differs |
|---|---:|---|
| byte-identical | 102 | nothing: all 22 `.gz` files (gzip containers included), 69 of the 72 `.json` files and all 11 inner stage logs |
| `json-relocated` | 1 | `INDEPENDENT-T16.json`: only the absolute paths used as keys of `input_sha256`; all six input digests agree |
| volatile | 2 | `REPLAY.json`, `STAGES.json`: only the 11 per-stage `seconds` values; every `log_sha256` agrees |

| Interpreter (macOS 26.6.2 arm64, uv-managed CPython) | `PYTHONHASHSEED` | Stage wall time | Classification |
|---|---|---:|---|
| 3.10.21 | random | 19.7 s | 102 / 1 / 2 |
| 3.11.16 | random | 17.5 s | 102 / 1 / 2 |
| 3.12.14 | random, 0, 1, 4242 | 16.6 s | 102 / 1 / 2 (all four) |
| 3.13.15 | random | 17.5 s | 102 / 1 / 2 |
| 3.14.7 | random, 0, 987654321 | 14.6 s | 102 / 1 / 2 (all three) |

In particular, every rerun's `strict/ASSEMBLY.json` is byte-identical to
`community-frontier1094-audit/ASSEMBLY.json` (`1122cb3a…`). That file is the
certificate the selected record pins at base `0b1cccf8`. PR1735 points out that
`make frontier1094-verify` binds that certificate to the replay only through
kappa. This rerun closes the gap for the final stage, by bytes, on every
interpreter tested. `verify.py` checks it explicitly.

So the final stage is deterministic and portable across CPython 3.10–3.14 on
this platform, down to compressed bytes. "Python 3.12+" in the stage README is
conservative. The real floor is `tarfile.extractall(filter='data')`, which
needs 3.10.12+, 3.11.4+ or 3.12+.

**One receipt field cannot be reproduced.** The outer stage log
`rare-pattern-exchanges.log` prints per-stage wall-clock seconds, so the #1094
receipt's `log_sha256` for that stage (`80362b2c…`) cannot match any rerun. The
cold replay never compares against it, so this does not break replay. A reviewer
comparing two #1094 receipts should still expect that field to differ. The inner
`log_sha256` values in `candidate/strict/STAGES.json` do not contain timings, and
they are reproduced exactly. The verifier here compares the outer log only after
removing the trailing seconds field from each `PASS <stage> <seconds>` line.

## What the verifier checks

[`verify.py`](verify.py) runs in about 20 s using only the standard library:

1. It extracts `slots/local` from the #1042 archive and requires exactly the ten
files bound in the #1042 `RESULT.json`, with matching hashes.
2. It extracts the reviewed output from the #1094 archive. It binds that output
to the committed #1094 `RESULT.json`, `STAGES.json`, `REPLAY.json` and
`assembly_sha256`. It also checks that the #1094 receipt names the committed
#1042 receipt and the stage script's current hash.
3. It reruns the stage with the active interpreter in a fresh directory, then
compares the result with [`compare_payloads.py`](compare_payloads.py), which
works file by file, by bytes and by canonical payload. It requires the exact
classification above.
4. It runs negative controls on copies of the rerun:
- Each of these must be flagged `proof-relevant-candidate`:
- a changed proof value (`live` in `INDEPENDENT-T16.json`);
- a changed kappa in `REPLAY.json`, which also differs in volatile seconds;
- a changed inner `log_sha256` in `STAGES.json`;
- a changed gzip payload;
- an input path outside the mapped roots.
- A missing file must be reported `missing`.
- A gzip file re-compressed at a different level and mtime must be accepted
as `gzip-container`.

`compare_payloads.py` can be reused on its own:

```sh
python3 research/selected-final-stage-portability/compare_payloads.py REF_DIR RUN_DIR \
--ref-root '<WORK>=/abs/ref/work' --run-root '<WORK>=/abs/run/work' --out report.json
```

A JSON difference counts as `volatile` only when every differing leaf sits under
a key in `VOLATILE_KEYS` (only `seconds` by default; `--volatile-key` adds more,
for example `log_sha256` when logs print timings). Every other difference is
reported as `proof-relevant-candidate` for a person to inspect. It does not
decide which fields are proof-relevant; it lists the paths that differ.

## Reproduce

```sh
python3 scripts/research_package.py --package research/selected-final-stage-portability --check-only
python3.12 scripts/research_package.py --package research/selected-final-stage-portability
# matrix:
for v in 3.10 3.11 3.12 3.13 3.14; do python$v -B research/selected-final-stage-portability/verify.py; done
```

## Not checked

- **Earlier stages.** The cold #1042 and #799 baselines were not rebuilt; the
stage input is the hash-bound archived `slots/local`. The 711 s `chain` stage
and the native steps are outside this scope.
- **Other platforms.** Linux, Windows and non-uv builds of CPython were not
run. The reviewed run's `/private/tmp` paths suggest it ran on macOS too, so
this is not a cross-OS result.
- **Transitive inputs.** The stage reads files from `--main` (the repository)
that are bound by the PR1087 verifier's own pins. `VERIFY.json` declares the
stage script, its manifest and the receipts/archives, not every transitive
file.
- **Mathematics.** This does not check the mathematics of the stage or of its
inherited assumptions, and it does not replace the selected cold replay.

## Open next questions

1. **Does the same byte-level agreement hold on Linux (CI's Ubuntu 3.12) and on
Windows?** *Why it matters:* if it holds, a cross-OS reviewer could compare
receipts directly instead of rerunning the stage. *First step:* run
`verify.py` on Ubuntu 3.12. *Blocked by:* no Linux host in this session.
2. **Can the #1094 receipt drop or annotate its non-reproducible outer
`log_sha256`?** *Why it matters:* it would make two runs' receipts directly
comparable. *First step:* a maintainer decision. This package changes no
selected script. *Blocked by:* any edit to `scripts/verify_frontier1094.py`
touches the selected reproduction path.
3. **Do the same classes hold for the #1042 stages?** *Why it matters:* the
#1042 receipt binds 457 artifact hashes, so byte determinism there would let
reuse mode be checked across machines. *First step:* run
`compare_payloads.py` on a cold `verify_frontier1042.py` run against
`community-frontier1042-audit/selected-replay.tar.gz`. *Blocked by:* a cold
run takes about 20 minutes plus the #799 baseline.

## Credit

The stage under test is Rohan Arun's #1094 (`complex-t16-rare-pattern-exchanges`)
on Jeremy Kothe's PR1087 strict verifier and the credited PR1018/1005/869/799/741
lineage. Douglas Colkitt wrote the selected replay driver and the receipts that
the reviewed archives come from. The gzip-container convention follows Maxime
Fleury's [reproducibility audit](../gzip-container-reproducibility/README.md),
which built on Antoine Olivier's replay findings. Related audits, which this
package does not repeat: [ancestry binding, seed 69](../frontier1094-ancestry-binding-seed69/README.md)
and PR1735 (certificate-to-replay binding).

Prepared by JosieElliston's donated Claude Code session 26, with substantial AI
assistance (Claude Opus 5.5), self-reviewed only. Apache-2.0.
72 changes: 72 additions & 0 deletions research/selected-final-stage-portability/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"schema_version": 1,
"base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea",
"files": [
{
"path": "certificates/selected-result.json",
"usage": "provenance",
"git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11",
"sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32"
},
{
"path": "docs/research/agent-task-catalog.json",
"usage": "provenance",
"git_blob": "06c96f5579bb67ed1b86d334e78fbed7da6945f1",
"sha256": "6686ad58f1fbdbc87134a78901b60fd53a20d3984355e91defbbebc9e9fa8075"
},
{
"path": "research/community-frontier1042-audit/RESULT.json",
"usage": "input",
"git_blob": "8182d0818c0cbda7e52c10120f15b2c3a2c8f933",
"sha256": "bf12c6ed3b412539638b76addb40591a631609b2ab9e5ee0db1f6bbe067d0ec0"
},
{
"path": "research/community-frontier1042-audit/selected-replay.tar.gz",
"usage": "input",
"git_blob": "6f4dc6fe7631d8aacf8081fcaecf32197181685b",
"sha256": "22c3f4dce4b897a1d423d1388801933e288b6a6b1906cb15e1b16a5eb68db754"
},
{
"path": "research/community-frontier1094-audit/ASSEMBLY.json",
"usage": "input",
"git_blob": "5fd676df060f3b450782fdf5ff5f6beb63a5eeb0",
"sha256": "1122cb3a575f8c788345fc1bf4c108ac7c3250fb81a5988671f5eb04b3ab3045"
},
{
"path": "research/community-frontier1094-audit/REPLAY.json",
"usage": "input",
"git_blob": "2cfb7fffa7cd78f418be16c13224c3206b6d0183",
"sha256": "ce0678fa7abaab221de74baeace0c6696d5ea23a36719a58cff230215a06aae7"
},
{
"path": "research/community-frontier1094-audit/RESULT.json",
"usage": "input",
"git_blob": "131d9c96a54632ae385ced4138fd7f30ad448a3e",
"sha256": "1e3e47e9ec24bcb6fb5f703b7fce0aab658d84ff72bfae5da3ae429d17b6e752"
},
{
"path": "research/community-frontier1094-audit/STAGES.json",
"usage": "input",
"git_blob": "a92499421609e4cdb5630f2697d2bad4b5a42a83",
"sha256": "72ad3ba266488da6bb6a41be404700dcea183a85002a5428df0033685c56d8be"
},
{
"path": "research/community-frontier1094-audit/selected-replay.tar.gz",
"usage": "input",
"git_blob": "c24daf067f9c543421d89ca2eeaa4eb78a57fb6f",
"sha256": "f1da80610bf33c58527f18ad63b4350d0b864e1d4486141ee17ac9bed4d529d6"
},
{
"path": "research/complex-t16-rare-pattern-exchanges/MANIFEST.json",
"usage": "input",
"git_blob": "3216666bd231516f8d2387e3096d6a5bd413b519",
"sha256": "16a964621e718c8da4c859ccbb280c3c00816ca72874e955910fdf0ef27a0adc"
},
{
"path": "research/complex-t16-rare-pattern-exchanges/verify.py",
"usage": "input",
"git_blob": "9d471cf90835bc91d32bb0216c2bb867011a7420",
"sha256": "b8c2f76b305c5c9ceb42df203deef564857d17f1f8182d0745dda9ab96e3d4de"
}
]
}
72 changes: 72 additions & 0 deletions research/selected-final-stage-portability/TASK.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"schema_version": 1,
"task_id": "portable-replay",
"priority_revision": 3,
"base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea",
"original_card": {
"id": "portable-replay",
"question": "Can one reproducible environment or artifact-comparison failure be repaired?",
"starting_points": [
"research/gzip-container-reproducibility/README.md",
"docs/ci-verification.md"
],
"methods": [
"Reproduce one portability failure and add a minimal cross-environment fix.",
"Audit one canonical-payload comparison for omitted proof-relevant fields."
],
"acceptance_gate": "Preserve immutable source hashes and proof-relevant content; a different compressed byte stream alone is not a mathematical mismatch.",
"first_step": {
"command": [
"python3",
"-B",
"scripts/research_baseline.py"
],
"expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY",
"inspect": "Read the gzip-container reproducibility examples and distinguish frozen source bytes from regenerated payloads.",
"scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay."
},
"first_experiment": "Reproduce one specific mismatch or audit one canonical comparison for omitted proof-relevant fields.",
"bottleneck_link": "Portable exact checks prevent environment failures from blocking valid contributions.",
"allowed_variations": [
"One interpreter/version mismatch or one payload field comparison."
],
"scope_change_triggers": [
"Removing immutable-source pins because generated compressed bytes differ."
],
"overlap_terms": [
"gzip container",
"reproducibility",
"canonical payload"
]
},
"scope_status": "refined",
"actual_scope": "Interpreter matrix (CPython 3.10-3.14, five PYTHONHASHSEED settings, macOS arm64) for the selected #1094 record's only post-#1042 stage, research/complex-t16-rare-pattern-exchanges/verify.py, run from the hash-bound archived #1042 slots/local, with a file-by-file byte and canonical-payload comparison against the reviewed run archived in research/community-frontier1094-audit/selected-replay.tar.gz.",
"scope_change_reason": "The card asks for one portability failure or one canonical-payload comparison; this picks the selected record's final stage as the object and checks whether any interpreter or hash seed changes its output payload, and which receipt fields are inherently non-reproducible. No failure was found to repair, so the result is a portability receipt plus a reusable comparison tool rather than a fix.",
"bottleneck_link": "Side result for review throughput: shows a reviewer can rerun the selected final stage on any CPython 3.10-3.14 and expect byte-identical artifacts apart from one relocated path map and timings, and identifies the one #1094 receipt hash (outer stage log) that no rerun can reproduce.",
"budget_minutes": 60,
"stop_rule": "One stage, one platform, five interpreters; no cold #1042/#799 rebuild and no edit to selected or frozen scripts.",
"outcome": "completed",
"evidence": "All 5 interpreters and 5 hash-seed runs pass with kappa 0.001672660197076918; of 105 outputs, 102 are byte-identical to the reviewed run (all 22 .gz, all 11 inner logs), INDEPENDENT-T16.json is equal after relocating absolute path keys, REPLAY.json/STAGES.json differ only in 11 'seconds' values. verify.py reruns the stage (~20 s) and checks this classification plus seven negative controls.",
"author": "JosieElliston (donated Claude Code session 26, Claude Opus 5.5)",
"ai_assistance": "Claude Code (Claude Opus 5.5) wrote the scripts and text in JosieElliston's donated session 26; self-reviewed only, no independent AI or human review.",
"open_questions": [
{
"question": "Does the same byte-level agreement hold on Linux (Ubuntu CI, Python 3.12) and Windows?",
"why_it_matters": "Then a cross-OS reviewer could compare receipts directly instead of rerunning.",
"first_step": "Run verify.py on Ubuntu with Python 3.12.",
"blocked_by": "No Linux host in this session."
},
{
"question": "Should the #1094 receipt drop or annotate its non-reproducible outer log_sha256 (the stage log prints wall-clock seconds)?",
"why_it_matters": "Makes two runs' receipts directly comparable.",
"first_step": "Maintainer decision; this package changes no selected script.",
"blocked_by": "Any edit to scripts/verify_frontier1094.py touches the selected reproduction path."
},
{
"question": "Do the #1042 stages' 457 bound artifacts reproduce byte for byte across interpreters?",
"why_it_matters": "Would let reuse mode be checked against the published receipt on another machine.",
"first_step": "Run compare_payloads.py on a cold verify_frontier1042.py run against community-frontier1042-audit/selected-replay.tar.gz.",
"blocked_by": "A cold run takes about 20 minutes plus the #799 baseline."
}
]
}
28 changes: 28 additions & 0 deletions research/selected-final-stage-portability/VERIFY.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"schema_version": 1,
"status": "ready",
"python": "3.12",
"requirements": [],
"inputs": [
"research/community-frontier1042-audit/RESULT.json",
"research/community-frontier1042-audit/selected-replay.tar.gz",
"research/community-frontier1094-audit/ASSEMBLY.json",
"research/community-frontier1094-audit/REPLAY.json",
"research/community-frontier1094-audit/RESULT.json",
"research/community-frontier1094-audit/STAGES.json",
"research/community-frontier1094-audit/selected-replay.tar.gz",
"research/complex-t16-rare-pattern-exchanges/MANIFEST.json",
"research/complex-t16-rare-pattern-exchanges/verify.py"
],
"commands": [
{
"argv": [
"{python}",
"-B",
"{package}/verify.py"
],
"timeout_seconds": 300,
"checks": "Binds slots/local to the #1042 receipt and the archived reviewed output to the #1094 receipts; reruns the final stage; requires the rerun ASSEMBLY.json to equal the committed #1094 certificate bytes and 102 byte-identical, 1 json-relocated and 2 seconds-only files; seven negative controls (proof value, kappa, inner log digest, gzip payload, unmapped path flagged; missing file reported; re-compressed gzip accepted)."
}
]
}
Loading
Loading