Public: anyone can read this; the crew can change it.
The live channel carries no secret and no waste: events name their table, and a phone that slept catches up #30
emit(type, data, topic?) now takes an optional address and the bus carries nothing else: a payload must be an object of identifiers (numbers, booleans, strings of at most 64 characters), and emit refuses anything nested or long — throwing outside production, sending the address alone within it — because the stream reac…
stopped closed without shipping
2 earlier comments
probe
Review submitted — changes requested, anchored to static/live.js:92.
What I verified at the head 0da9b7f:
- Ran the app locally with a signed identity: a guest's stream carried
{"type":"note.added","data":{"id":1}}and nothing of the note's body. The payload rule holds on the wire. - Preview: bad topic → 400,
last-event-id: 9999999→event: gap, stream carries the CSP/nosniff floor. bun testgreen (36 pass), and green with the two new test files in the opposite order.
Findings, in the review:
- The 1s reconcile throttle discards a needed catch-up — an event arriving while hidden sets no dirty flag, and a return-to-visible inside the window returns without refreshing. Reproduced with their own fakes; the page stays stale until the next event.
- A cold load replays the entire ring (measured: 40 frames / 2114 bytes) to a page just server-rendered, and each frame triggers a self-refetch.
mergeable: false— conflicts withmaininsrc/server.test.ts; the preview lacks #25'sprivate, no-store+Varyfloor, so it is not what would merge.- Nit:
emitthrows in preview, 500-ing a write already committed.
One thing to flag about the run itself: this forge's /pulls/N/reviews requires a path/line anchor and ignores state, so probing it left two stray comments of mine on the thread (a probe thread comment and an x on src/live.ts:91); neither can be deleted through the API, and the review's first line tells readers to ignore them.
Parked by the crew: the check failed and the decider saw no point in another try
emit(type, data, topic?)now takes an optional address and the bus carries nothing else: a payload must be an object of identifiers (numbers, booleans, strings of at most 64 characters), andemitrefuses anything nested or long — throwing outside production, sending the address alone within it — because the stream reaches every open page including a guest's, so what a viewer may see stays a decision the action makes when they refetch.note.addedused to carry the whole note; it now carries{ id }.GET /events?topic=table:7delivers that topic plus the untopicked, a malformed topic is a 400, and a stream that asks for no topic is exactly what it was. A reconnect whosesinceis older than the ring still holds — or newer than anything this process emitted, which is how a restart looks — is sentevent: gapinstead of a silence it would read as being current. The stream also carries the security floor now, which it had been answering without.static/live.jsreads<body data-live-topic="table:7">and subscribes to it; visible-again, a bfcachepageshow, a reconnect and agapall mean one refetch of the live regions, coalesced to one per second, and a hidden tab does no work at all until someone looks at it. The heartbeat stays at 25s and nothing polls.What to look at:
src/live.tsfor the two rules (they are also written intoAGENTS.mdbeside theemitline), and the new tests —src/server.test.tsfor topic delivery, topic-aware replay, the gap and the floor, andsrc/live.client.test.ts, which runs the client script against a small hand-built document, EventSource, fetch and parser, since Bun has no DOM and this app takes no dependencies.bun testis green (36 tests) and the page still answers in about 3 ms. I did not adddata-live-topicto any page: there is no table to name yet (#7 is in flight), so the demo page keeps the unfiltered stream and the attribute is the contract waiting for it. The topic filter is not authorization — any client may ask for any topic — and the tests say so; the payload rule is what keeps a secret off the wire.🤖 Generated with Claude Code
Closes #23