Repository navigation
v0.3.1 — ui-server start no longer silently ignores --bind / --port on a re-run
What was broken
When the Web UI server was already running, `./spectator ui-server start --bind 0.0.0.0` would silently no-op. The existing-PID check just printed:
```
Web UI already running (pid 12345).
url: http://0.0.0.0:7777/
```
…which was a misleading echo of the flag values you'd just typed — the actual server was still bound to whatever address it was started with originally (typically `127.0.0.1`). The UI would never become reachable on the LAN / Tailscale, and there was no way to discover the mismatch from the CLI output.
Fix
`ui-server start` now persists the running server's `bind` / `port` / `target` / `workdir` to `$workdir/ui-server/server.json` immediately after spawning uvicorn. A follow-up `start` reads that file and compares the requested flags against what's actually running:
```
$ ./spectator ui-server start # default bind 127.0.0.1
Web UI started (pid 12345).
url: http://127.0.0.1:7777/
$ ./spectator ui-server start --bind 0.0.0.0 # asking for a different bind
Conflict: Web UI already running (pid 12345) with --bind 127.0.0.1 --port 7777,
but you asked for --bind 0.0.0.0 --port 7777.
Stop it first to apply the new flags:
./spectator ui-server stop
./spectator ui-server start --bind 0.0.0.0 --port 7777
```
Other improvements:
- True idempotent re-runs (same flags) now print the real running URL from `server.json`, not an echo of the user's flags.
- `ui-server status` surfaces the running server's bind / port / target alongside the existing state-dir paths.
- `ui-server stop` cleans up `server.json` so the next `start` sees a clean slate.
- The FastAPI app's `version=` kwarg now reads `version` instead of being hardcoded — auto-tracks future bumps.
Migration
None required — the `server.json` file is created on next `start`. If you have a 0.3.0 server already running and want it visible to the conflict detector, restart it once: `./spectator ui-server stop && ./spectator ui-server start [--bind 0.0.0.0]`.
Tests
`tests/test_webui.py` grew 6 unit tests for the new helpers (state-paths exposure, round-trip, None-target normalization, defensive handling of missing / malformed / non-dict JSON). 39/39 pytest passes.