Skip to content

t3 serve --host tailnet binds the tailnet address only (#5) - #12

Merged
Khang5687 merged 6 commits into
fork-mainfrom
feat/tailnet-only
Sep 15, 2026
Merged

Khang5687 merged 6 commits into
fork-mainfrom
feat/tailnet-only

Conversation

@Khang5687

@Khang5687 Khang5687 commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

Ticket: #5 (parent spec #1, ADR 0003).

--host / T3CODE_HOST / the desktop envelope accept listen-interface kinds (loopback, tailnet, lan) and IPv4 addresses; the server resolves the selection and binds one address; resolver warnings surface in runtime state and startup output.

Two deliberate rulings, both noted for the next tickets:

Verification: contracts 393, tailscale 24, server 4023 passed; typecheck and lint clean. The 12 server failures are the known pre-existing environment ones (symlinked /private/var paths, local npm/mise/Homebrew layout, local Codex/Antigravity installs), identical before and after this branch. One AC not proven at Seam 1: remote-reachable policy for a real non-loopback bind needs that address on the test host; covered by the existing 0.0.0.0 harness case.

Khang5687 and others added 6 commits September 15, 2026 22:19
`--host`, `T3CODE_HOST`, and the desktop bootstrap envelope all carry one
string. `parseListenHostSelection` reads it as either a legacy host that binds
verbatim (a single IP, a wildcard, `localhost`) or a listen-interface selection
built from comma-separated kinds and IPv4 addresses (ADR 0003). Repeated
`--host` flags join with commas, so they union through the same parser.
Anything else comes back tagged invalid with a message listing accepted forms.
…bind

`resolveListenAddress` now reads its host through `parseListenHostSelection`.
A selection runs the tailscale package's pure resolver against the injected
interface map and binds the first non-loopback address, so `--host tailnet`
is reachable on the tailnet rather than on loopback. Tailscale being down
leaves loopback bound and warns instead of failing the launch.

`ResolvedListenAddress` carries those warnings, including the addresses that
resolved but lost, since one `HttpServerLive` still opens one socket. A single
legacy host keeps binding verbatim, so `--host 0.0.0.0` is unchanged.

Seam 1 gains `--host loopback` and `--host tailnet` cases. Neither probes the
injected LAN address: it is absent from the test machine, so connecting to it
hangs to ETIMEDOUT rather than refusing.
`--host` takes `loopback`, `tailnet`, `lan`, and IPv4 addresses, comma
separated or repeated; repeated flags join with commas so they union in the
parser. A single legacy host still binds verbatim, so `--host 0.0.0.0` and
`--host 127.0.0.1` are unchanged, and flag > env > bootstrap precedence is
untouched.

The flag rejects an unknown token at parse time. `T3CODE_HOST` and the
bootstrap envelope skip the flag, so `resolveServerConfig` runs the same
parser and fails with `InvalidListenHostError`. Both messages name the
offending token and list the accepted forms. Help text updated.
…tartup

A tailnet selection that finds no Tailscale address still starts the server on
loopback, which is silent otherwise. The `ListenAddress` layer now logs each
warning at launch, persisted runtime state carries them when there are any,
and headless startup prints them above the ready line.

The headless connection string, pairing URL, and QR already read
`connectionHost`, so a tailnet selection advertises the tailnet address
without further change.
`isLegacyHostToken` accepted any token containing a colon as IPv6, so
`--host foo:bar` passed validation and died later at bind with a DNS error
instead of the accepted-forms message. It now matches real IPv6 syntax,
bracketed or not, including a zone id.

Adds the coverage the acceptance criteria named but the first pass missed:
repeated `--host` flags unioning, and a kind keyword arriving through the
desktop bootstrap envelope.

Updates the two user docs that still described `--host` as taking only an
address, and corrects a listenAddress comment that claimed the bootstrap
envelope reached the resolver unvalidated.
Until multi-bind lands, a selection with a non-loopback kind binds that
address instead of loopback. State the deviation and its retirement in
ADR 0003 rather than leaving it only in a code comment.

Refs #5

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@Khang5687
Khang5687 merged commit c3ca141 into fork-main Sep 15, 2026
5 of 14 checks passed
@github-actions github-actions Bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant