0.3.1-0-pre.2

This commit is contained in:
2026-09-20 21:30:12 +02:00
parent ba718ce4ec
commit 51371c1b24
29 changed files with 981 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# file: scripts/audit_distribution_layout.py
# version: 7
# version: 8
"""Audit the static distribution layout expected by supported POCs."""
@@ -30,6 +30,17 @@ REQUIRED_PATHS = (
"crates/apps/game-reflex-poc-tauri/frontend/ts/main.ts",
"crates/apps/game-reflex-poc-wasm/Cargo.toml",
"crates/apps/game-snake-poc-wasm/Cargo.toml",
"crates/apps/game-snake-poc-tauri/Cargo.toml",
"crates/apps/game-snake-poc-tauri/README.md",
"crates/apps/game-snake-poc-tauri/USAGE.md",
"crates/apps/game-snake-poc-tauri/package.json",
"crates/apps/game-snake-poc-tauri/tsconfig.json",
"crates/apps/game-snake-poc-tauri/vite.config.ts",
"crates/apps/game-snake-poc-tauri/tauri.conf.json",
"crates/apps/game-snake-poc-tauri/capabilities/default.json",
"crates/apps/game-snake-poc-tauri/icons/icon.png",
"crates/apps/game-snake-poc-tauri/frontend/main.html",
"crates/apps/game-snake-poc-tauri/frontend/ts/main.ts",
"Web/game-snake-poc/package.json",
"Web/game-snake-poc/tsconfig.json",
"Web/game-snake-poc/vite.config.ts",
@@ -136,6 +147,56 @@ def audit_snake_web_integration(root: pathlib.Path) -> list[str]:
violations.append(message)
return violations
def audit_snake_tauri_android_integration(root: pathlib.Path) -> list[str]:
"""Validate the minimal Snake Tauri Android host boundary."""
violations: list[str] = []
cargo_path = root / "crates/apps/game-snake-poc-tauri/Cargo.toml"
package_path = root / "crates/apps/game-snake-poc-tauri/package.json"
tauri_path = root / "crates/apps/game-snake-poc-tauri/tauri.conf.json"
tauri_rust_path = root / "crates/apps/game-snake-poc-tauri/src/tauri.rs"
frontend_path = root / "crates/apps/game-snake-poc-tauri/frontend/ts/main.ts"
logging_path = root / "crates/apps/game-snake-poc-tauri/frontend/ts/logging.ts"
wasm_runtime_path = root / "crates/apps/game-snake-poc-wasm/src/runtime.rs"
paths = (cargo_path, package_path, tauri_path, tauri_rust_path, frontend_path, logging_path, wasm_runtime_path)
if not all(path.exists() for path in paths):
return violations
cargo = cargo_path.read_text(encoding="utf-8")
package = package_path.read_text(encoding="utf-8")
tauri = tauri_path.read_text(encoding="utf-8")
tauri_rust = tauri_rust_path.read_text(encoding="utf-8")
frontend = frontend_path.read_text(encoding="utf-8")
logging = logging_path.read_text(encoding="utf-8")
wasm_runtime = wasm_runtime_path.read_text(encoding="utf-8")
required_fragments = (
(cargo, 'game-logging-lib = { path = "../../common/game-logging-lib" }', "DIST-LAYOUT-021: Snake Tauri host must use shared Rust logging"),
(cargo, 'tauri-plugin-tracing.workspace = true', "DIST-LAYOUT-022: Snake Tauri host must enable the tracing plugin"),
(package, '"wasm:dev": "cargo build -p game-snake-poc-wasm', "DIST-LAYOUT-023: Snake Tauri dev hook must build the shared Snake WASM adapter"),
(package, 'wasm-bindgen ../../../../builds/sasedev-games/', "DIST-LAYOUT-024: Snake Tauri bindings must be generated outside the repository"),
(tauri, '"script": "npm run dev"', "DIST-LAYOUT-025: Tauri must own the frontend development hook"),
(tauri, '"script": "npm run build"', "DIST-LAYOUT-026: Tauri must own the frontend production hook"),
(tauri_rust, '#[cfg_attr(mobile, tauri::mobile_entry_point)]', "DIST-LAYOUT-027: Snake Tauri run entry point must support Tauri mobile"),
(tauri_rust, 'tauri_plugin_tracing::Builder::new()', "DIST-LAYOUT-028: Snake Tauri runtime must install the tracing plugin"),
(frontend, 'configure_runtime_provenance(', "DIST-LAYOUT-029: Snake Tauri frontend must configure provenance through the shared adapter"),
(logging, '@fltsci/tauri-plugin-tracing', "DIST-LAYOUT-030: Snake Tauri frontend logs must use the tracing bridge"),
(wasm_runtime, '"tauri-webview" => Some(engine_v1_platform_api::RuntimeHost::TauriWebView)', "DIST-LAYOUT-031: Snake WASM adapter must accept the Tauri WebView host"),
(wasm_runtime, '"android" => Some(engine_v1_platform_api::PlatformFamily::Android)', "DIST-LAYOUT-032: Snake WASM adapter must accept Android provenance"),
)
for content, fragment, message in required_fragments:
if fragment not in content:
violations.append(message)
forbidden_fragments = (
(package, "python", "DIST-LAYOUT-033: Snake Tauri build hooks must not use Python"),
(tauri, "python", "DIST-LAYOUT-034: Snake Tauri configuration must not use Python build orchestration"),
(frontend, "console.", "DIST-LAYOUT-035: Snake Tauri application frontend must not log directly through console.*"),
)
for content, fragment, message in forbidden_fragments:
if fragment in content.lower():
violations.append(message)
return violations
def main() -> int:
"""Validate that every static distribution boundary exists."""
@@ -154,6 +215,7 @@ def main() -> int:
forbidden_present.append(relative)
contract_violations.extend(audit_snake_web_shell(root))
contract_violations.extend(audit_snake_web_integration(root))
contract_violations.extend(audit_snake_tauri_android_integration(root))
if missing:
for relative in missing:
print(f"DIST-LAYOUT-001: missing required path: {relative}", file=sys.stderr)