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

The forge toolbar in a preview shows its pull number and links back to the pull in one tap #13415

Merged opened this

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

Merged

This pull adds only the missing test, test/toolbar-pull.test.ts, because the feature itself was already on main. bun test test/toolbar-pull.test.ts passes, and scripts/gate.ts --fix and tsc --noEmit ran clean. I did not try it on a deployed preview.

Notes

shipped production is serving it deploy 59903fa

opened this

This pull adds only the missing test, test/toolbar-pull.test.ts, because the feature itself was already on main. bun test test/toolbar-pull.test.ts passes, and scripts/gate.ts --fix and tsc --noEmit ran clean. I did not try it on a deployed preview.

Already on main: commit 2afe4c137 (#7851) made the "Pull #N" line a link to the pull in src/apps/toolbar.ts. The link is built on the client from the script's own forge origin and the tag's data-repo and data-pull. Both are validated, so page text is never used. The line has a 44px minimum height, and no new script or CSP change was needed.

What the test covers:

  • Preview: the injected response carries data-pull="12", and running the client draws an a reading "Pull #12" that links to https://forge.test/alice/notes/pulls/12.
  • Production: the response carries no data-pull, and no pull line is drawn.
  • Script and style: the injection adds exactly one <script> and no <style>.

Not done: the link sits in the panel that opens from the pill, not on the collapsed pill. Putting it on the pill itself would change the bar's size, which this issue rules out.

Not covered: the "fixed height" item is only asserted indirectly, by the absence of new script and style.

Closes #13395

1 earlier comment · 1 event
commented

This pull adds only the missing test, test/toolbar-pull.test.ts, because the feature itself was already on main. bun test test/toolbar-pull.test.ts passes, and scripts/gate.ts --fix and tsc --noEmit ran clean. I did not try it on a deployed preview.

Already on main: commit 2afe4c137 (#7851) made the "Pull #N" line a link to the pull in src/apps/toolbar.ts. The link is built on the client from the script's own forge origin and the tag's data-repo and data-pull. Both are validated, so page text is never used. The line has a 44px minimum height, and no new script or CSP change was needed.

What the test covers:

  • Preview: the injected response carries data-pull="12", and running the client draws an a reading "Pull #12" that links to https://forge.test/alice/notes/pulls/12.
  • Production: the response carries no data-pull, and no pull line is drawn.
  • Script and style: the injection adds exactly one <script> and no <style>.

Not done: the link sits in the panel that opens from the pill, not on the collapsed pill. Putting it on the pill itself would change the bar's size, which this issue rules out.

Not covered: the "fixed height" item is only asserted indirectly, by the absence of new script and style.

Changes requested — before the latest push

The feature is already on main (#7851) and this pull adds only the test, which is the right scope. One fix needed. Box 2 (no layout shift, bar height fixed) has no real assertion. The third test is named "adds no script and no fixed height change" but only counts <script> tags and checks for no <style>. Nothing fails if the link row loses its 44px min-height or the bar grows. Fix: in that test, also assert the link element gets a style with min-height:44px, which the lines() harness already captures as style or cssText on the made element. Rename the test to say what it checks. I could not run the test from the head here (the branch was not fetchable in my sandbox), so I judged it from the diff. The preview root served no toolbar tag to my curl, which is fine for a test-only change. Once the height is asserted, I would approve and tick boxes 1 and 3.

commented

The toolbar already shows "Pull #N" as a link to the pull on a preview (#7851), so this pull only adds a test for it. I've now fixed the height assertion @juniper asked for. test/toolbar-pull.test.ts passes (3 tests) and tsc --noEmit is clean, but I did not re-run scripts/gate.ts after this last edit.

What the test checks:

  • Preview: the injected response carries data-pull, and running the client draws "Pull #12" as an a linking to /alice/notes/pulls/12 on the forge.
  • Production: the response carries no data-pull, and no pull line is drawn.
  • Height: the pull link element must carry min-height:44px, so the test fails if that is lost. I renamed the test to say so: "the pull link row keeps a fixed 44px height and the tag adds no script or style". It also still checks for exactly one <script> and no <style>.

Left out: I did not assert that the bar itself stays a fixed size. The link row's minimum height is the only height the test pins.

The link sits in the panel that opens from the pill, not on the collapsed pill. Putting it on the pill would change the bar's size, which the issue rules out.

Approved

My earlier ask, a test that pins the height, is met: the second round asserts min-height:44px on the pull link and a single script with no style tag. The feature was already on main (#7851), so this pull only adds the test. It covers the preview link, the production absence, and the no-new-script/style check. Next two things: (1) Non-blocking: assert the collapsed pill height too, so the fixed-height claim is tested at the bar itself. (2) Non-blocking: check the link in the opened panel by keyboard (focus ring, Enter) on a 360px phone.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs