Files
Takeshi b84bade045 Save The Tree implementation and acceptance work in progress
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.
2026-10-11 15:58:00 +09:00

141 lines
12 KiB
Python

# -*- coding: utf-8 -*-
"""Prepare/adopt four plan documents for the reviewed current Windows subset."""
from pathlib import Path
import argparse
import collections
import datetime
import difflib
import hashlib
import importlib.util
import json
ROOT = Path(__file__).resolve().parents[4]
PLAN = ROOT / "docs/plans/original-completion-2026-10-02"
ART = ROOT / "artifacts/original-completion-2026-10-02"
OUT = ART / "checkpoint-windows-current-root-r01"
NAMES = ("IMPLEMENTATION_PLAN.md", "PROGRESS_INTEGRATION.md", "work_packages.json", "progress_snapshot.json")
def sha(path):
return hashlib.sha256(path.read_bytes()).hexdigest()
def read(path):
return json.loads(path.read_text())
def dump(value):
return json.dumps(value, ensure_ascii=False, indent=2) + "\n"
def require(value, message):
if not value:
raise AssertionError(message)
def source():
path = ART / "windows-current-release-adapter-prep-r04/windows_adapter.py"
spec = importlib.util.spec_from_file_location("windows_checkpoint_adapter", path)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module.inventory(ROOT)
def protected():
names = ("atomic_requirements.json", "progress_contract.json", "current_evidence_links.json", "atomic_denominator_freeze.json", "source_atomic_coverage.json", "baseline.json", "decisions.json")
return {name: sha(PLAN / name) for name in names}
def prepare():
require(not OUT.exists(), "Fresh checkpoint required")
proof_path = ART / "windows-current-release-root-review-r01/review.json"
proof = read(proof_path)
require(proof["passed"] and proof["native_Windows"] == "pending" and not proof["whole_original_acceptance"], "Reviewed limited evidence required")
pins = read(ART / "windows-current-release-candidate-r03/source-start.json")
require(source() == pins, "Source changed after Windows review")
at = datetime.datetime.now(datetime.timezone(datetime.timedelta(hours=9))).isoformat()
OUT.mkdir()
(OUT / "before").mkdir()
(OUT / "reviewed").mkdir()
before = {name: sha(PLAN / name) for name in NAMES}
guard = protected()
for name in NAMES:
(OUT / "before" / name).write_bytes((PLAN / name).read_bytes())
def ref(relative, scope):
return {"path": relative, "sha256_at_integration": sha(ROOT / relative), "scope": scope, "linked_at_jst": at, "current_game_acceptance_inferred": False}
review = ref(proof_path.relative_to(ROOT).as_posix(), "Current1224/852-runtime export/ZIP10memberCRC+SHA, macOS samePCK626 raw+5profiles,195kitpins; native Windows pending")
paired = ref("artifacts/original-completion-2026-10-02/windows-current-release-same-pck-r01/verification.json", "Actual macOS samePCK5 suites626/0; not native Windows/OS normal operations/performance")
package = ref("artifacts/original-completion-2026-10-02/windows-current-release-candidate-r03/package-integrity.json", "Actual release ZIP CRC/all10memberSHA; unmodified official EXE template, finished EXE resources unaccepted")
kit = ref("artifacts/original-completion-2026-10-02/native-windows-current-release-kit-r01/kit-manifest.json", "195-file artifact-only native kit; PowerShell parsing/C#compile/native launches remain unverified/0")
status = "現Runtime14・1224入力のWindows release候補とZIP全10メンバーのCRC/SHAを照合。macOS上の同一PCK5 suites/626 checks失敗0。Windows実機・完成EXE資産は未受入。"
packages = read(PLAN / "work_packages.json")
p02 = next(p for p in packages if p["id"] == "P02")
p29 = next(p for p in packages if p["id"] == "P29")
task = next(t for t in p02["remaining_deliverables"] if t["id"] == "P02-03")
task["evidence"] += [review, paired, kit]
task["progress_summary"] = status + " native kitは準備済みで、実機機種情報/PowerShell解析/起動は未確認。"
task["remaining_gaps"] = ["Windows機の到達性/OS/CPU/GPU/RAM/倍率/解像度と同一配布物の実機起動未確認。", "通常操作/保存終了再起動/日本語パス/音の実聴/Windows描画と性能は未受入。", "候補はapplication/modify_resources=false。完成製品のEXEアイコン等の受入と後続変更後の再書出しが必要。"]
task["updated_at_jst"] = at
p02["current_summary"] += " 現配布候補の書出し/ZIPとmacOS同一PCK626は限定照合済み。"
p29["current_summary"] = status
task29 = next(t for t in p29["remaining_deliverables"] if t["id"] == "P29-01")
task29["state"] = "in_progress"
task29["evidence"] += [review, package]
task29["progress_summary"] = status
task29["remaining_gaps"] = ["完成EXE資産/全ゲームの最終同一候補受入/後続ゲーム変更後の再書出しは未完。"]
task29["updated_at_jst"] = at
p29["updated_at_jst"] = at
(OUT / "reviewed/work_packages.json").write_text(dump(packages))
snapshot = read(PLAN / "progress_snapshot.json")
snapshot["integrated_at_jst"] = at
snapshot["current_delivery_state_counts"] = dict(collections.Counter(t["state"] for p in packages for t in p["remaining_deliverables"]))
snapshot["current_windows_limited_checkpoint"] = {"root_review": review, "same_PCK": paired, "package": package, "native_kit": kit, "source_files": 1224, "runtime_export_inputs": 852, "actual_macOS_same_PCK_suites": 5, "actual_macOS_same_PCK_checks": 626, "native_Windows": "pending", "native_windows_launches": 0, "PowerShell_parser": "unverified", "CSharp_compile": "unverified", "finished_EXE_resources_accepted": False, "full_original_accepted": False, "source_changes_by_integration": 0, "adoption_receipt": "artifacts/original-completion-2026-10-02/checkpoint-windows-current-root-r01/adoption.json"}
(OUT / "reviewed/progress_snapshot.json").write_text(dump(snapshot))
section = "\n\n### 現版Windows候補の限定照合\n\n[Root照合](../../../artifacts/original-completion-2026-10-02/windows-current-release-root-review-r01/review.json)は、現Runtime14・1224 sourceと852 runtime入力からのrelease EXE/PCK、ZIP全10メンバーCRC/SHAを確認した。EXE `d34d36f3…`、PCK `6445885a…`、ZIP `736cbc48…` の同じ配布パックを用いたmacOS上5 suites/626 checksは失敗0で、各専用profileの実5条件とraw logを照合した。これはWindows実機の起動・通常操作・性能の受入ではない。\n\n195-file native kitは同じ配布SHAと実機情報/profile/rawを記録する準備物。PowerShell解析・C#compile・Windows起動は未確認、実機0を保持する。現候補はclone-only `application/modify_resources=false` で公式template EXEを使うため、完成EXEアイコン等の受入は未完。ENOSPCの部分ZIPと前回0B EXEの失敗履歴を保持し、成功へ書換えていない。P29-01は着手中へ更新し、全体・P02/P29・原子8観点の完了は増やさない。\n\n[文書採用記録](../../../artifacts/original-completion-2026-10-02/checkpoint-windows-current-root-r01/adoption.json)に旧/採用後4文書SHAと変更0のsource/protected台帳を保持する。後続ゲーム変更には別source・配布候補・回帰が必要。\n"
text = (PLAN / "IMPLEMENTATION_PLAN.md").read_text()
replacements = {
"| Windows | 旧1394配布物のCRCと9ファイルmanifestを再確認 | 現採用版の書出し、機種情報、同一EXEでの実機操作・保存再開 |": "| Windows | 現1224 sourceのrelease候補・ZIP全10member CRC/SHA、macOS同一PCK626/0をroot照合 | Windows機種情報・同一EXE実機操作/保存再開・完成EXE資産 |",
"状態: 着手中。旧1394配布物の整合確認のみ。同一現版Windows実機・スペック・表示環境は未確認。": "状態: 着手中。現1224 release候補/ZIPをroot照合、macOS同一PCK626/0。native kit準備済み。Windows実機/機種情報/完成EXE資産は未受入。",
"現在地: 旧1394版Windows配布物のZIP・PCK検査とmacOSでのPCK実行は合格。現採用版のWindows書出し・同一配布実機受入は未完。": "現在地: " + status,
"- P29-01 最新候補の書き出し。採用済みソースだけからWindows EXE/PCKを再生成し、同梱データとZIPを確認する。 受入: ソース・PCK・EXE・ZIPのハッシュ、同梱マニフェスト、CRCが対応する。": "- P29-01 最新候補の書き出し。採用済みソースだけからWindows EXE/PCKを再生成し、同梱データとZIPを確認する。 受入: ソース・PCK・EXE・ZIPのハッシュ、同梱マニフェスト、CRCが対応する。 状態: 着手中。現1224候補/ZIPと同一PCK626/0を限定照合。完成EXE資産・後続変更後の最終候補は未受入。",
}
for before_text, after_text in replacements.items():
require(text.count(before_text) == 1, "Expected plan text missing: " + before_text)
text = text.replace(before_text, after_text)
(OUT / "reviewed/IMPLEMENTATION_PLAN.md").write_text(text + section)
(OUT / "reviewed/PROGRESS_INTEGRATION.md").write_text((PLAN / "PROGRESS_INTEGRATION.md").read_text() + section)
after = {name: sha(OUT / "reviewed" / name) for name in NAMES}
for name in NAMES:
delta = difflib.unified_diff((OUT / "before" / name).read_text().splitlines(True), (OUT / "reviewed" / name).read_text().splitlines(True), fromfile="before/" + name, tofile="reviewed/" + name)
(OUT / (name + ".diff")).write_text("".join(delta))
require(source() == pins and protected() == guard and all(sha(PLAN / n) == v for n, v in before.items()), "Production changed while preparing")
(OUT / "preparation.json").write_text(dump({"before": before, "reviewed": after, "protected": guard, "source_map": pins, "root_review_sha256": sha(proof_path), "prepared_at_jst": at, "production_document_writes": 0, "game_source_changes": [], "completed_deliveries_added": 0}))
print("Prepared four reviewed documents; production writes=0")
def adopt():
data = read(OUT / "preparation.json")
require(not (OUT / "adoption.json").exists(), "Already adopted")
require(source() == data["source_map"] and protected() == data["protected"], "Protected/current source changed")
require(all(sha(PLAN / n) == v for n, v in data["before"].items()), "Production document changed")
require(all(sha(OUT / "reviewed" / n) == v for n, v in data["reviewed"].items()), "Reviewed candidate changed")
require(sha(ART / "windows-current-release-root-review-r01/review.json") == data["root_review_sha256"], "Root evidence changed")
for name in NAMES:
temp = PLAN / (name + ".windows-checkpoint-tmp")
require(not temp.exists(), "Unexpected staging file")
temp.write_bytes((OUT / "reviewed" / name).read_bytes())
temp.replace(PLAN / name)
require(source() == data["source_map"] and protected() == data["protected"], "Source/protected changed during adoption")
require(all(sha(PLAN / n) == v for n, v in data["reviewed"].items()), "Adopted document SHA differs")
(OUT / "adoption.json").write_text(dump({"passed": True, "before": data["before"], "adopted": data["reviewed"], "root_review_sha256": data["root_review_sha256"], "protected_unchanged": data["protected"], "source_files": len(data["source_map"]), "source_changes": [], "document_diff_reviewed_by_root": True, "engine_runs": 0, "new_completed_deliveries": 0, "native_Windows": "pending", "whole_original_acceptance": False}))
print("Adopted four plan documents; source/protected changes=0")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("mode", choices=("prepare", "adopt"))
args = parser.parse_args()
(prepare if args.mode == "prepare" else adopt)()