"""Regenerate the wire-parity fixture_client crate via the Rust codegen binary. Drives the Rust `mizan-generate` binary against `tests/rust/mizan.toml`, which points at the AFI fixture's FastAPI registration module. Output lands under `tests/rust/fixture_client/` and is consumed by both `drive_emitted` (typed-emitted-crate probes) and `drive_kernel` (raw-kernel probes) via the parent `Cargo.toml` workspace. """ from __future__ import annotations import subprocess import sys from pathlib import Path HERE = Path(__file__).resolve().parent REPO_ROOT = HERE.parents[1] BINARY = REPO_ROOT / "protocol/mizan-codegen/target/release/mizan-generate" CONFIG = HERE / "mizan.toml" def main() -> int: if not BINARY.exists(): sys.stderr.write( f"[regen] binary missing: {BINARY}\n" "[regen] build it: cargo build --release " "--manifest-path protocol/mizan-codegen/Cargo.toml\n" ) return 1 result = subprocess.run( [str(BINARY), "--config", str(CONFIG)], cwd=HERE, ) return result.returncode if __name__ == "__main__": sys.exit(main())