Preserve production code, regression fixtures, audio assets and provenance, test infrastructure, and the original-completion plan and progress ledger. Final game and Windows acceptance remain pending; excluded local artifacts and native experiments are not part of this snapshot.
88 lines
4.8 KiB
Python
88 lines
4.8 KiB
Python
"""Recheck retained source and raw regression evidence without rerunning it.
|
|
|
|
This accepts only the source regression baseline, never original-game acceptance.
|
|
The original plan's immutable baseline remains a historical record.
|
|
"""
|
|
from datetime import datetime
|
|
from hashlib import sha256
|
|
import json
|
|
from pathlib import Path
|
|
import re
|
|
import subprocess
|
|
from zoneinfo import ZoneInfo
|
|
|
|
ROOT = Path(__file__).resolve().parents[4]
|
|
PLAN = ROOT / "docs/plans/original-completion-2026-10-02"
|
|
OUTPUT = ROOT / "artifacts/original-completion-2026-10-02/p00-p02-baseline"
|
|
|
|
|
|
def digest(path):
|
|
return sha256(path.read_bytes()).hexdigest() if path.is_file() else None
|
|
|
|
|
|
def main():
|
|
OUTPUT.mkdir(parents=True, exist_ok=True)
|
|
baseline = json.loads((PLAN / "baseline.json").read_text())
|
|
map_path = ROOT / "artifacts/facility-need-pricing-production-scale-adoption-2026-10-01-r01/after.json"
|
|
adopted = json.loads(map_path.read_text())
|
|
current = {path: digest(ROOT / path) for path in adopted}
|
|
changes = [path for path in adopted if current[path] != adopted[path]]
|
|
pins = {path: {"expected": expected, "actual": digest(ROOT / path),
|
|
"passed": digest(ROOT / path) == expected}
|
|
for path, expected in baseline["source_pins"].items()}
|
|
review_path = ROOT / "artifacts/facility-need-pricing-r02-full155-independent-review-2026-10-01-r01/actual155-source-marker-review.json"
|
|
review = json.loads(review_path.read_text())
|
|
rows = []
|
|
for previous in review["rows"]:
|
|
path = ROOT / previous["test"]
|
|
log = Path(previous["actual_log"])
|
|
content = log.read_text() if log.is_file() else ""
|
|
marker = previous["actual_marker"]
|
|
match = re.search(r"checks=(\d+)|(\d+)(?: [A-Za-z]+)* checks", marker)
|
|
observed_count = int(next(g for g in match.groups() if g is not None)) if match else None
|
|
source_matches = digest(path) == previous["actual_source_sha256"]
|
|
log_matches = digest(log) == previous["actual_log_sha256"]
|
|
marker_matches = bool(content) and content.count(marker) == 1
|
|
diagnostics_clear = bool(content) and not any(s in content for s in ("SCRIPT ERROR:", "\nERROR:", "FAIL:"))
|
|
passed = (source_matches and log_matches and marker_matches and diagnostics_clear
|
|
and observed_count == previous["actual_checks"]
|
|
and previous["exit_code"] == 0 and previous["failed"] is False)
|
|
rows.append({"test": previous["test"], "source_matches": source_matches,
|
|
"retained_log": str(log), "log_matches": log_matches,
|
|
"unique_completion_marker": marker_matches,
|
|
"diagnostics_clear": diagnostics_clear,
|
|
"actual_checks": observed_count, "passed": passed})
|
|
discovered = {"tests/run_tests.gd"} | {
|
|
str(p.relative_to(ROOT)) for p in (ROOT / "tests").rglob("test*.gd")
|
|
if "export" not in p.relative_to(ROOT).parts
|
|
and str(p.relative_to(ROOT)) != "tests/s0/test_kernel_and_save.gd"}
|
|
recorded = {r["test"] for r in rows}
|
|
actual_checks = sum(r["actual_checks"] or 0 for r in rows)
|
|
head = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=ROOT, text=True).strip()
|
|
result = {
|
|
"scope": "retained regression applicability, not full original acceptance",
|
|
"audited_at_jst": datetime.now(ZoneInfo("Asia/Tokyo")).isoformat(),
|
|
"source_head": head, "baseline_head_matches": head == baseline["source_head"],
|
|
"source_map": str(map_path.relative_to(ROOT)), "source_map_sha256": digest(map_path),
|
|
"adopted_files": len(adopted), "changed_paths": changes, "source_pins": pins,
|
|
"retained_review": str(review_path.relative_to(ROOT)), "retained_review_sha256": digest(review_path),
|
|
"suites": len(rows), "actual_checks": actual_checks,
|
|
"uncovered_discovered_tests": sorted(discovered - recorded),
|
|
"stale_recorded_tests": sorted(recorded - discovered),
|
|
"duplicate_tests": len(rows) != len(recorded),
|
|
"rows": rows, "new_engine_runs": 0,
|
|
"retained_regression_applicable": (head == baseline["source_head"] and not changes
|
|
and all(p["passed"] for p in pins.values()) and recorded == discovered
|
|
and len(rows) == len(recorded) == 155 and actual_checks == 12310
|
|
and all(row["passed"] for row in rows)),
|
|
"original_full_acceptance": False,
|
|
}
|
|
(OUTPUT / "source-current.json").write_text(json.dumps(current, ensure_ascii=False, indent=2) + "\n")
|
|
(OUTPUT / "verification.json").write_text(json.dumps(result, ensure_ascii=False, indent=2) + "\n")
|
|
print(json.dumps({k: v for k, v in result.items() if k not in ("rows", "source_pins")}, ensure_ascii=False))
|
|
return 0 if result["retained_regression_applicable"] else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|