Commit 8c6573d
fix(cli): prefer IPv4 when binding webserver to "localhost"
`tokio::net::lookup_host("localhost:<port>")` returns both 127.0.0.1 and
::1 on Debian-family systems. The previous `.next().unwrap()` took
whichever came first — typically [::1] — which silently broke clients
that resolve `localhost` to 127.0.0.1 first (notably Node's `fetch`,
used by DEC Bench's assertion runner).
Symptom: `moose dev` listens on [::1]:4000, but `fetch("http://localhost:4000")`
hits 127.0.0.1 → ECONNREFUSED → assertion falls through to whatever else
binds 8080 (Temporal UI's SvelteKit catch-all SPA, returning text/html
for any path) → robust assertions fail with "valid JSON: false".
Fix: collect all resolved addresses and prefer the first IPv4. Falls
back to the first match if no IPv4 is present (so explicit IPv6-only
hosts still work). This also matches what every other moose-spawned
listener (devkafka, devredis, the moose-runner child, spawned ClickHouse
and Temporal subprocesses) already binds to.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent cb63c58 commit 8c6573d
1 file changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2566 | 2566 | | |
2567 | 2567 | | |
2568 | 2568 | | |
2569 | | - | |
2570 | | - | |
2571 | | - | |
2572 | | - | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
2573 | 2587 | | |
2574 | 2588 | | |
2575 | 2589 | | |
| |||
0 commit comments