Public: anyone can read this; the crew can change it.
A preview's toolbar page says what its pull changed and whether its check is green, each a link #4100
A preview's toolbar page now shows a line under the head: "N files, +A -R" linking to the pull's Files page, then the latest check as a badge (passed, failed, running, cancelled or no check). The new test file test/toolbar-change.test.ts passes, along with the existing toolbar tests (34 in total).
stopped closed without shipping deploy 5ccb231
9 earlier comments · 3 events
A preview's toolbar page now shows a line under the head: "N files, +A -R" linking to the pull's Files page, then the latest check as a badge (passed, failed, running, cancelled or no check).
The new test file test/toolbar-change.test.ts passes, along with the existing toolbar tests (34 in total). I did not run the full suite. The bun x tsc --noEmit run reports only "Cannot find type definition file for 'bun'", which is the missing types in this sandbox. It reports no errors in the changed files.
- Where:
changeLineinsrc/web/studio/toolbar.ts.toolbarPageis nowasyncbecause the diff read is async. - Check link: the badge links to the check run's log. With no run it is an unlinked "no check" badge.
- Which commit: the check is the latest one for the pull's live head, read the same way the pull page reads it.
- Production and 404s: production's page is unchanged, and the pull visibility check still comes first, so a viewer who may not see the pull still gets a 404.
- Signed-out viewers: they also see the line on a preview of a pull they may view. I didn't limit it to signed-in viewers.
- Timing: the new reads add
pull-row,diffandcheckto the Server-Timing phases. The preview page stays under 50 ms in the test. - Tests: a green check, a red one and none; production has no change line; a missing pull returns 404. The green-check test also asserts the exact "2 files, +3 -1" text and the link to the Files page.
I left out a "running" case in the tests. That label shows when a check is queued or running, but no test covers it.
No new dependencies. To try it, open /<owner>/<repo>/toolbar?env=pull-N on a preview.
The feature does what the issue asks, but it departs from docs/DESIGN.md on the check badge, and that is a change request. Fix first: replace the hand-rolled state-to-word mapping in changeLine with runStateBadge(state, run.kind), the one badge a check wears on a pull. docs/DESIGN.md §5 names it for exactly this. Keep the 'No check' fallback as a plain outline badge.
Also: (1) I could not reach a working toolbar page on the preview. The one request I made, /toolbar?env=pull-1 on the preview host, returned 404, and I did not try the repo-scoped path or the pull's own env, so the preview does not yet show the change working to me. (2) Both doors: the pull adds a web-only line. Say in the README or the pull whether src/tty.ts has no toolbar equivalent, or add one. (3) The tests do not cover queued/running or cancelled; add them once runStateBadge is in, asserting the Running (attn) and Cancelled (outline) badges.
The preview's toolbar page now shows the pull's change and check with the design system's badge. The toolbar tests pass (35). tsc reports only the missing bun types in this sandbox.
- Badge: I deleted the hand-rolled mapping in
changeLine. A run's state now renders throughrunStateBadge(run.state, run.kind), so the words and icons are the system's: Passed, Failed, Queued, Running (attn) and Cancelled (outline). A pull with no run getsbadge("No check", { variant: "outline" }). - Markup: I dropped the
class="mono"and kept a bare<p data-change>, so there is no new unnamed class. The badge link hasaria-label="Check passed, open log"(orfailed,running, and so on). - Tests: they now assert the badge words rather than whitespace-sensitive markup. They cover Passed, Failed, Queued, Running (attn variant), Cancelled (outline variant) and No check, where there is no log link.
- Terminal:
src/tty.tsdoesn't exist in this repo. The README now says the SSH terminal has no equivalent of this line, because the pull screen already shows the diff and check there. - 404 on the preview:
/toolbar?env=pull-1returns 404 by design.pull-Nmust be a pull in that repo, andpull-1isn't one on the forge repo. Try…/toolbar?env=pull-4100on the preview host. The tests exercise the real route with a signed-in session and a real pull, and a nonexistent pull gives 404 there too.
The check failed because my test asserted toBeLessThan(50) on a measured request time. The repo's flake audit, in test/flake.test.ts and scripts/flake.ts, rejects any such bound below 200 ms. I raised the bound to 200 ms in test/toolbar-change.test.ts and renamed that test to say so.
Production code is unchanged. The toolbar tests and the flake audit pass locally (61 tests). I did not run the full check; the forge runs it on this push.
The 200 ms bound is looser than the issue's "under 50 ms" target, and the shared runner is why. The diff, check and pull-row phases are still in Server-Timing, so the real cost is visible there.
Shards 5 and 6 of the failed check ended with exit 143 and no named test. Shard 5 includes test/toolbar-change.test.ts. The log shows the audit as the only failing test, and I assume the two kills came from the run being torn down after it failed. If shards 5 and 6 fail again on this push, that is a separate problem.
Fix first: the change line departs from docs/DESIGN.md. The pull page already has a diff summary (src/web/diff-view.ts:565-571) that shows additions in .add and deletions in .del with a real minus sign. Here +A -R is one plain-text link in a bare <p data-change> with no tones and no spacing between the two links. Reuse that summary markup, or extract it into a small shared helper in diff-view.ts and use it in both places. Keep the badge link beside it, and give the line a named component or class rather than a bare data attribute. Anyone can test this on a 360px phone: the two inline links sit about 16px tall and touch each other, so put them in a flex row with a gap and a tappable height.
Second: the toolbar is fetched by every preview, and this change adds a git merge-base and diff plus a check lookup to each request. The issue asked for under 50 ms and the test now only asserts under 200 ms. The diff is not cached for a head that has not moved. Either cache the stat by head oid, or read the stat from a value the pull already stores. Add a test that fails when that read is slow or repeated.
The terminal gap is reasoned and stated in the README, which I accept. Security and the 404 order are fine, and the tests cover each badge state.
The change line now reuses the diff summary's totals, sits in a named flex row, and reads the diff once per head. The toolbar, diff and flake tests pass (91). I didn't run the full check, and tsc reports only the missing bun types in this sandbox.
- Totals markup: I extracted
diffTotals()insrc/web/diff-view.ts. It writes additions in.addand deletions in.delwith a real minus sign.renderDiff's summary and the toolbar both use it, and the toolbar wraps it in the existing.diff-stat. - Layout: the line is now
<p class="change-line">, a wrapping flex row with a gap, and each link is 36px tall. The Files link and the check badge link no longer touch. I added.change-linetosrc/web/style/content.tsand to the §5d list indocs/DESIGN.md. I haven't checked it on a 360px screen. - Caching: the new
src/web/studio/change_stat.tscaches the stat by pull id and head oid. A hit does no git work at all, because the head and check lookup use the pull's stored head. An entry lives 60 seconds, because the base branch can move under a head that hasn't. This is a cache, not a stored value, so there is no schema change. - Tests: a unit test shows the diff is read once per head and again after a new head or after the TTL. An end-to-end test shows the second request's
diffServer-Timing phase is under 1 ms. It also checks the+3and−1spans. The 200 ms request bound stays because the flake audit rejects anything tighter.
Works as the issue asks, and the cache and tests are sound. One design-system miss, so changes requested: the tap height. docs/DESIGN.md (Density, §3) says anything touchable is >=44px under @media (pointer: coarse), via padding. .change-line a is fixed at min-height: 36px with no coarse-pointer rule, so on a phone both links (Files, check badge) are under the thumb floor. Fix first: keep 36px for fine pointers and add @media (pointer: coarse) { .change-line a { min-height: 44px; } }, then update the .change-line entry in the DESIGN.md §5d list to say so. Second, smaller: the line is a hand-rolled flex row with a new page-local class; if an existing named row component (e.g. the .stack/row pattern in §5) fits, prefer it, otherwise keep the class as is since it is listed in §5d.
Handed to a person by the crew: the reviewer asked for changes three times with no approval between, so the planner re-scopes it: split, replaced, or one more round with the reviewer's ask restated.
- juniper: The feature does what the issue asks, but it departs from docs/DESIGN.md on the check badge, and that is a change request. Fix first: replac
- juniper: Fix first: the change line departs from docs/DESIGN.md. The pull page already has a diff summary (src/web/diff-view.ts:565-571) that shows a
- juniper: Works as the issue asks, and the cache and tests are sound. One design-system miss, so changes requested: the tap height. docs/DESIGN.md (De
One more round, one change: the third review's tap height. Add a @media (pointer: coarse) rule that raises the change line's links to min-height: 44px (docs/DESIGN.md, Density), and mention it in that class's §5d entry. The first two reviews' asks (runStateBadge, .add/.del spans, a named class, aria-label, the stat cached by head oid) are already met, so leave them as they are.
State: one more round, unchanged since 08:35. The one change: a @media (pointer: coarse) rule giving the change line's links min-height: 44px (docs/DESIGN.md, Density), named in that class's §5d entry. If the next review still asks for changes, a person should close this pull; #4088 stays open for a fresh run.
State: one more round, still the same one change: a @media (pointer: coarse) rule giving .change-line links min-height: 44px, named in its §5d entry. No new commit since 08:29; if none comes, a person should close this pull and #4088 goes to a fresh run.
State: closed by the planner, its issue replaced by #4205. Three rounds of review left one ask, and no commit followed the restated ask; #4205 names that ask in its done list and points the next run at this branch's commits, which the reviews accepted.
Closed by the planner: the issue this pull was built for is closed.
A preview's toolbar page now shows a line under the head: "N files, +A -R" linking to the pull's Files page, then the latest check as a
badge(passed, failed, running, cancelled or no check).The new test file
test/toolbar-change.test.tspasses, along with the existing toolbar tests (34 in total). I did not run the full suite. Thebun x tsc --noEmitrun reports only "Cannot find type definition file for 'bun'", which is the missing types in this sandbox. It reports no errors in the changed files.changeLineinsrc/web/studio/toolbar.ts.toolbarPageis nowasyncbecause the diff read is async.pull-row,diffandcheckto the Server-Timing phases. The preview page stays under 50 ms in the test.I left out a "running" case in the tests. That label shows when a check is queued or running, but no test covers it.
No new dependencies. To try it, open
/<owner>/<repo>/toolbar?env=pull-Non a preview.Closes #4088