# `tools/windows-smoke.cmd` — Korean host smoke build + launch End-to-end "does Chanora build and start on Windows" verification. Designed for the lead's Korean Windows 11 test host and the `product/scaffold-v0` branch. Run from any directory inside the checked-out repo: ``` C:\Users\admin\chanora> tools\windows-smoke.cmd ``` The script `pushd`'s to the repo root (resolved from its own location), so the working directory does not matter as long as the script lives in `tools\` inside the checkout. ## What it does 1. Prepends Flutter + Cargo + MSVC to `PATH` and runs `vcvars64.bat`. Hard-coded paths assume the Korean host layout. If a path changes, edit the `set "PATH=..."` and `call "...\vcvars64.bat"` lines near the top. 2. `cargo build -p chanora_bridge --release` and checks `target\release\chanora_bridge.dll` exists and is at least 5 MB. 3. `flutter build windows --release` inside `apps\chanora_flutter` and checks the runner + `data\app.so`. 4. Copies the bridge DLL into the Flutter release folder. 5. Launches the runner for five seconds with stderr redirected to `%TEMP%\chanora-smoke.log`, then kills it. 6. Greps the log for `bridge initialised` (must be present) and `panicked` (must be absent). 7. Prints `PASS` and exits 0 on success. ## Exit codes | Code | Step | | ---- | -------------------------------------------------------------------- | | 0 | PASS | | 1 | `vcvars64.bat` failed | | 2 | `cargo build -p chanora_bridge --release` failed | | 3 | bridge DLL missing or smaller than 5 MB | | 4 | `flutter build windows --release` failed | | 5 | `chanora_flutter.exe` missing | | 6 | `data\app.so` missing or smaller than 1 MB | | 7 | bridge DLL copy into the Release folder failed | | 9 | log did not contain `bridge initialised` (bridge didn't load / panic at init) | | 10 | log contained `panicked` (Rust panic during the 5 s smoke window) | ## Common failure modes * **vcvars64 returns non-zero**: MSVC not installed at the expected path. Update the `call "...\vcvars64.bat"` line or install the Build Tools workload from the VS2022 installer. * **`cargo build` fails with `link.exe not found`**: vcvars64 did not take effect. Re-run from a fresh `cmd.exe` (PowerShell has its own quirks here). * **Bridge DLL exists but smaller than 5 MB**: a debug build slipped in. Make sure the script's `--release` flag was honoured; check that no `[profile.release]` override is stripping symbols too aggressively. * **`data\app.so` smaller than 1 MB**: Flutter assets did not bundle. Run `flutter clean` then re-run the script. * **`bridge initialised` absent**: the bridge `extern` symbol is not being found by the Flutter side. Verify the DLL copy step ran (it did, or the script would have exited 7) and that the DLL name matches what `lib/main.dart`'s ffi setup expects. * **`panicked` present**: open `%TEMP%\chanora-smoke.log` (the script dumps it on failure) and read the panic message. The most common cause during scaffold development is a missing flutter-rust-bridge code-gen file; re-run the codegen step per `docs/release/desktop-build-runbook.md`. ## Manual rerun of just the launch step The PASS path always tears the runner down. If you want to inspect the running application after a green smoke pass: ``` target\release\chanora_bridge.dll (already copied into Release\) apps\chanora_flutter\build\windows\x64\runner\Release\chanora_flutter.exe ``` Launching the EXE directly will reuse the copied DLL.