0.3.0-0-pre.5

This commit is contained in:
2026-09-20 13:58:13 +02:00
parent 86b8af3b61
commit 7f0635ec9d
27 changed files with 827 additions and 39 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# file: scripts/audit_distribution_layout.py
# version: 5
# version: 6
"""Audit the static distribution layout expected by supported POCs."""
@@ -37,6 +37,10 @@ REQUIRED_PATHS = (
"Web/game-snake-poc/frontend/sass/_simplebar.scss",
"Web/game-snake-poc/frontend/sass/main.scss",
"Web/game-snake-poc/frontend/ts/main.ts",
"Web/game-snake-poc/frontend/ts/assets.ts",
"Web/game-snake-poc/frontend/ts/lifecycle.ts",
"Web/game-snake-poc/frontend/ts/logging.ts",
"Web/game-snake-poc/frontend/ts/provenance.ts",
"Android/game-reflex-poc/build.gradle",
"Android/game-snake-poc/build.gradle",
"scripts/build_android_rust.py",
@@ -88,6 +92,50 @@ def audit_snake_web_shell(root: pathlib.Path) -> list[str]:
return violations
def audit_snake_web_integration(root: pathlib.Path) -> list[str]:
"""Validate assets, lifecycle, logging and provenance wiring for the Snake Web POC."""
violations: list[str] = []
package_path = root / "Web/game-snake-poc/package.json"
vite_path = root / "Web/game-snake-poc/vite.config.ts"
main_path = root / "Web/game-snake-poc/frontend/ts/main.ts"
lifecycle_path = root / "Web/game-snake-poc/frontend/ts/lifecycle.ts"
provenance_path = root / "Web/game-snake-poc/frontend/ts/provenance.ts"
wasm_manifest_path = root / "crates/apps/game-snake-poc-wasm/Cargo.toml"
wasm_runtime_path = root / "crates/apps/game-snake-poc-wasm/src/runtime.rs"
if not all(path.exists() for path in (package_path, vite_path, main_path, lifecycle_path, provenance_path, wasm_manifest_path, wasm_runtime_path)):
return violations
package = package_path.read_text(encoding="utf-8")
vite = vite_path.read_text(encoding="utf-8")
main = main_path.read_text(encoding="utf-8")
lifecycle = lifecycle_path.read_text(encoding="utf-8")
provenance = provenance_path.read_text(encoding="utf-8")
wasm_manifest = wasm_manifest_path.read_text(encoding="utf-8")
wasm_runtime = wasm_runtime_path.read_text(encoding="utf-8")
required_fragments = (
(package, '"vite-plugin-static-copy"', "DIST-LAYOUT-007: Snake Web package must declare static asset packaging"),
(vite, 'dest: "common/data"', "DIST-LAYOUT-008: common Web assets must retain the common/data namespace"),
(vite, 'dest: "game/data"', "DIST-LAYOUT-009: game Web assets must retain the game/data namespace"),
(main, 'loadSnakeWebAssets()', "DIST-LAYOUT-010: Snake Web startup must load runtime asset probes"),
(main, 'bindBrowserLifecycle(session, stage)', "DIST-LAYOUT-011: Snake Web startup must bind browser lifecycle"),
(lifecycle, '"visibilitychange"', "DIST-LAYOUT-012: Snake Web lifecycle must observe visibility changes"),
(lifecycle, '"pagehide"', "DIST-LAYOUT-013: Snake Web lifecycle must observe pagehide"),
(lifecycle, 'ResizeObserver', "DIST-LAYOUT-014: Snake Web lifecycle must observe resize"),
(provenance, '"keyboard-mouse"', "DIST-LAYOUT-015: Snake Web provenance must distinguish keyboard/mouse input"),
(provenance, '"touch"', "DIST-LAYOUT-016: Snake Web provenance must distinguish touch input"),
(wasm_manifest, 'engine-v1-platform-api = { path = "../../engines/engine-v1-platform-api" }', "DIST-LAYOUT-017: Snake WASM adapter must consume the platform provenance API"),
(wasm_runtime, 'PlatformFamily::Web', "DIST-LAYOUT-018: Snake WASM provenance must declare Web platform family"),
(wasm_runtime, 'ExecutionModel::Wasm', "DIST-LAYOUT-019: Snake WASM provenance must declare WASM execution"),
(wasm_runtime, 'RuntimeHost::Browser', "DIST-LAYOUT-020: Snake WASM provenance must declare browser host"),
)
for content, fragment, message in required_fragments:
if fragment not in content:
violations.append(message)
return violations
def main() -> int:
"""Validate that every static distribution boundary exists."""
@@ -105,6 +153,7 @@ def main() -> int:
if (root / relative).exists():
forbidden_present.append(relative)
contract_violations.extend(audit_snake_web_shell(root))
contract_violations.extend(audit_snake_web_integration(root))
if missing:
for relative in missing:
print(f"DIST-LAYOUT-001: missing required path: {relative}", file=sys.stderr)