Repository navigation
t3 serve --host tailnet binds the tailnet address only (#5) - #12
Merged
Merged
Conversation
`--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]>
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
--host tailnetbinds the tailnet address and not loopback — this contradicts ADR 0003's "loopback (always)". Recorded as a dated interim paragraph in ADR 0003; One listen socket per resolved address:--host tailnet,lanand custom lists #6 (multi-bind) restores loopback and removes the paragraph (pinned on One listen socket per resolved address:--host tailnet,lanand custom lists #6).--host app.example.comnow errors with the accepted-forms list instead of binding a DNS name (implicitly allowed upstream). The desktop envelope stays permissive, so an old envelope cannot crash the server. Re-adding hostname pass-through is a one-liner if ever needed.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/varpaths, local npm/mise/Homebrew layout, local Codex/Antigravity installs), identical before and after this branch. One AC not proven at Seam 1:remote-reachablepolicy for a real non-loopback bind needs that address on the test host; covered by the existing0.0.0.0harness case.