web: std/live page placement (WEB slice 6) and the client script (slice 7) #103
Labels
No labels
loop
queue/failed
queue/queued
ready
status/parked
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
torbscript/language#103
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
The live UI's protocol (WEB slice 6) and its one JavaScript file (WEB slice 7). The two slices do not fit one PR (the protocol is the highest-risk part of the web framework; the script is a second language and a second test platform), so this issue is an epic: step 1 is the work of this issue, step 2 is filed when step 1 has landed.
Source
Dependencies
std/webcore). Step 1 starts only after #777 (Middleware,Next,WebApp,web { },answer) has merged:LiveTestbuilds onWebTest, and the live endpoint is aHandler.std/html(#93) and F7 (HMAC-SHA256,Digest.equalsConstantTime) are done.Steps
std/live, page placement (slice 6)Step 1: goal
A
type X with Live<Message>renders as a complete HTML page with a live region and answers events over an HTTPPOSTthat carries the model in a signed snapshot. No connection, no session state between events (WEB.md 6.4, 6.5).Step 1: acceptance criteria
std/liveexportsLive<Message>,Effect(Effect.none(),Effect.task),fragment-based views typed byHtml<Message>, and a generic live endpoint that findsMessagethrough the trait bound (F3, #101), not through a type argument written by the caller.update; run the effects to their answer within a time limit, applying each message; render the new view; answer the parts whose hash differs fromhashesplus the new snapshot (WEB.md 6.4).data-live,data-snapshot,data-build,data-part,data-hash,data-on-*,data-debounce), thePOSTbody and answer,{ "reload": true }for a different build. Handler indexes are positions in the handler table, never strings of code.WebErrorstatus (4xx), never a panic; a forged message is impossible by construction. Signing is HMAC-SHA256 over the encoded model with an application-supplied key (std/digest); no new native, no random source.Encode & Decode(derived); a model that is not fails at compile time with the checker's own message, covered by a conformance test.LiveTest(in thestd/livetest module, besideWebTest): renders a page, posts an event by handler position, returns the parts and the next model; tests for the search example of WEB.md 6.1 (typed, found, cleared), a build mismatch, a forged snapshot, a superseded effect.examples/gets the search page as a small live example served throughweb { }(only if #777 has the example scaffold; otherwise the test is the example).Middleware-level hook so slice 3 plugs in without a protocol change.docs/design/WEB.mdslice 6 marked done with the PR/commit reference,std/livedocumented,skills/regenerated.Step 2 (filed later): goal and criteria (slice 7)
EmbeddedTextofstd/live, served as a fingerprinted asset (needs slice 5assets, or the file served by the live endpoint itself until then, decided when filed): forwards events withdebounce, posts them, appliespartsby morphing, keeps the snapshot, marksdata-loadingwhile a request is in flight, reloads on{ "reload": true }, keeps what the user typed while the answer is in flight, runsClient.toggle-style commands without a round trip.Seed impact
None expected: pure
std/TorbScript over existing natives (std/digest,std/json,std/task). No syntax change, no new native, no driver flag. A std name the compiler looks up by string must not be added; if the implementer finds one is needed, stop and say so in the PR (two-commit rule, seed refresh is Torben's).Size
One PR, two Conventional Commits: (1)
feat(std/live): Live, Effect, handler table, parts and hashes, LiveTest(2)feat(std/live): snapshots and the POST protocol. If it does not fit, split at that line and file the second commit as its own issue.Moved from the planning lists of the docs; the design record stays the specification.
Htmlliterals and static/dynamic diffs (WEB slice 9, F1) #108std/htmlmarkup (WEB slice 1) #93[loop:torbscript] intake: in scope (author orion, label loop), source WEB.md slices 6 and 7, not a duplicate. Two slices, one of them ships a JavaScript file with a browser test (CI platform question for refine). Depends on #94 and #101. next: waiting (dependencies #94 and #101) until 2026-10-10T04:00:00Z
Htmlliterals and static/dynamic diffs (WEB slice 9, F1) #108std/htmlmarkup (WEB slice 1) #93std/webcore (WEB slice 2) #94std/webcore (WEB slice 2) #94Middleware,Next,WebApp, theweb { }builder andapp.answer(step 2 of #94) #776[loop:torbscript] claim refine by session:loop-torbscript-20261114 until 2026-11-14T06:00:00Z
web:to web:std/livepage placement and the client script (WEB slices 6 and 7)std/livepage placement (WEB slice 6) and the client script (slice 7)[loop:torbscript] decided by the loop: CI platform for the slice 7 browser test. Forge CI (.forgejo/workflows/gates.yml) runs on one
ubuntu-latestrunner; the only JavaScript runtime is the pinned Node.js 24.21.0 (.forgejo/actions/node, used byconformance-jsand the editor tests); the emscripten job runs node too. There is no browser, no WebDriver and no DOM library (jsdom, happy-dom) anywhere in CI or tools/, and the repo has no npm dependency flow for tests. Decision: the slice 7 "browser test" is a Node test (node --test, like.forgejo/scripts/*.test.mjs) that runs the client script against a small in-repo DOM double covering only what the script touches (element tree, attributes,fetch, timers for debounce,location.reload), driven through the real example search page rendered byLiveTest/the live endpoint. Why: no new job image, no download of a browser, no external or hosted browser service (which would be a cost/account matter for Torben), deterministic, minutes of CI. A real-browser run stays a possible later addition if the double proves too weak; not needed for v1.decided by the loop: #103 is an epic of two steps (slice 6 protocol, slice 7 script); step 1 is this issue and ships as one PR of two commits, step 2 is filed just in time after step 1 lands. CSRF verification stays in slice 3; no seed impact expected (pure std/ code over existing natives).
[loop:torbscript] refine: issue body rewritten to the definition of ready for step 1 (slice 6: goal, testable criteria, design points WEB.md 6.1/6.4/6.5, seed impact none, size one PR / two commits); step 2 (slice 7) is a checklist item with its criteria, filed when step 1 landed; browser-test platform decided above (Node + in-repo DOM double). Startable once #777 (std/web core step 2) has merged; label
readyset on that basis. Claim 12351 released. next: implement (ready, after #777 merged)[loop:torbscript] refine: this issue is an epic (step 1 slice 6, step 2 slice 7), so it loses
ready; step 1 is filed as its own ready issue just in time once PR #777 has merged. next: waiting (dependency #776)Htmlliterals and static/dynamic diffs (WEB slice 9, F1) #108[loop:torbscript] refine: the dependency is met (#776 closed, PR #777 merged), so step 1 (slice 6) can be filed as its own ready issue. The ready buffer holds 4 (#836, #620, #565, #365), so it is filed when fewer than 4 issues are ready. next: waiting (ready buffer full)