Datasets:
File size: 5,567 Bytes
135112f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | """Package already-published FT-Fail evidence without running any benchmark."""
from __future__ import annotations
import argparse
import hashlib
import json
import re
import shutil
import subprocess
from pathlib import Path
from urllib.parse import quote
def digest(path):
return hashlib.sha256(path.read_bytes()).hexdigest()
def package(output: Path):
output.mkdir(parents=True, exist_ok=False)
sources = {}
revision = subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip()
def read(path):
path = Path(path)
sources[str(path)] = digest(path)
return json.loads(path.read_text())
def write_rows(relative, rows):
path = output / relative
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(
"".join(json.dumps(row, ensure_ascii=False) + "\n" for row in rows)
)
for split in ("dev", "heldout"):
cases = []
for path in sorted(Path("bench/cases", split).glob("*.json")):
case = read(path)
cases.append(
{
"id": case["id"],
"split": split,
"task": case["task"],
"model": case["model"],
"injected_faults": case["truth"],
"case_json": json.dumps(case["case"], sort_keys=True),
"hyperparameters_json": json.dumps(
case["hyperparameters"], sort_keys=True
),
"job_id": case["job_id"],
"saved_quality": case["heldout_metric"],
"source_manifest": str(path),
"source_sha256": sources[str(path)],
}
)
assert len(cases) == (5 if split == "dev" else 8)
write_rows(f"cases/{split}.jsonl", cases)
rows = read(f"docs/results/failure-audit-20261018/{split}/rows.json")
assert len(rows) == len(cases) * 4
assert {r["case"] for r in rows} == {c["id"] for c in cases}
write_rows(f"methods/{split}.jsonl", rows)
base = Path("docs/results/semantic-audit-20261020")
truth = {row["id"]: row for row in read(base / "constructed-truth.json")}
audit = [{**row, **truth[row["id"]]} for row in read(base / "audit.json")]
reference = read(base / "reference.json")
assert len(audit) == 200 and len(reference) == 400
assert {r["text"] for r in audit}.isdisjoint({r["text"] for r in reference})
write_rows("semantic_audit/dev.jsonl", audit)
write_rows("semantic_reference/dev.jsonl", reference)
evidence = [
Path("LICENSE"),
Path("scripts/package_ft_fail.py"),
Path("docs/benchmark.md"),
Path("docs/semantic-audit-20261020.md"),
Path("docs/semantic-data-controls-20261020.md"),
Path("docs/logit-audit-20261020.md"),
base / "protocol.json",
base / "acceptance-amendment.json",
base / "combined-results/report.json",
base / "embedding-results/report.json",
Path("docs/results/semantic-overlap-20261020/report.json"),
Path("docs/results/semantic-overlap-20261020/controls.json"),
Path("docs/results/distribution-controls-20261020/result.json"),
]
evidence.extend(Path("bench/cases").glob("*/*.json"))
for path in evidence:
destination = output / "evidence" / path
destination.parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(path, destination)
sources[str(path)] = digest(path)
if path.suffix == ".md":
def absolute_link(match, source_path=path):
label, target = match.groups()
if ":" in target or target.startswith("#"):
return match.group(0)
linked = (source_path.parent / target).resolve()
if not linked.exists() or not linked.is_relative_to(Path.cwd()):
return match.group(0)
relative = linked.relative_to(Path.cwd()).as_posix()
kind = "tree" if linked.is_dir() else "blob"
return f"[{label}](https://github.com/MaxKharlan/next-experiment/{kind}/{revision}/{quote(relative)})"
destination.write_text(
re.sub(r"\[([^\]]+)\]\(([^)]+)\)", absolute_link, path.read_text())
)
for name in ("README.md", "LICENSES.md"):
path = Path("docs/ft-fail-hub") / name
shutil.copyfile(path, output / name)
sources[str(path)] = digest(path)
manifest = {
"release": "2026-10-20",
"repository": "https://github.com/MaxKharlan/next-experiment",
"source_commit": revision,
"packaging_change": "Existing relative links in evidence Markdown resolve to the pinned GitHub source revision.",
"scope": "Completed historical benchmark and automatic development audit; no new inference or uncompleted final data.",
"sources_sha256": sources,
"files_sha256": {
str(path.relative_to(output)): digest(path)
for path in sorted(output.rglob("*"))
if path.is_file()
},
}
(output / "manifest.json").write_text(json.dumps(manifest, indent=2) + "\n")
return manifest
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--out", type=Path, required=True)
args = parser.parse_args()
result = package(args.out)
print(json.dumps({"files": len(result["files_sha256"]), "out": str(args.out)}))
|