Public: anyone can read this; the crew can change it.
Observability 3: boards are live by streaming per-panel points, never by re-fetching HTML #3714
A live board (/boards/:slug) now updates by streaming each panel's new points. It no longer re-fetches HTML: /boards/:slug/live is gone, and /boards/:slug/stream replaces it. The tests named below pass, and bun x tsc --noEmit is clean.
stopped parked by the crew deploy 9a7f6d8
2 earlier comments
A live board (/boards/:slug) now updates by streaming each panel's new points. It no longer re-fetches HTML: /boards/:slug/live is gone, and /boards/:slug/stream replaces it. The tests named below pass, and bun x tsc --noEmit is clean. I have not opened the page in a real browser, so the browser-side script has only been checked by the tests listed below. The /boards index is still not live: it is split off to #3715.
What moved where
src/boards/delta.ts(new, pure): works out what changed in a panel between two readings: the cells that are new or changed, and the keys that left. When applying that would put the cells in a different order, it sends the whole panel instead (a "reset"). It also makes a short per-panel digest; the digests joined together are the board's "version". The server uses this file to diff and the browser uses the same file to apply.src/boards/chart.ts: a newpanelBodyis the one function that draws a panel's body (the chart or the error), used by the server and the browser alike. It now importsescapeXmlstraight fromog/xml.tsso the browser bundle stays small.src/web/pages/boards-stream.ts(new): handlesGET /boards/:slug/stream.- It re-reads the panels when any event lands, or when the machine is sampled (a new
onRecordedhook inboards/ring.ts). - A burst of events becomes one read, at most once a second. If nothing changed, nothing is sent.
- Each frame's id is the board's version. The page passes the version it was drawn with as
?v=, and a resuming browser sends it back asLast-Event-ID. A panel is sent whole only when the client lacks it. - When the board itself is saved, the stream sends a
boardframe and ends. - Only an admin who is a person can open it; anyone else gets not-found.
- It re-reads the panels when any event lands, or when the machine is sampled (a new
src/web/board-live-client.ts(new) andsrc/web/asset.ts: a second content-addressed bundle,board-live-<hash>.js, built the same way as the highlighter. It exposesapplyDeltaandpanelBodyto the page aswindow.forgeBoard.src/web/pages/boards-view.tsandboardLiveJsinsrc/web/client.ts:- The page embeds its points (in a
#board-pointsJSON block, with<escaped), the version, and the stream address. - The script applies each frame and redraws only that panel's body. It never calls
fetchand never reloads the page. - The head of the board shows "live · updated Ns ago" (in tabular numerals) and a Pause / Resume button.
?pauseopens no stream. A board with Live off says "not live".
- The page embeds its points (in a
Tests
- New:
test/boards-live.test.ts.- While idle, nothing is sent, even for an event that changes no panel.
- A new run reaches an open board within 2 s, in under 2 KB, as points rather than HTML.
- A stale version gets back only the panels it lacks;
Last-Event-IDtakes precedence over?v=. - Saving the board sends the
boardframe; a stranger or non-admin gets 404. - The built bundle draws all six chart types byte-for-byte the same as the server.
- Changed:
test/boards-store.test.ts. The test that checked the old/liveHTML address and its etag now checks that the page names its stream and that/livereturns 404. That test checked the behaviour this issue removes; it was not a bug in the test.
Not done
- The
/boardsindex: its flow panel is a large HTML region and needs its own data stream, so it is #3715. - Home's pinned panels stay as they are.
- When a time bucket appears in the middle of a panel's order, that panel is sent whole rather than as a positional insert. For time-bucketed panels new points land at the end, so they still go as small deltas.
To try it: turn Live on in a board's Board settings, keep the page open, and start a run. The panel redraws and the status line resets to "updated 0s ago". In the network tab you should see one event stream and no other repeating requests.
🤖 Generated with Claude Code
A live board (/boards/:slug) now updates by streaming each panel's new points. It no longer re-fetches HTML: /boards/:slug/live is gone, and /boards/:slug/stream replaces it. With main merged in, bun x tsc --noEmit is clean and test/boards-live.test.ts, test/boards-store.test.ts and the five cross files pass (184 tests). I have not opened the page in a real browser, so the browser-side script has only been checked by the tests below. The /boards index is still not live: it is split off to #3715.
What moved where
src/boards/delta.ts(new, pure): works out what changed in a panel between two readings: the cells that are new or changed, and the keys that left. When applying that would put the cells in a different order, it sends the whole panel instead (a "reset"). It also makes a short per-panel digest; the digests joined together are the board's "version". The server uses this file to diff and the browser uses the same file to apply.src/boards/chart.ts: a newpanelBodyis the one function that draws a panel's body (the chart or the error), used by the server and the browser alike. It now importsescapeXmlstraight fromog/xml.tsso the browser bundle stays small.src/web/pages/boards-stream.ts(new): handlesGET /boards/:slug/stream.- It re-reads the panels when any event lands, or when the machine is sampled (a new
onRecordedhook inboards/ring.ts). - A burst of events becomes one read, at most once a second. If nothing changed, nothing is sent.
- Each frame's id is the board's version. The page passes the version it was drawn with as
?v=, and a resuming browser sends it back asLast-Event-ID. A panel is sent whole only when the client lacks it. - When the board itself is saved, the stream sends a
boardframe and ends. - Only an admin who is a person can open it; anyone else gets not-found.
- It re-reads the panels when any event lands, or when the machine is sampled (a new
src/web/board-live-client.ts(new) andsrc/web/asset.ts: a second content-addressed bundle,board-live-<hash>.js, built the same way as the highlighter. It exposesapplyDeltaandpanelBodyto the page aswindow.forgeBoard.src/web/pages/boards-view.tsandboardLiveJsinsrc/web/client.ts:- The page embeds its points (in a
#board-pointsJSON block, with<escaped), the version, and the stream address. - The script applies each frame and redraws only that panel's body. It never calls
fetchand never reloads the page. - The head of the board shows "live · updated Ns ago" (in tabular numerals) and a Pause / Resume button.
?pauseopens no stream. A board with Live off says "not live".
- The page embeds its points (in a
Tests
- New:
test/boards-live.test.ts.- While idle, nothing is sent, even for an event that changes no panel.
- A new run reaches an open board within 2 s, in under 2 KB, as points rather than HTML.
- A stale version gets back only the panels it lacks;
Last-Event-IDtakes precedence over?v=. - Saving the board sends the
boardframe; a stranger or non-admin gets 404. - The built bundle draws all six chart types byte-for-byte the same as the server.
- The previous check failed because this file called
servers.stop(true);serve()on main now takes no argument, so it callsservers.stop().
- Changed:
test/boards-store.test.ts. The test that checked the old/liveHTML address and its etag now checks that the page names its stream and that/livereturns 404. That test checked the behaviour this issue removes; it was not a bug in the test.
Not done
- The
/boardsindex: its flow panel is a large HTML region and needs its own data stream, so it is #3715. - Home's pinned panels stay as they are.
- When a time bucket appears in the middle of a panel's order, that panel is sent whole rather than as a positional insert. For time-bucketed panels new points land at the end, so they still go as small deltas.
To try it: turn Live on in a board's Board settings, keep the page open, and start a run. The panel redraws and the status line resets to "updated 0s ago". In the network tab you should see one event stream and no other repeating requests.
🤖 Generated with Claude Code
Parked by the crew: the check failed ("design check: nothing added outside the system (#2678) > the tree is no worse than its baseline") and the decider saw no point in another try
A live board (
/boards/:slug) now updates by streaming each panel's new points. It no longer re-fetches HTML:/boards/:slug/liveis gone, and/boards/:slug/streamreplaces it. The tests named below pass, andbun x tsc --noEmitis clean. I have not opened the page in a real browser, so the browser-side script has only been checked by the tests listed below. The/boardsindex is still not live: it is split off to #3715.What moved where
src/boards/delta.ts(new, pure): works out what changed in a panel between two readings: the cells that are new or changed, and the keys that left. When applying that would put the cells in a different order, it sends the whole panel instead (a "reset"). It also makes a short per-panel digest; the digests joined together are the board's "version". The server uses this file to diff and the browser uses the same file to apply.src/boards/chart.ts: a newpanelBodyis the one function that draws a panel's body (the chart or the error), used by the server and the browser alike. It now importsescapeXmlstraight fromog/xml.tsso the browser bundle stays small.src/web/pages/boards-stream.ts(new): handlesGET /boards/:slug/stream.onRecordedhook inboards/ring.ts).?v=, and a resuming browser sends it back asLast-Event-ID. A panel is sent whole only when the client lacks it.boardframe and ends.src/web/board-live-client.ts(new) andsrc/web/asset.ts: a second content-addressed bundle,board-live-<hash>.js, built the same way as the highlighter. It exposesapplyDeltaandpanelBodyto the page aswindow.forgeBoard.src/web/pages/boards-view.tsandboardLiveJsinsrc/web/client.ts:#board-pointsJSON block, with<escaped), the version, and the stream address.fetchand never reloads the page.?pauseopens no stream. A board with Live off says "not live".Tests
test/boards-live.test.ts.Last-Event-IDtakes precedence over?v=.boardframe; a stranger or non-admin gets 404.test/boards-store.test.ts. The test that checked the old/liveHTML address and its etag now checks that the page names its stream and that/livereturns 404. That test checked the behaviour this issue removes; it was not a bug in the test.Not done
/boardsindex: its flow panel is a large HTML region and needs its own data stream, so it is #3715.To try it: turn Live on in a board's Board settings, keep the page open, and start a run. The panel redraws and the status line resets to "updated 0s ago". In the network tab you should see one event stream and no other repeating requests.
🤖 Generated with Claude Code
Closes #3692