Skip to content

fix(install): answer the direct lookup in the shape Node asks for (#2840) - #2844

Merged
thymikee merged 1 commit into
callstack:mainfrom
alcpereira:fix/install-source-direct-lookup
Sep 23, 2026
Merged

thymikee merged 1 commit into
callstack:mainfrom
alcpereira:fix/install-source-direct-lookup

Conversation

@alcpereira

Copy link
Copy Markdown
Contributor

Summary

install-from-source <url> failed on every direct (non-proxied) download. directDispatcher pins the socket to the approved address with a custom lookup that always answered callback(null, address, family). Node 20+ autoselects the network family by default and calls lookup with all: true, which expects an array. The connection then threw ERR_INVALID_IP_ADDRESS before any socket opened.

The lookup now answers [{ address, family }] when options.all is set and the single-address form otherwise. This is the same shape the maestro runScript dispatcher (packages/maestro/src/daemon-port/run-script-http.ts) already uses. The address check from #1692 is unchanged: the lookup still returns only the approved address.

2 files touched (source + its colocated test). No scope expansion.

Closes #2840

Validation

Tested at 615feacaf:

  • New test downloads from a local server over the direct path with the real Node lookup. The hostname is approved.invalid, so it only resolves through the pinned lookup. It failed before the fix with Invalid IP address: undefined and passes after.
  • The test also passes with NODE_OPTIONS=--no-network-family-autoselection (single-address path) and with HTTP(S)_PROXY set in the environment.
  • Ad hoc (not committed): IPv6 approved address ::1, and a real HTTPS GET to api.github.com pinned to its resolved IP. TLS validated against the hostname and the request returned 200.
  • pnpm check:affected --run: all runnable checks passed (362 files, 2274 tests).

Remaining risk: no live install-from-source run on a device. #2842 blocks the full end-to-end install after the download step.

🤖 Generated with Claude Code

…llstack#2840)

The direct install-source dispatcher pins the connection to the approved
address through a custom lookup that always answered with a single address.
Node 20+ enables network family autoselection by default and calls lookup
with `all: true`, expecting an array, so every direct download failed with
ERR_INVALID_IP_ADDRESS before a socket opened. Proxied downloads were
unaffected.

The lookup now returns `[{ address, family }]` when asked for all addresses
and the single-address form otherwise, matching the maestro runScript
dispatcher. The approved address is still the only one it ever returns.

Closes callstack#2840

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@thymikee

Copy link
Copy Markdown
Member

615feac looks ready to merge. The direct lookup now returns the shape Node expects, matching directDispatcher in maestro's run-script-http.ts, so net.connect's autoSelectFamily path gets a valid callback result instead of an ERR_INVALID_IP_ADDRESS failure.

No CI signal exists yet on this PR to report.

Not blocking: the new lookup block in packages/provision-kit/src/install-source-network-transport.ts#L59 is byte-for-byte the same fix directDispatcher has carried since PR #2652 (packages/maestro/src/daemon-port/run-script-http.ts#L118-L124), and the two files also duplicate proxyDispatcher and the address-bracket helpers — since run-script-http.ts already imports resolveProxyForUrl from this same module, exporting the lookup factory and importing it there too would close the duplication, but this can be taken up later or left as is.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 23, 2026
@thymikee
thymikee merged commit db4feb9 into callstack:main Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(install): install-from-source <url> fails for every direct download

2 participants