Public: anyone can read this; the crew can change it.

A test runs the toolbar pill's script and proves it draws one freshness line under "Preview of pull #N" for a merged, closed, deploying or behind preview, and nothing for an open, current one #9141

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The tests prove the pill draws one freshness line for a merged, closed, deploying or behind preview, and none for an open, current one. The by-eye check is not done.

shipped production is serving it deploy 309b41e

opened this

The tests prove the pill draws one freshness line for a merged, closed, deploying or behind preview, and none for an open, current one. The by-eye check is not done.

Changes

  • Words table: src/apps/toolbar.ts now has FRESHNESS_WORDS, one exported table holding the four sentences. The script embeds it as W inside its closure, so there are no new globals. The drawing code reads W.merged, W.closed, W.deploying and W.behind instead of literals.
  • Script change: its content hash changes because the script text changed. test/apps-toolbar-asset.test.ts stays green.
  • New tests: test/apps-pill-freshness.test.ts gains a group that runs toolbarJs against a small stand-in document, window and location, with no new dependency. It reads the panel's lines from the element carrying role="region".
  • What they assert:

- Merged, closed, deploying and behind each give exactly one freshness line, right after "Preview of pull #7" and the title. - With no title, the line follows "Preview of pull #7" directly. - Merged and closed win over deploying and behind, and deploying wins over behind. - An open, current preview draws none, and neither does production, which shows only the app name and "Production". A viewer sent no state or flags also gets none.

Checks run

  • bun test on test/apps-pill-freshness.test.ts and test/apps-toolbar-asset.test.ts: 15 pass.
  • bun scripts/gate.ts and bun x tsc --noEmit: clean.

Not done

  • By-eye check: I could not do it. A request for the #9139 preview's / returned no pill tag (probably it needs a signed-in grant), and I cannot take screenshots here. Someone should open the pill on one open pull's preview and confirm it shows no freshness line when current.
  • Fields and proxy: I left them alone, as the issue asked.

🤖 Generated with Claude Code

Closes #9140

commented

The tests prove the pill draws one freshness line for a merged, closed, deploying or behind preview, and none for an open, current one. The by-eye check is not done.

Changes

  • Words table: src/apps/toolbar.ts now has FRESHNESS_WORDS, one exported table holding the four sentences. The script embeds it as W inside its closure, so there are no new globals. The drawing code reads W.merged, W.closed, W.deploying and W.behind instead of literals.
  • Script change: its content hash changes because the script text changed. test/apps-toolbar-asset.test.ts stays green.
  • New tests: test/apps-pill-freshness.test.ts gains a group that runs toolbarJs against a small stand-in document, window and location, with no new dependency. It reads the panel's lines from the element carrying role="region".
  • What they assert:

- Merged, closed, deploying and behind each give exactly one freshness line, right after "Preview of pull #7" and the title. - With no title, the line follows "Preview of pull #7" directly. - Merged and closed win over deploying and behind, and deploying wins over behind. - An open, current preview draws none, and neither does production, which shows only the app name and "Production". A viewer sent no state or flags also gets none.

Checks run

  • bun test on test/apps-pill-freshness.test.ts and test/apps-toolbar-asset.test.ts: 15 pass.
  • bun scripts/gate.ts and bun x tsc --noEmit: clean.

Not done

  • By-eye check: I could not do it. A request for the #9139 preview's / returned no pill tag (probably it needs a signed-in grant), and I cannot take screenshots here. Someone should open the pill on one open pull's preview and confirm it shows no freshness line when current.
  • Fields and proxy: I left them alone, as the issue asked.

🤖 Generated with Claude Code

Approved

The four sentences now live in one FRESHNESS_WORDS table that the script is built from. The new tests run the real script against a stand-in document and assert the panel lines. They cover merged, closed, deploying and behind (one line, right after the pull and its title), the no-title case, the precedence (merged and closed beat deploying and behind; deploying beats behind), and open/current and production (none). No new dependency, no dead code. Next, I would (1) make the stand-in fail loudly if the script touches an element method it does not model, so the test breaks on drawing changes and does not pass quietly; (2) put a screenshot or note of the pill on an open preview in the pull. A note on the pill: the HTML served at / on this preview carries no pill script tag when fetched with the bearer token, so the pill cannot be seen by curl.

commented

Left #9140 open: 1 unticked item remain (Seen by eye: a screenshot or a note of the pill opened on one open pull's preview (any of the listed previews) shows the line or its absence as described.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs