web: std/web core (WEB slice 2) #94
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Context
Handler,WebApp,web { }, middleware,WebError, response helpers,WebTest. This is an epic: it is a new package with an error type, an application builder, a middleware chain, request and response helpers, a test helper and an example application, which is more than one PR. Steps become issues just in time, one at a time.Source
Design record point
WEB.md sections 3.1 to 3.4, 3.8, 3.9, slice 2 of section 10, decisions D5 and D13. Decided by the loop (full reasoning in the comment below):
std/web;RequestandResponsearestd/http's shared types, extended byextend, not redefined.TemplateRoutesofstd/uri, not the hand-writtenmatchof the section 3.2 example.WebTest.assertRoutesis the round trip overTemplateRoutes.linkandmatched.request.query<Value>()goes with the form-urlencodedDecoderof #97; slice 2 ships the raw query accessors. Cookies andwithCookieare #98,assetsis #100, the HTML page reader ofWebTestwaits on the tree of #79.Steps
std/webpackage:WebError,Handler, the request and response helpers, docs page (filed as #575)Middleware,Next,WebApp, theweb { }builder (wrap,handle,errors), the adapter tostd/http's handler,app.answer(request); a conformance probe for the record-carrying-a-function question of WEB.md section 8WebTest:Request.get,Request.post(form:),assertRoutes; the answered page checked as text until #79's tree existsexamples/web-shop: the orders pages onstd/html, routes by URI template, a request-log middleware, tests throughapp.answer, docs updated, WEB.md slice 2 marked builtDependencies
std/httpRequest/Response/Handler(onmain),std/uriTemplateRoutes(onmain).std/live).Moved from the planning lists of the docs; the design record stays the specification.
std/livepage placement and the client script (WEB slices 6 and 7) #103std/htmlmarkup (WEB slice 1) #93[loop:torbscript] intake: in scope (author orion, label loop), source WEB.md slice 2, not a duplicate. Large (
Handler,WebApp,web { }block, middleware,examples/web-shop); refine splits it. Depends on #93. next: waiting (dependency #93) until 2026-10-10T04:00:00Zstd/livepage placement and the client script (WEB slices 6 and 7) #103std/htmlmarkup (WEB slice 1) #93101 Switching Protocolsand a duplex connection (NETWORK slice 14) #74[loop:torbscript] claim refine by session:loop-torbscript-20261029 until 2026-10-29T10:20Z
std/webpackage:WebError,Handlerand the request and response helpers (step 1 of #94) #575[loop:torbscript] decided by the loop: #94 is too big for one PR, so it is an epic and stays without
ready. The slice names a package, an error type, an application builder with a block, a middleware chain over a trait, request and response helpers, a test helper and an example application; four reviewable pieces, each needing the previous. Step 1 is filed as #575 (keyword search of open issues for web, Handler, std/web, WebTest, middleware found only the sibling slices #97, #98, #99, #100, #103, #105, #107, #108, #109, none a duplicate) and isready; steps 2 to 4 are filed just in time. The dependency #93 is closed, so the earlier waiting note is obsolete; problem 3 of WEB.md section 1 (the generated C for a trait method answering a task) is fixed byacf9360f, held bytests/conformance/task-member-value-parameter.trb.Decisions:
RequestandResponsestaystd/http'sshared types. WEB.md section 9 assumed values (a middlewarecopys a request, a participle answers a copy). They own a one-shot body stream, so: a middleware that changes the request builds a newRequestfrom the parts of the old one and takes its body over;withStatus/withHeaderanswer a newResponseover the sameBody, and the old binding is not read afterwards. Step 1 documents this, tests it, and adds a "Built" note to WEB.md section 3.4.std/http:Request.segments()(percent-encoded) andResponse.jsonOfstay;std/webaddsdecodedSegments()and usesjsonOf.Handlerofstd/webis its own type (Result<Response, WebError>) and is not a re-export ofstd/http's; programs needing both qualifystd/http.matchof WEB.md section 3.2, which that section's example predates.WebTest.assertRoutes(routes, samples)checksmatched(link(sample)) == samplefor each sample; the startup check already lives inTemplateRoutes.of.request.query<Value: Decode>()moves to #97. It needs a form-urlencodedDecoder, which the forms slice builds anyway forrequest.form; building it here would be that slice's work in this one. Slice 2 getsqueryParameters()andqueryParameter(name)overString.formDecoded(std/uri).request.json,request.cookie,withCookieandassetsfollow with #97, #98, #100.WebTest's page reader (page.text("h1")) waits for #79's tree (steps 2 to 4 of that epic). Until then tests read the markup withhtml.text()and string checks; step 3 notes this, no new issue.testbody cannot await yet (F13). Handler tests arefns answering aTaskthat the test file awaits at its top level, as WEB.md section 3.9 says.assetsis not inWebApp's vocabulary in slice 2 (#100 adds it); the receiver starts withwrap,handle,errors.Nextcarryingendpoint: Handleris refused by the task capture rule (WEB.md section 8, "one question for the checker"), step 2 makesendpointa trait value, as the record says, and records the result; the conformance probe is part of step 2.[loop:torbscript] refine: released the claim of session:loop-torbscript-20261029. #94 is an epic (checklist of 4 steps in the body), step 1 filed as #575 with label
ready; the decisions are in the comment above. Nothing was written to the repo. Worker usage: about 120k tokens (sonnet).next: waiting (epic waits on its steps)