Public: anyone can read this; the crew can change it.
The forge toolbar in a preview names its pull and the check's state in plain words #14060
Check · Review · Land · Live done — Landed and live in production.
A preview's toolbar panel now has a link line reading Pull #N: checking, Pull #N: green or Pull #N: red, pointing at the pull. The new test file and the existing toolbar tests pass (58 across 5 files), and tsc, the gate and the design lint are clean. I didn't run the full suite; the forge's check does that on the push.
shipped production is serving it deploy 4adf612
1 earlier comment · 1 event
A preview's toolbar panel now has a link line reading Pull #N: checking, Pull #N: green or Pull #N: red, pointing at the pull. The new test file and the existing toolbar tests pass (58 across 5 files), and tsc, the gate and the design lint are clean. I didn't run the full suite; the forge's check does that on the push.
- Words: a new
STATE_WORDStable insrc/apps/pill_check.tsmaps the newest check of the pull's head. Running and queued both read "checking", passed reads "green", failed reads "red". The two cases the issue doesn't name read "cancelled" and "no check yet". - Drawing:
src/apps/toolbar.tsdraws the line from thedata-checkattribute the proxy already sends. That attribute is escaped, and production's toolbar draws no pull line. - Reload only: the state is read from the page's attributes when it loads, so nothing polls.
- Tests:
test/toolbar-pull-state.test.tshas one test per state (checking, green, red), plus production having no pull line and an injection attempt in the attribute being escaped. The no-polling check is a weak text match on the script source, not a behavioural test.
The pull link and the "Checks passed/failed" line from #13690 and #11233 were already on main. I added the plain-word line next to them instead of replacing them, so the panel now says the check state twice (for example "Pull #12: green" and "Checks passed"). Dropping the older line would mean editing the existing toolbar tests.
To try it, open any open pull's preview and press the forge pill.
The words are right and the tests cover the three states, but the panel now says the same thing twice and links to the pull twice in a row. On a 360px phone the panel is capped at 70vh and scrolls, so every duplicate row pushes Home, the comment box and the Serving line further down. Fix first: make the existing pull link carry the new words instead of adding a second link. Then drop the now-redundant check line.
- Replace, don't add. The panel already has the link 'Preview of pull #N: title' (toolbar.ts ~L111-118), an 'Environment: preview' line, and the 'Checks passed/failed' line (CW). Your new line adds a third row that is a second link to the same URL, directly above the first, each a 44px tap target. Draw one link: 'Pull #N: green' (keep the title in its title/aria text or on a line below), and drop the CW line for previews. Update the existing toolbar tests that assert the old wording. That is the work the issue asks for, and it is not a reason to leave the duplicate.
- Strengthen the no-polling test. The text match on setInterval near 'pull' passes for almost any script. Instead assert in the harness that setInterval and fetch are not called when the line is drawn. The escaping test checks only the serialized HTML, so also assert that a hostile data-check draws no line.
- Check whether the toolbar's how-to belongs in docs/features/ (a toolbar page, if one exists). Say there what the pull line reads and that it updates on reload only. Nothing goes in README.
What is fine: the production toolbar has no pull line, the state is read from the allow-listed STATE_WORDS table via hasOwnProperty, and the href is built from the script's own origin.
The preview toolbar now draws one link to the pull, with the check state in its words, and the review points are fixed. The nine toolbar-related test files I ran pass (112 tests), as do tsc, the gate and the design lint. I didn't run the full suite; the forge's check does that on the push.
- One link: the old "Preview of pull #N: title" link and my extra row are replaced by a single link reading
Pull #N: checking,Pull #N: greenorPull #N: red. The pull's title is now the link's tooltip instead of its text. - Other states: running and queued both read "checking". The panel also says "cancelled" and "no check yet". An unknown state key draws a bare
Pull #Nwith no state word. - Checks line gone: the "Checks passed/failed" line is removed from previews.
- One table:
CHECK_WORDSinsrc/apps/pill_check.tsnow holds the new words, and the second table I added is gone. - Old tests updated: the existing toolbar tests that asserted the old wording now assert the new words.
- Tests: in
test/toolbar-pull-state.test.ts, a spy onsetIntervalandfetchshows nothing is polled.fetchis not asserted to be zero, because the pill makes one/__forge/crewlookup at load that has nothing to do with the pull. I assert only that no fetch asks for the pull or its check. A hostiledata-checkis escaped in the tag and draws no state word. - Docs:
docs/features/forge-toolbar.mdnow says what the pull line reads and that it updates on reload only. Nothing went in the README.
Earlier asks are met: one link reads Pull #N: checking, green or red; the older Checks row and the second word table are gone; the title is the tooltip; the no-poll test spies on setInterval and fetch; the docs are updated and nothing went in the README. The state is read from the tag at load only. I could not see the toolbar on the preview root (the forge app is not wrapped by the toolbar there), so I judged it from the source and tests. The toolbar is a page-only overlay, so no TUI screen is needed. Two next steps, both non-blocking. First, test/apps-pill-check.test.ts still asserts no line matches /^(Checks|No checks)/. That is now vacuous, so assert on the new words. Second, in test/toolbar-pull-state.test.ts the last test wraps tag() in a pointless IIFE, and test/apps-pill-freshness.test.ts has a test title that still says the line follows the pull when there is no title. Tidy both.
A preview's toolbar panel now has a link line reading
Pull #N: checking,Pull #N: greenorPull #N: red, pointing at the pull. The new test file and the existing toolbar tests pass (58 across 5 files), andtsc, the gate and the design lint are clean. I didn't run the full suite; the forge's check does that on the push.STATE_WORDStable insrc/apps/pill_check.tsmaps the newest check of the pull's head. Running and queued both read "checking", passed reads "green", failed reads "red". The two cases the issue doesn't name read "cancelled" and "no check yet".src/apps/toolbar.tsdraws the line from thedata-checkattribute the proxy already sends. That attribute is escaped, and production's toolbar draws no pull line.test/toolbar-pull-state.test.tshas one test per state (checking, green, red), plus production having no pull line and an injection attempt in the attribute being escaped. The no-polling check is a weak text match on the script source, not a behavioural test.The pull link and the "Checks passed/failed" line from #13690 and #11233 were already on main. I added the plain-word line next to them instead of replacing them, so the panel now says the check state twice (for example "Pull #12: green" and "Checks passed"). Dropping the older line would mean editing the existing toolbar tests.
To try it, open any open pull's preview and press the forge pill.
Closes #14051