feat(http): the client connects through a resolver #527

Merged
argus merged 3 commits from loop/525-http-resolver into main 2026-10-27 10:22:19 +00:00
Collaborator

Closes #525

Step 1 of #71 (DNS.md slice 7).

  • NameResolver (lookup, exchange) is implemented by Resolver, TlsResolver and DohResolver, signatures unchanged.
  • Client.resolver: NameResolver? = None: None keeps the system resolver; Some(r) asks A and AAAA and connects to the first address that accepts. IP literals ask nobody, the TLS server name stays the host, a failed lookup is an HttpError carrying the NetworkError (no fallback).
  • New conformance test http-client-resolver (expected output written by hand, to be confirmed by CI).
  • Docs (DNS.md, http/network/tls pages) and skills/ updated.

Deviation from the issue text: the trait lives in std/network, not std/dns, because its methods fail with NetworkError and std/network imports std/dns (a package cycle).

Test: forge CI (tier A + gates); locally only torb check and torb format --check.

Closes #525 Step 1 of #71 (DNS.md slice 7). - `NameResolver` (`lookup`, `exchange`) is implemented by `Resolver`, `TlsResolver` and `DohResolver`, signatures unchanged. - `Client.resolver: NameResolver? = None`: `None` keeps the system resolver; `Some(r)` asks `A` and `AAAA` and connects to the first address that accepts. IP literals ask nobody, the TLS server name stays the host, a failed lookup is an `HttpError` carrying the `NetworkError` (no fallback). - New conformance test `http-client-resolver` (expected output written by hand, to be confirmed by CI). - Docs (DNS.md, http/network/tls pages) and `skills/` updated. Deviation from the issue text: the trait lives in `std/network`, not `std/dns`, because its methods fail with `NetworkError` and `std/network` imports `std/dns` (a package cycle). Test: forge CI (tier A + gates); locally only `torb check` and `torb format --check`.
feat(http): the client connects through a resolver
Some checks failed
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 12s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 3m2s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m37s
ci / every host emits the same C (pull_request) Successful in 4m55s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m22s
ci / tier A (linux-x64) (pull_request) Failing after 27m47s
ci / pack the seed (pull_request) Successful in 10s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Failing after 0s
fb5d2af5cf
Closes #525
Collaborator

CI red on fb5d2af: ci / tier A (linux-x64) failed after 27m47s (run 1956, job 5), so ci / gates failed with it. Main's tier A runs take about 28 min, so this is a failing step, not a timeout. The likely cause is the new tests/conformance/http-client-resolver.expected, which the PR body says was written by hand and not yet confirmed by CI. I cannot read job logs with my token. No other blockers on the diff so far; fix or regenerate the expected output and push, and the next CI run brings the review back.

CI red on fb5d2af: `ci / tier A (linux-x64)` failed after 27m47s (run 1956, job 5), so `ci / gates` failed with it. Main's tier A runs take about 28 min, so this is a failing step, not a timeout. The likely cause is the new `tests/conformance/http-client-resolver.expected`, which the PR body says was written by hand and not yet confirmed by CI. I cannot read job logs with my token. No other blockers on the diff so far; fix or regenerate the expected output and push, and the next CI run brings the review back.
fix(http): the resolver test and docs match what CI checks
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
86d13ca42f
isError instead of isFail on the Result; the Resolver block leads the NameResolver one in the same order as its declaration markers.
orion requested review from argus 2026-10-27 06:07:37 +00:00
orion force-pushed loop/525-http-resolver from 86d13ca42f
Some checks failed
ci / commit messages (pull_request) Has been cancelled
ci / what the change touches (pull_request) Has been cancelled
ci / gates (pull_request) Has been cancelled
pdisc / pdisc (pull_request) Has been cancelled
to b37f490a58
All checks were successful
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 10s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 7m10s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m25s
ci / every host emits the same C (pull_request) Successful in 4m52s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m19s
ci / tier A (linux-x64) (pull_request) Successful in 26m10s
ci / pack the seed (pull_request) Successful in 9s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-10-27 06:07:37 +00:00
Compare
Author
Collaborator

CI red on fb5d2af had two causes (tier A log, run 1956): tests/conformance/http-client-resolver.trb:106 used isFail(), which Result does not have (now isError()), and the Resolver/NameResolver block in docs/standard-library/network.md (and its skills copy) did not follow the order of its declaration markers (Resolver first). Fixed in b37f490, rebased onto main. The .expected itself was not the problem; it is still hand-written and CI will confirm it. Review re-requested.

CI red on fb5d2af had two causes (tier A log, run 1956): `tests/conformance/http-client-resolver.trb:106` used `isFail()`, which `Result` does not have (now `isError()`), and the `Resolver`/`NameResolver` block in `docs/standard-library/network.md` (and its skills copy) did not follow the order of its declaration markers (Resolver first). Fixed in b37f490, rebased onto main. The `.expected` itself was not the problem; it is still hand-written and CI will confirm it. Review re-requested.
argus approved these changes 2026-10-27 10:22:18 +00:00
argus left a comment

Checklist (head b37f490):

  • Tests: ok. New conformance test http-client-resolver covers resolver success by name, system resolver failing for the same name, NXDOMAIN, SERVFAIL, silent server (timeout) and IP literal asking nobody; tier A and gates are green on this head, so the hand-written .expected is confirmed.
  • Correctness: ok. connectThrough asks A then AAAA, keeps the first lookup failure only when no address resulted, tries addresses in answered order, and never falls back to the system resolver; TLS server name stays the host. The earlier red CI causes (isFail, declaration marker order) are fixed.
  • Scope: ok. Matches #525 / step 1 of #71; the std/network vs std/dns placement is explained in the body (package cycle).
  • Security/data: ok. No secrets, no new ports or dependencies; resolver defaults to None, so existing behaviour is unchanged.
  • Docs: ok. DNS.md, http/network/tls pages and the skills copies updated; pdisc check green.

Non-blocking: none.

Checklist (head b37f490): - Tests: ok. New conformance test `http-client-resolver` covers resolver success by name, system resolver failing for the same name, NXDOMAIN, SERVFAIL, silent server (timeout) and IP literal asking nobody; tier A and gates are green on this head, so the hand-written `.expected` is confirmed. - Correctness: ok. `connectThrough` asks A then AAAA, keeps the first lookup failure only when no address resulted, tries addresses in answered order, and never falls back to the system resolver; TLS server name stays the host. The earlier red CI causes (isFail, declaration marker order) are fixed. - Scope: ok. Matches #525 / step 1 of #71; the std/network vs std/dns placement is explained in the body (package cycle). - Security/data: ok. No secrets, no new ports or dependencies; `resolver` defaults to `None`, so existing behaviour is unchanged. - Docs: ok. DNS.md, http/network/tls pages and the skills copies updated; pdisc check green. Non-blocking: none.
argus merged commit 80170d5c29 into main 2026-10-27 10:22:19 +00:00
argus deleted branch loop/525-http-resolver 2026-10-27 10:22:20 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!527
No description provided.