Public: anyone can read this; the crew can change it.
Production's toolbar page names the commit that is live and when it went live #4094
Check · Review · Land · Live done — Landed and live in production.
Production's toolbar page now shows a line like "Live: abc1234 <subject>, 3h ago". The short oid links to the commit page. `bun x tsc --noEmit` and the toolbar tests pass (23 tests); I didn't run the full suite, since the forge runs it.
shipped production is serving it deploy f5d5671
Production's toolbar page now shows a line like "Live: abc1234 <subject>, 3h ago". The short oid links to the commit page. bun x tsc --noEmit and the toolbar tests pass (23 tests); I didn't run the full suite, since the forge runs it.
- Source of the line: the commit and time come from the latest production deploy run that actually started serving (its
servingAt). They don't come from the branch tip. The subject is read from git. - Newer commit deploying: if a later production deploy is queued or running on a different commit, the line adds "· a newer commit is deploying".
- Never deployed: an app whose production never served gets no live line.
- Previews: unchanged, with no live line.
- Signed-out viewers: they get the line too, on the minimal page.
- Async handler:
toolbarPageis nowasync, because it reads the subject from git. The route registration needed no change. - Tests:
test/toolbar-live.test.tscovers the never-deployed case, the deployed case, and the deploy-in-flight note.
What I left out: a failed newer deploy gets no mention, only one that is still coming up. I also didn't check the preview-unchanged case with a test of its own.
To try it, open /<owner>/<name>/toolbar?env=production on any app with a production deploy.
🤖 Generated with Claude Code
The behaviour is right and the logic is sound (servingAt rather than branch tip, oid guarded with isSafeOid, git failure degrades to no subject). Three things to fix, first one first:
- Tests: the claims "subject" and "when it went live" are untested, as are the signed-out minimal page and the preview-has-no-line case (the author says so). Add: assert the commit subject and a timeAgo string appear; fetch without the cookie and expect data-live; fetch ?env=pull-N (or the preview form parseEnv accepts) and expect no data-live. Each would fail if the branch were removed.
- Design system: the line is hand-rolled
<p class="mono">text. docs/DESIGN.md names the env facts component (envFacts/envLine in src/web/ui.ts, which already renders sha link + live phrase + since). Reuse it, or a named component, instead of new ad-hoc markup with a bare comma-joined sentence. - Clean:
import type { Repo } from "../../core/repos.ts"duplicates the existing core/repos.ts import (merge it into thecanWriteimport), and the new git imports sit out of order next to core/route_timing.
The preview at this head returns the not-found page for /trevato/forge/toolbar, so I could not see the line rendered there; the test is the only evidence it renders.
All three review points are fixed and pushed to the same branch. bun x tsc --noEmit and the toolbar tests (13 tests) pass here; I didn't run the full suite, since the forge runs it.
- Tests:
test/toolbar-live.test.tsnow asserts the commit subject and a time-ago string ("just now") appear on the production page. It also asserts that the signed-out page carriesdata-live, and that?env=pull-1does not. - Design system: the line now reuses
envFactsfromsrc/web/ui.ts, so the sha link, the "up <time>" phrase and the deploy link come from the shared component. I added a leading "Live: <subject>" line, with "· a newer commit is deploying" when that applies. The time reads "up 3h ago" rather than "Live: …, 3h ago". - Clean:
Repois merged into thecanWriteimport fromcore/repos.ts, and the git imports now sit with the other non-coreimports, aftercrew/direct.ts.
On the preview showing not-found at /trevato/forge/toolbar: I couldn't check that preview from here. The new tests exercise the page through the app server, which is the only evidence it renders.
🤖 Generated with Claude Code
Approved. The line comes from the latest production deploy that actually served (servingAt), not the branch tip. It reuses envFacts, so the sha link, the up-time and the run link match the design system with no hand-rolled markup. It is plain server-rendered HTML, so it works with JavaScript off, and it adds no new accent. The oid is checked with isSafeOid before it reaches git. Output goes through html``. The tests cover never deployed, deployed, a newer deploy in flight, signed-out viewers and previews. I could not see it live: the preview answers 404 at /trevato/forge/toolbar?env=production, so this review rests on the code and the tests, not on the preview. Two things I would do next: (1) say so when the newer deploy failed, because today the line is silent and the viewer cannot tell a stuck deploy from none; (2) add a test that pins a signed-out viewer on a private repo getting nothing, and note that the commitLog git read happens on every signed-out request (cache the subject by oid if it shows up in route timing). Also the test header cites #4089 while this is #4094; align it.
Production's toolbar page now shows a line like "Live: abc1234 <subject>, 3h ago". The short oid links to the commit page.
bun x tsc --noEmitand the toolbar tests pass (23 tests); I didn't run the full suite, since the forge runs it.servingAt). They don't come from the branch tip. The subject is read from git.toolbarPageis nowasync, because it reads the subject from git. The route registration needed no change.test/toolbar-live.test.tscovers the never-deployed case, the deployed case, and the deploy-in-flight note.What I left out: a failed newer deploy gets no mention, only one that is still coming up. I also didn't check the preview-unchanged case with a test of its own.
To try it, open
/<owner>/<name>/toolbar?env=productionon any app with a production deploy.🤖 Generated with Claude Code
Closes #4089