feat(ci): live CI page — fleet event stream, live test results, in-flight first #552

Merged
gmackie merged 1 commit from feat/ci-row-app-and-pr-first into main 2026-09-04 18:56:06 +00:00
Owner

Makes /ci a live view of current work. Three parts: a layout that puts in-flight work first, a fleet-wide event channel, and live test results that actually arrive.

Layout

Three zones, because the page answers three questions and only two are urgent.

  • In flight gets cards, a status rail, and a clock ticking against the pipeline's median duration. The rail stops at 94% and the label flips to over ~8:00 rather than implying a completion it cannot know. A queued run gets no clock, just waiting for a runner.
  • Just landed keeps cards and the outcome rail at a smaller scale.
  • Earlier is a plain ledger. It is the part you scan, not the part you look at.

Identity (app + PR, or the branch when there is no PR) is one shared component across all three, so the same two fields lead everywhere and only the type scale changes.

Fleet channel

Every existing broadcast is addressed to pipeline:<appId>. That is right for an app's Pipeline tab and unusable for /ci, which would need a socket per app across 77 of them. Queued and running Forgejo run progress now also goes to ci:fleet, stamped with the app it came from so a fleet consumer can attribute it.

Live test results — why they never worked

The agent already tails the build worktree's .fg/check-events.ndjson and posts a folded summary every couple of seconds. That already fanned out on apps/web's eventBus, whose own comment says it only works:

because ForgeGraph runs as a single instance

That stopped being true when the control plane moved to Cloudflare Workers. Each request can land in a different isolate, so the isolate receiving the agent's POST is almost never the one holding a browser's SSE connection. The publish succeeded and nobody was listening.

Test progress now also goes over the hub, which is a real cross-instance broker and already carries pipeline events. The eventBus publish stays, because fg watch consumes it.

Consumption

useFleetCiStream subscribes to the one fleet channel. LiveRefresh treats an event as a hint to look, not as data: it re-runs the server render, so every number moves together. A partial live-patch would let the header disagree with the list, which on a status page is worse than being a second late.

  • Bursts are coalesced — test progress is roughly every 2s per running build.
  • A hidden tab disconnects entirely and refreshes once on return.
  • Polling takes over whenever the hub is unreachable, so the page degrades to exactly its previous behaviour rather than going silent. The indicator reads live / polling / paused so the mode is never a guess.

What I found and did not ship

handlers/workflow-run.ts maps a requested run to a queued build and is wired and correct — and cannot fire on this install. Forgejo 15.0.7 has no workflow_run webhook event; a PATCH containing one returns 200 and silently drops it (I probed workflow_run, workflow_job, action_run, actions, status). I wrote and tested a webhook-convergence fix before discovering this and reverted it, because it would have added an event Forgejo discards. That is why the builds table shows a near-empty queue while Forgejo has runs waiting, and it is worth its own decision rather than being buried here.

Verification

packages/api and apps/web typecheck clean. next build succeeds and emits the /ci client-reference manifest. 42 tests pass across the lib suites, including 5 new ones asserting both channels receive run progress and test progress, that the fleet copy carries appId, that an unconfigured hub sends nothing, and that an unreachable hub never rejects the request that produced the event. oxlint reports nothing new on the changed files.

Stacking

