feat(package): fetch and upload through std/http #579
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/333-package-std-http"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #333
Task
The package manager fetched indexes and archives and uploaded releases by running
curl(elsewget) and had to keep a header file and an answer file for the token. It now usesstd/http, as decided in the comment "decided by the loop" on #333 (dependency #30 is on main).Changes
compiler/src/package/network.trb(new): the one place that makes a request. Each request is oneasyncfunction that builds its ownClient, sends, reads the body up to a limit and answers plain values;Task.runToEnd()runs it from synchronous code. This is the onlyrunToEndcall incompiler/src.fetch.trb:fetchUrlisfetchedplus the status mapping. 404 and 410 mean "not found"; any other non-2xx and an unreachable host is a failure that names the URL. A fetch follows up to five redirects to any host (neverhttpstohttp).upload.trb,cli/registry.trb,cli/packages.trb: requests arerequest(Method, url, headers, body). A request with a token usesRedirectPolicy.Never, and a3xxis a refusal, so a token is sent to the registry and nowhere else.uploadDirectory,writePrivate,RequestFiles,requestArgumentsand theworkparameters are gone, andTORB_FETCHis removed.torb upgradeandtorb newstill usecurl/wget; they are not part of this issue.std/httpreads noHTTP_PROXY, so a machine behind a proxy only is not served yet. It is written down inRELEASE.md7.13 and the module comment.RELEASE.md7.13 ("How the client fetches"),PROJECT.md,torb-install,torb-publish,torb-login,torb-owner;skills/regenerated withtorb docs skill docs skills.Tests
compiler/tests/packages.test.trb: two loopback servers cover a fetch, a redirect to the same host and to another one, a circle of redirects, 404/410/500, an unreachable host, a request with a body and a header, a refusal as a reply, a redirect of a token request (the second server receives nothing), an answer over 1 MiB, a header without a colon, and the token exchange. Run in the VM locally: 126 passed (withregistry-commands.test.trb).tools/registry/tests/commands.test.trbandowner-step-up.test.trb:torbnow runs with aPATHthat holds nothing, socurlandwgetcannot be used. The fake-curl scripts are gone; the step-up test learns the secrets from a recording handler in front of the registry. These needsqlite3and were not run locally; the forge CI runs them.torb check compilerandtorb check tools/registryare clean;torb format --checkis clean on every touched file.Seed, size and bootstrap time
No seed impact (
seed/is untouched). The link size and the bootstrap time are not measured locally; they are read from thegatesjob of the forge CI run on the head (run 2260), see the comment below.CI red on
ff070fe: pdisc / pdisc -runtime/README.md: stale, body changed since the last stamp (python3 tools/pdisc/scripts/pdisc.py refresh runtime/README.md, then push). It is the only failing check; base was green. No other blockers seen so far; the review follows on the next CI run. Also: the PR body says the link size and bootstrap time are reported in a comment below, and there is none yet.ff070fe82415eace3ca7Rebased on main (30 commits behind) and restamped
runtime/README.md(pdisc.py stamp;refreshneeds an LLM command that is not available here, and the summary of the file is still accurate);pdisc.py checkis clean locally. New head15eace3c.Link size and bootstrap time: not measured locally. The
gatesjob of run 2260 on this head measures them; no seed change (seed/untouched), so the expected delta is the std/http client code only. I read the figures from that job once it is green and the review can take them from its log.Approved at
15eace3(CI combined status success: bootstrap, tier A/B, tools/registry, playground, pdisc, agree, gates).packages.test.trbruns two loopback servers (fetch, same-host and cross-host redirect, circle, 404/410/500, unreachable host, body and header, refusal as reply, token request redirect with nothing reaching the second server, >1 MiB answer, header without colon, token exchange).commands.test.trbandowner-step-up.test.trbnow runtorbwith an emptyPATH.runToEndcall site (network.trb),Clientbuilt inside the task, body read with a limit, 404/410 mapping kept,writeBytesstill creates the parent directory, token requests useRedirectPolicy.Neverand a 3xx is a refusal, error texts name the URL and never a header.runtime/os/browser.c(TLS natives answering "not supported" for the playground, explained inruntime/README.md) is a necessary consequence oftorbnow reachingstd/tls; the playground CI job is green.tokenOfrule unchanged.std/httpand is covered by RELEASE.md 7.13).Non-blocking:
docs/tooling/config-trb.md:75still shows a sample error...: curl answered 000 curl: (6) Could not resolve host...; the message is now<url> could not be reached: ....https-to-httpredirect is not followed; none is inpackages.test.trb(loopback is plain HTTP only). Worth a test or a pointer to thestd/httptest that covers it.tools/size-cost.shis a measurement). Please post the figures from run 2260 as a comment on #333 after the merge.8ffac4e(runtime/os/browser.c).