mirror of
https://github.com/software-mansion/argent.git
synced 2026-09-14 19:27:14 +08:00
cee2433758
Fixes #853 **Cause:** `listen(0)` with no host binds every interface, so ten ephemeral-port test servers were LAN-reachable for as long as a suite ran. **Fix:** pass `"127.0.0.1"` at all ten sites, matching the twenty-two siblings that already do. Adds a guard test that scans `src/` and `test/` for any `.listen(0)` missing the host, so a new one fails CI. No sites left behind: `grep -rn "\.listen("` over every package turns up only these ten, the twenty-two already-loopback sites, the unix-socket listens in `native-devtools.ts` / `ax-service.ts` (no host applies), and `src/index.ts` which already passes `HOST`. **Docs:** none needed - test-only, no tool, CLI, config key, flow file, or user-facing capability changes. <details> <summary>Verification</summary> Guard test discriminates - with the ten fixes stashed it names every one of them: ``` + [ + "test/http-upload.test.ts:167", + "test/debugger/debugger-status-not-connected.test.ts:76", + "test/debugger/log-registry-not-connected.test.ts:73", + "test/debugger/metro-cdp-harness.ts:90", + "test/metro/integration.test.ts:154", + "test/metro/legacy-runtime-guards.test.ts:68", + "test/metro/multi-device.test.ts:90", + "test/metro/teardown-log-history.test.ts:80", + "test/metro/vega-target-routing.test.ts:98", + "test/network/network-integration.test.ts:327", + ] ``` `http-upload.test.ts` needed two extra lines: `listen(port)` binds synchronously, but `listen(port, host)` defers behind a DNS lookup, so `server.address()` came back `null`. It now awaits `listening`. The client `http.request` had no `host` (defaulting to `localhost`), and its `error` handler is a no-op, so a failed dial would have made the assertion pass vacuously - pinned to `127.0.0.1`. Probed that the request still reaches the server and a partial file is really created before cleanup: ``` PARTIALS ["argent-upload-d567a1aa-75a0-44e3-9e06-6d42544be1ee.tar.gz"] ERR Error: socket hang up ``` Ran from the worktree root: - `npx tsc --build` - clean - `npm run typecheck:tests -w @argent/tool-server` - clean - `npm test -w @argent/tool-server` - 369 files, 4833 passed, 1 skipped - `npm run knip` - clean - `npx prettier --write` on the changed files - no diff </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5 <noreply@anthropic.com>