Built on fix/runner-label-parsing (#551). Merge that first.

🤖 Generated with Claude Code

Makes `/ci` a live view of current work. Three parts: a layout that puts in-flight work first, a fleet-wide event channel, and live test results that actually arrive. ## Layout Three zones, because the page answers three questions and only two are urgent. - **In flight** gets cards, a status rail, and a clock ticking against the pipeline's median duration. The rail stops at 94% and the label flips to `over ~8:00` rather than implying a completion it cannot know. A queued run gets no clock, just *waiting for a runner*. - **Just landed** keeps cards and the outcome rail at a smaller scale. - **Earlier** is a plain ledger. It is the part you scan, not the part you look at. Identity (app + PR, or the branch when there is no PR) is one shared component across all three, so the same two fields lead everywhere and only the type scale changes. ## Fleet channel Every existing broadcast is addressed to `pipeline:<appId>`. That is right for an app's Pipeline tab and unusable for `/ci`, which would need a socket per app across 77 of them. Queued and running Forgejo run progress now also goes to **`ci:fleet`**, stamped with the app it came from so a fleet consumer can attribute it. ## Live test results — why they never worked The agent already tails the build worktree's `.fg/check-events.ndjson` and posts a folded summary every couple of seconds. That already fanned out on `apps/web`'s `eventBus`, whose own comment says it only works: > because ForgeGraph runs as a single instance **That stopped being true when the control plane moved to Cloudflare Workers.** Each request can land in a different isolate, so the isolate receiving the agent's POST is almost never the one holding a browser's SSE connection. The publish succeeded and nobody was listening. Test progress now also goes over the hub, which is a real cross-instance broker and already carries pipeline events. The `eventBus` publish stays, because `fg watch` consumes it. ## Consumption `useFleetCiStream` subscribes to the one fleet channel. `LiveRefresh` treats an event as **a hint to look, not as data**: it re-runs the server render, so every number moves together. A partial live-patch would let the header disagree with the list, which on a status page is worse than being a second late. - Bursts are coalesced — test progress is roughly every 2s per running build. - A hidden tab disconnects entirely and refreshes once on return. - Polling takes over whenever the hub is unreachable, so the page degrades to exactly its previous behaviour rather than going silent. The indicator reads `live` / `polling` / `paused` so the mode is never a guess. ## What I found and did not ship `handlers/workflow-run.ts` maps a `requested` run to a queued build and is wired and correct — and **cannot fire on this install**. Forgejo 15.0.7 has no `workflow_run` webhook event; a PATCH containing one returns 200 and silently drops it (I probed `workflow_run`, `workflow_job`, `action_run`, `actions`, `status`). I wrote and tested a webhook-convergence fix before discovering this and reverted it, because it would have added an event Forgejo discards. That is why the `builds` table shows a near-empty queue while Forgejo has runs waiting, and it is worth its own decision rather than being buried here. ## Verification `packages/api` and `apps/web` typecheck clean. `next build` succeeds and emits the `/ci` client-reference manifest. 42 tests pass across the lib suites, including 5 new ones asserting both channels receive run progress and test progress, that the fleet copy carries `appId`, that an unconfigured hub sends nothing, and that an unreachable hub never rejects the request that produced the event. `oxlint` reports nothing new on the changed files. ## Stacking Built on `fix/runner-label-parsing` (#551). Merge that first. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
gmackie force-pushed feat/ci-row-app-and-pr-first from bf1ea8e7fe
Some checks failed
CI / gitleaks (pull_request) Successful in 6s
CI / storybook (pull_request) Successful in 1m36s
CI / ci (pull_request) Has been cancelled
to f6e9ca42d2
All checks were successful
CI / gitleaks (pull_request) Successful in 6s
CI / storybook (pull_request) Successful in 1m48s
forgegraph/ci CI passed
CI / ci (pull_request) Successful in 9m3s
2026-09-04 16:22:45 +00:00
Compare
gmackie changed title from feat(ci): lead each CI row with the app and PR, not the pipeline name to feat(ci): give in-flight and just-landed runs the page, demote history 2026-09-04 16:23:08 +00:00
gmackie force-pushed feat/ci-row-app-and-pr-first from f6e9ca42d2
All checks were successful
CI / gitleaks (pull_request) Successful in 6s
CI / storybook (pull_request) Successful in 1m48s
forgegraph/ci CI passed
CI / ci (pull_request) Successful in 9m3s
to 35940f0fc7
Some checks failed
CI / gitleaks (pull_request) Successful in 8s
CI / storybook (pull_request) Successful in 1m14s
CI / ci (pull_request) Has been cancelled
2026-09-04 18:15:40 +00:00
Compare
gmackie force-pushed feat/ci-row-app-and-pr-first from 35940f0fc7
Some checks failed
CI / gitleaks (pull_request) Successful in 8s
CI / storybook (pull_request) Successful in 1m14s
CI / ci (pull_request) Has been cancelled
to 1189df575a
Some checks failed
CI / gitleaks (pull_request) Successful in 6s
CI / storybook (pull_request) Successful in 1m56s
forgegraph/ci CI failed
CI / ci (pull_request) Failing after 7m54s
2026-09-04 18:21:11 +00:00
Compare
gmackie changed title from feat(ci): give in-flight and just-landed runs the page, demote history to feat(ci): live CI page — fleet event stream, live test results, in-flight first 2026-09-04 18:21:31 +00:00
gmackie force-pushed feat/ci-row-app-and-pr-first from 1189df575a
Some checks failed
CI / gitleaks (pull_request) Successful in 6s
CI / storybook (pull_request) Successful in 1m56s
forgegraph/ci CI failed
CI / ci (pull_request) Failing after 7m54s
to 96444cac4c
Some checks failed
CI / gitleaks (pull_request) Successful in 8s
CI / storybook (pull_request) Has been cancelled
CI / ci (pull_request) Has been cancelled
2026-09-04 18:40:12 +00:00
Compare
gmackie changed target branch from fix/runner-label-parsing to main 2026-09-04 18:40:36 +00:00
gmackie force-pushed feat/ci-row-app-and-pr-first from 96444cac4c
Some checks failed
CI / gitleaks (pull_request) Successful in 8s
CI / storybook (pull_request) Has been cancelled
CI / ci (pull_request) Has been cancelled
to 3070c319f3
All checks were successful
CI / gitleaks (pull_request) Successful in 10s
CI / storybook (pull_request) Successful in 2m38s
forgegraph/ci CI passed
CI / ci (pull_request) Successful in 12m48s
2026-09-04 18:40:50 +00:00
Compare
Sign in to join this conversation.
No description provided.