team-ljyzipelo

공개
71줄4.0 KB
1import hashlib
2import json
3import os
4from pathlib import Path
5import sys
6import tomllib
7
8if sys.flags.optimize or os.environ.get("PYTHONOPTIMIZE"):
9 raise SystemExit("정상 Python mode 필요")
10HERE = Path(__file__).resolve().parent
11ROOT = HERE.parents[1]
12
13
14def require(value, message):
15 if not value:
16 raise SystemExit(message)
17
18
19def sha(path):
20 return hashlib.sha256(path.read_bytes()).hexdigest()
21
22
23def check():
24 contract = json.loads((HERE / "contract.json").read_text())
25 sources = json.loads((HERE / "sources.json").read_text())
26 for path, record in sources.items():
27 data = (ROOT / path).read_bytes()
28 require(sha(ROOT / path) == record["sha256"], "고정 source 불일치: " + path)
29 blob = hashlib.sha1(b"blob " + str(len(data)).encode() + b"\0" + data).hexdigest()
30 require(blob == record["git_blob"], "고정 blob 불일치: " + path)
31 listed = []
32 for line in (HERE / "SHA256SUMS").read_text().splitlines():
33 digest, path = line.split(" ", 1)
34 require(path.startswith("tests/rust-ui-memory-gui-races/"), "manifest 경로 이탈")
35 require(sha(ROOT / path) == digest, "후보 hash 불일치: " + path)
36 listed.append(path)
37 expected = ["tests/rust-ui-memory-gui-races/" + n for n in contract["files"] if n != "SHA256SUMS"]
38 require(sorted(listed) == sorted(expected) and len(listed) == len(set(listed)), "manifest 파일 집합 불일치")
39 main = (HERE / "main.rs").read_text()
40 gate = (HERE / "gates.rs").read_text()
41 require('include!("../rust-ui-memory-races/assembly.rs");' in main, "PR45 조립 include 누락")
42 require('include!("../../experiments/rust-ui-memory-app/src/app.rs");' in main, "원본 화면 include 누락")
43 require("<App as eframe::App>::ui(&mut self.original, root, frame);" in main, "원본 UI 위임 누락")
44 require("extern crate self as zipelo_ui_memory_app;" in main, "시험 Controller 연결 별칭 누락")
45 require("시험용 화면 / 배포 바이너리 검증 아님" in main, "시험 표시 누락")
46 for token in ["impl Controller", "impl Task", "fn poll(", "thread::sleep", "Barrier::", "#[test]"]:
47 require(token not in main + gate, "메서드 대체/대기/선언 추가: " + token)
48 require("release.recv_timeout(GATE_TIMEOUT)" in gate and "Duration::from_secs(60)" in gate, "유한 장벽 누락")
49 require("runtime::deliver_completion(" in gate and "operation.gzip(" in gate, "실제 core/전달 호출 누락")
50 require("--opt-in-xvfb" in main and "ZIPELO_XVFB_HARNESS" in main, "명시적 실행 opt-in 누락")
51 original = tomllib.loads((ROOT / "experiments/rust-ui-memory-app/Cargo.toml").read_text())
52 manifest = tomllib.loads((HERE / "Cargo.toml").read_text())
53 require(manifest["dependencies"]["eframe"] == original["dependencies"]["eframe"], "GUI dependency 변경")
54 require(set(manifest["dependencies"]) == {"eframe", "core_memory"}, "직접 dependency 추가")
55 require(manifest["features"]["default"] == [], "기본 GUI 실행 금지")
56 require(manifest["bin"][0]["required-features"] == ["gui-race-harness"], "opt-in feature 누락")
57 prior = tomllib.loads((ROOT / "experiments/rust-ui-memory-app/Cargo.lock").read_text())["package"]
58 actual = tomllib.loads((HERE / "Cargo.lock").read_text())["package"]
59 for item in prior:
60 if item["name"] == "zipelo-ui-memory-app":
61 item["name"] = "zipelo-ui-memory-gui-races"
62 key = lambda item: (item["name"], item["version"])
63 require(sorted(prior, key=key) == sorted(actual, key=key), "원본 lock 외 package 변경")
64 plan = json.loads((HERE / "run-plan.json").read_text())
65 require("-nolisten tcp" in plan["future_launch_template"], "TCP 차단 누락")
66 require(set(contract["scenarios"]) == {"cancel", "retract", "close"}, "시나리오 불일치")
67 print(json.dumps({"fixed_sources": len(sources), "files": len(contract["files"]), "new_external_packages": 0, "new_test_declarations": 0, "built": False, "gui_executed": False}))
68
69
70if __name__ == "__main__":
71 check()