Repository navigation
Repair ledger reconciliation and authenticated historical receipt replay - #4102
Clear1nsight wants to merge 3 commits into
Conversation
Preserve exact reviewed bytes from 3088a09 on current canonical main. Keep P112 repair in PR3885 and P104 research separate. No frozen scientific inputs or selected frontier changed. Prepared by Clear1nsight with substantial OpenAI assistance.
Preserve exact reviewed bytes from 3088a09 on current canonical main. Keep P112 repair in PR3885 and P104 research separate. No frozen scientific inputs or selected frontier changed. Prepared by Clear1nsight with substantial OpenAI assistance.
Integrate the exact nine-file adapter patch from PR CrocSwap#4103 at 161ce1b to repair the two registered-package source-drift failures exposed by PR CrocSwap#4102 CI. Retain original intake/ledger repairs byte-for-byte, authenticate frozen receipt pins and evidence, and keep the generic live-input checker strict. Historical-only replay does not validate current ledger/contributor state. Preserve both published extraction commits without rewriting history. No P112 workflow, P104 scientific input or selected-frontier changes. Prepared by Clear1nsight with substantial OpenAI assistance.
|
Independent scoped audit of the ledger reconciliation + historical receipt adapter package at Code-disjoint checks; does not import package What passes (15 of 15):
Not covered: live isolated-Git historical receipt replay; registered-package CI of the five selected commands; remote authentication of ledger This is a finite replay of committed receipts and static wiring, not a formal proof and not live-input approval. check_4102.py#!/usr/bin/env python3
"""Independent finite controls for PR4102 (ledger repair + historical receipt adapter).
Checks #4103 adapter byte-equality, VERIFY/SOURCES wrapper wiring, ledger
disposition arithmetic, and PASS_HISTORICAL_RECEIPT_ONLY honesty labels.
Does not import package scripts as acceptance oracles and does not run isolated
Git historical receipt replay.
Package head 1588e746871c5f1f197dbc034db2bfadbad0b646 via GitHub API.
#4103 comparison head read from HEAD4103.txt (fetched at claim time).
James Reed (@rcfc-jreed), with substantial AI assistance (Claude, in Cursor).
Apache-2.0.
"""
from __future__ import annotations
import argparse, collections, json, re, sys
from pathlib import Path
HEAD = "1588e746871c5f1f197dbc034db2bfadbad0b646"
BASE_PR1 = "d8e0f83f00191df62174b641e9fff055c357f641"
BASE_PR636 = "1f7a934975e5eacaf83511c9ac870263bf095e05"
ADAPTER = [
"docs/research/research-package-guide.md",
"research/pr1-retention-receipt/README.md",
"research/pr1-retention-receipt/SOURCES.json",
"research/pr1-retention-receipt/VERIFY.json",
"research/pr636-family-witness-manifest-receipt/README.md",
"research/pr636-family-witness-manifest-receipt/SOURCES.json",
"research/pr636-family-witness-manifest-receipt/VERIFY.json",
"scripts/replay_historical_receipt.py",
"tests/test_research_historical_receipts.py",
]
results = []
def check(name, ok, detail=""):
results.append((name, bool(ok), detail))
print(("PASS " if ok else "FAIL ") + name + ((": " + str(detail)) if detail else ""), flush=True)
return bool(ok)
def load(path: Path):
return json.loads(path.read_text(encoding="utf-8"))
def run(pkg: Path):
from4103 = pkg / "from4103"
bad_eq = [rel for rel in ADAPTER if (pkg / rel).read_bytes() != (from4103 / rel).read_bytes()]
check("A1 nine adapter paths byte-identical to #4103 head",
not bad_eq and len(ADAPTER) == 9, bad_eq)
v1 = load(pkg / "research/pr1-retention-receipt/VERIFY.json")
v636 = load(pkg / "research/pr636-family-witness-manifest-receipt/VERIFY.json")
check("I1 both receipt VERIFY status=ready; first command is replay_historical_receipt",
v1["status"] == v636["status"] == "ready"
and v1["commands"][0]["argv"][2].endswith("replay_historical_receipt.py")
and v636["commands"][0]["argv"][2].endswith("replay_historical_receipt.py")
and "scripts/replay_historical_receipt.py" in v1["inputs"]
and "scripts/replay_historical_receipt.py" in v636["inputs"])
s1 = load(pkg / "research/pr1-retention-receipt/SOURCES.json")
s636 = load(pkg / "research/pr636-family-witness-manifest-receipt/SOURCES.json")
def pins_ok(s, base, n):
return (s["base_commit"] == base
and len(s["files"]) == n
and all(f.get("usage") == "provenance"
and len(f.get("sha256", "")) == 64
and len(f.get("git_blob", "")) == 40
for f in s["files"]))
check("I2 PR1 SOURCES base d8e0f83f… / 11 provenance pins; PR636 base 1f7a9349… / 4 pins",
pins_ok(s1, BASE_PR1, 11) and pins_ok(s636, BASE_PR636, 4))
adapter_py = (pkg / "scripts/replay_historical_receipt.py").read_text(encoding="utf-8")
check("H1 adapter defines PASS_HISTORICAL_RECEIPT_ONLY / METADATA_ONLY labels",
'PASS_HISTORICAL_RECEIPT_ONLY' in adapter_py
and 'PASS_HISTORICAL_METADATA_ONLY' in adapter_py
and 'label = "PASS_HISTORICAL_METADATA_ONLY" if check_only else "PASS_HISTORICAL_RECEIPT_ONLY"' in adapter_py)
# tighter: final print line
check("H2 final print wires label + live_inputs_validated=false (not live acceptance)",
'print(label + " " + package + " base=" + policy["base_commit"]' in adapter_py
and '+ " live_inputs_validated=false")' in adapter_py
and "PASS_HISTORICAL_METADATA_ONLY" in adapter_py)
guide = (pkg / "docs/research/research-package-guide.md").read_text(encoding="utf-8")
check("H3 research-package-guide documents PASS_HISTORICAL_RECEIPT_ONLY and live_inputs_validated=false",
"PASS_HISTORICAL_RECEIPT_ONLY" in guide
and "live_inputs_validated=false" in guide)
tests = (pkg / "tests/test_research_historical_receipts.py").read_text(encoding="utf-8")
names = re.findall(r"^\s*def (test_\w+)", tests, re.M)
check("T1 adapter regression suite defines exactly 36 test_* methods",
len(names) == 36, len(names))
required = [
"test_positive_historical_replay_keeps_live_bytes_and_git_unchanged",
"test_default_live_validation_still_fails",
"test_arbitrary_wrapper_metadata_drift_rejected",
]
check("T2 suite includes positive replay + default live-validation failure + drift rejection",
all(r in names for r in required), [r for r in required if r not in names])
led = load(pkg / "docs/research/pr-ledger.json")
prs = led["pull_requests"]
disp = collections.Counter(p["disposition"] for p in prs)
nums = [p["number"] for p in prs]
check("L1 ledger inventory_count == len(pull_requests) == 3028; PR numbers unique",
led["inventory_count"] == len(prs) == 3028
and len(set(nums)) == len(nums))
check("L2 ledger counts match disposition tallies (incorporated/partial/superseded/unreviewed)",
dict(disp) == led["counts"]
and disp["incorporated"] == 2064
and disp["partially_reviewed"] == 902
and disp["superseded"] == 2
and disp["unreviewed"] == 60
and sum(disp.values()) == 3028)
check("L3 ledger scope is reconciliation index (not blanket mathematical verification); schema_version=1",
led["schema_version"] == 1
and "not blanket mathematical verification" in led["scope"])
intake_dir = pkg / "scripts/historical-ci-inputs/intake-starting-heads"
expected = {
"09fbc0f002fc5b04814272c89edbd557b2a8285d.json": 231,
"24db9bfffd4a7c812545ea6ae58853cb9ef094b2.json": 332,
"82d67beb311be1b630eb95197492e6462eddccd8.json": 152,
}
bad_in = []
for name, n in expected.items():
d = load(intake_dir / name)
if d.get("schema_version") != 1 or len(d.get("pull_requests", [])) != n:
bad_in.append(name)
check("C1 three intake-starting-heads JSON snapshots: schema 1 and PR counts 231/332/152",
not bad_in, bad_in)
wf = (pkg / ".github/workflows/community-tooling799.yml").read_text(encoding="utf-8")
check("W1 community-tooling799 workflow references historical receipt replay",
"replay_historical" in wf or "historical" in wf.lower())
check("N1 finite scope: no new κ receipt; full isolated Git PR1/PR636 replay not asserted here",
"kappa" not in adapter_py.lower()
or "no new" in (pkg / "research/pr1-retention-receipt/README.md").read_text().lower())
failed = [name for name, ok, _ in results if not ok]
print(f"\n{len(results) - len(failed)}/{len(results)} PASS", flush=True)
if failed:
print("FAILED:", ", ".join(failed), flush=True)
return 1
return 0
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--pkg", required=True)
ap.add_argument("--expect-head", default=HEAD)
args = ap.parse_args()
check("HEAD pin recorded (API fetch)", args.expect_head == HEAD, args.expect_head)
return run(Path(args.pkg))
if __name__ == "__main__":
sys.exit(main())James Reed (@rcfc-jreed), with substantial AI assistance (Claude, in Cursor). |
Problem and result
The ledger repair changes a declared live input, so affected-package CI selects the PR1 and PR636 historical source/credit receipts. The original wrappers then reject later contributor/ledger bytes before replay:
working source drift: CONTRIBUTORS.mdandworking source drift: docs/research/pr-ledger.json. The original registered-package run remains retained failed evidence. This is separate from the inherited P112 workflow parse problem.Integrate the exact historical-only adapter patch from #4103 into the ledger proposal so the affected receipts authenticate and replay their original inputs. The generic live-input validator remains unchanged and strict.
PASS_HISTORICAL_RECEIPT_ONLYexplicitly reportslive_inputs_validated=false; it does not approve today's ledger, close a PR, or establish scientific acceptance.Current exact head and scope
Current head:
1588e746871c5f1f197dbc034db2bfadbad0b646. Base: upstreamCrocSwap/integer-mult-bounds:mainatbb4bccbf42844d2801487450727c2f63e10d1d0f. This draft now contains 20 files, the union of the original 11 ledger/reconciliation files and the nine receipt-adapter files. It is no longer an independently green 11-file proposal on the current base.The additive merge preserves both published extraction commits as parents: ledger/reconciliation
1f360c63d00289aa5be2300d8c72e7bcf86827feand receipt adapters161ce1b96288349fd67ecda1734d2f96850a2ee9. All nine added adapter files match #4103 byte-for-byte. The ledger and all original ledger-repair files remain byte-for-byte unchanged from the first parent. #4103 remains the focused adapter review; its patch is included here because the ledger change activates these consumers. Neither proposal is upstream-merged.The retained ledger repair authenticates three original intake snapshots by commit/blob/SHA256, preserves first-seen contributor/head metadata, preserves closure projection, admits only explicitly pinned helper/documentation successors, and retains fatal failures with complete diagnostics. Its ledger delta remains exactly 19 missing closure keys becoming explicit null, with all 3,028 rows and other metadata unchanged. No full ledger regeneration was performed.
The receipt patch changes only the PR1/PR636 README/SOURCES/VERIFY wrappers, the explicit adapter, regression suite and guide. Original base-commit/blob/SHA256 pins, verifiers and evidence remain authenticated unchanged. The selected frontier and frozen scientific inputs are unchanged. The 11 P104 scientific files and the separate one-file P112 repair (#3885) are absent.
Local combined validation
Python 3.12.3 on the exact combined commit:
Hosted evidence
All four fresh upstream workflows pass at exact combined head
1588e746871c5f1f197dbc034db2bfadbad0b646:Earlier evidence remains scoped to its own source: the original ledger extraction's three successful fork workflows do not make its failed upstream registered-package run pass. #4103's upstream registered replay passes both real historical receipts at
161ce1b96288349fd67ecda1734d2f96850a2ee9; that is separate-head evidence, not the combined result above. No old run was rerun or relabelled.Boundaries and credit
This is the explicitly assigned CI repair and additive integration of existing patches. Current canonical guidance was read; the delta-only intake refresh fetched canonical main but could not run its queue read because
ghis unavailable. Targeted GitHub reads verified the exact proposal heads. No queue acceptance or scientific review decision is made here.No upstream merge, force-push, research-branch rewrite, source repinning, selected-result update, or broad mathematical replay is included. The inherited P112 issue remains separately tracked by #3885. Keep working research repairs until an effective upstream base exists.
Existing source authors, original repair attribution, licences and Apache-2.0 notices are retained. Consolidation and CI repair by Clear1nsight with substantial OpenAI assistance. Draft pending independent substantive tooling review.