Public: anyone can read this; the crew can change it.

Run logs and the app page patch from the one /events stream, not their own EventSources #2836

Parked opened this
Closed without merging

Run pages and the app page's log tail now follow their logs over the one /events stream, so those scripts open no EventSource of their own. I left the mirror checklist alone. The type check and the run-log, studio-runs, studio-shipping, accounts and SSE-related tests pass.

Notes

stopped parked by the crew deploy 265036a

opened this

Run pages and the app page's log tail now follow their logs over the one /events stream, so those scripts open no EventSource of their own. I left the mirror checklist alone. The type check and the run-log, studio-runs, studio-shipping, accounts and SSE-related tests pass. The forge's full check hasn't run yet.

  • Request: a page asks for its runs with /events?run=<id>, repeated up to 8 times. Ids are validated.
  • Frame: each line arrives as a runlog frame, {run, line}, with no id and no replay. A reader that is behind skips lines rather than queueing them, and a late tab reads the file. appendRunLog redacts a line before any listener sees it, so the frame is already redacted.
  • Access: I used mayReadRunLog rather than plain repo read, because a public repo's run log is writers and crew only (#1075). It is checked once per run per connection, and a stranger gets nothing.
  • Clients: liveRegionsJs builds the ?run= list from [data-run] elements and re-dispatches the frames as forge:runlog. It now starts for a page that only has a log to follow. The run page and the tail listen for forge:runlog.
  • End of run: the run page waits for the run.finished event on the same stream. It then fetches the finished run from the API once to paint the final state. The tail just stops appending.
  • Markup: logBox takes run and renders data-run in place of data-stream. The run page, now.ts and previews.ts pass it.
  • Docs: docs/STUDIO.md and docs/DESIGN.md are updated.
  • Tests: one writer test checks the frame arrives redacted, has no id, and that listeners are released afterwards. The same test checks a stranger and an unrequested run get nothing. Another checks the run and tail scripts contain no new EventSource, and that liveRegionsJs opens only /events. I changed the data-stream assertions in test/studio-runs.test.ts to data-run, since that markup was removed on purpose.

Left out:

  • Mirror checklist: it streams a per-user job, not a run log, so it has no frame to ride. It still opens its own stream.
  • App page's per-repo stream: liveClientJs still opens /:owner/:name/stream. Folding that in is a separate change.
  • API ?follow=1: it stays for CLI and API users.
  • Lines during a reconnect: a line written between the server render and the stream connecting, or during a reconnect, is not replayed.

To try it, open a running run's page, or an app page while it deploys. The network panel shows a single /events?run=… stream and lines appearing live.

Closes #2835

commented

Run pages and the app page's log tail now follow their logs over the one /events stream, so those scripts open no EventSource of their own. I left the mirror checklist alone. The type check and the run-log, studio-runs, studio-shipping, accounts and SSE-related tests pass. The forge's full check hasn't run yet.

  • Request: a page asks for its runs with /events?run=<id>, repeated up to 8 times. Ids are validated.
  • Frame: each line arrives as a runlog frame, {run, line}, with no id and no replay. A reader that is behind skips lines rather than queueing them, and a late tab reads the file. appendRunLog redacts a line before any listener sees it, so the frame is already redacted.
  • Access: I used mayReadRunLog rather than plain repo read, because a public repo's run log is writers and crew only (#1075). It is checked once per run per connection, and a stranger gets nothing.
  • Clients: liveRegionsJs builds the ?run= list from [data-run] elements and re-dispatches the frames as forge:runlog. It now starts for a page that only has a log to follow. The run page and the tail listen for forge:runlog.
  • End of run: the run page waits for the run.finished event on the same stream. It then fetches the finished run from the API once to paint the final state. The tail just stops appending.
  • Markup: logBox takes run and renders data-run in place of data-stream. The run page, now.ts and previews.ts pass it.
  • Docs: docs/STUDIO.md and docs/DESIGN.md are updated.
  • Tests: one writer test checks the frame arrives redacted, has no id, and that listeners are released afterwards. The same test checks a stranger and an unrequested run get nothing. Another checks the run and tail scripts contain no new EventSource, and that liveRegionsJs opens only /events. I changed the data-stream assertions in test/studio-runs.test.ts to data-run, since that markup was removed on purpose.

Left out:

  • Mirror checklist: it streams a per-user job, not a run log, so it has no frame to ride. It still opens its own stream.
  • App page's per-repo stream: liveClientJs still opens /:owner/:name/stream. Folding that in is a separate change.
  • API ?follow=1: it stays for CLI and API users.
  • Lines during a reconnect: a line written between the server render and the stream connecting, or during a reconnect, is not replayed.

To try it, open a running run's page, or an app page while it deploys. The network panel shows a single /events?run=… stream and lines appearing live.

commented

Parked by the crew: the check failed ("the map, per app and across the forge > the drawing is a live region scoped to its repository, fits, and pans") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs