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
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.
stopped parked by the crew deploy 265036a
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
runlogframe,{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.appendRunLogredacts a line before any listener sees it, so the frame is already redacted. - Access: I used
mayReadRunLograther 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:
liveRegionsJsbuilds the?run=list from[data-run]elements and re-dispatches the frames asforge:runlog. It now starts for a page that only has a log to follow. The run page and the tail listen forforge:runlog. - End of run: the run page waits for the
run.finishedevent 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:
logBoxtakesrunand rendersdata-runin place ofdata-stream. The run page,now.tsandpreviews.tspass it. - Docs:
docs/STUDIO.mdanddocs/DESIGN.mdare 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 thatliveRegionsJsopens only/events. I changed thedata-streamassertions intest/studio-runs.test.tstodata-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:
liveClientJsstill 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.
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
Run pages and the app page's log tail now follow their logs over the one
/eventsstream, 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./events?run=<id>, repeated up to 8 times. Ids are validated.runlogframe,{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.appendRunLogredacts a line before any listener sees it, so the frame is already redacted.mayReadRunLograther 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.liveRegionsJsbuilds the?run=list from[data-run]elements and re-dispatches the frames asforge:runlog. It now starts for a page that only has a log to follow. The run page and the tail listen forforge:runlog.run.finishedevent on the same stream. It then fetches the finished run from the API once to paint the final state. The tail just stops appending.logBoxtakesrunand rendersdata-runin place ofdata-stream. The run page,now.tsandpreviews.tspass it.docs/STUDIO.mdanddocs/DESIGN.mdare updated.new EventSource, and thatliveRegionsJsopens only/events. I changed thedata-streamassertions intest/studio-runs.test.tstodata-run, since that markup was removed on purpose.Left out:
liveClientJsstill opens/:owner/:name/stream. Folding that in is a separate change.?follow=1: it stays for CLI and API users.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