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

A preview's forge toolbar names the pull it previews and links to it #13148

Merged opened this

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

Merged

A preview's forge toolbar now shows a "Pull #N" link to the pull's page, then "Environment: preview", then the pull title and "Branch: ". I ran the toolbar, pill and lost-journey tests (76 pass), bun x tsc --noEmit and bun scripts/gate.ts, all green. I did not run the full suite; the forge runs the check on this push.

Notes

shipped production is serving it deploy 59903fa

opened this

A preview's forge toolbar now shows a "Pull #N" link to the pull's page, then "Environment: preview", then the pull title and "Branch: <head branch>". I ran the toolbar, pill and lost-journey tests (76 pass), bun x tsc --noEmit and bun scripts/gate.ts, all green. I did not run the full suite; the forge runs the check on this push.

  • What changed: the pull link was already there but read "preview · #N". It now reads "Pull #N", and the "Environment: preview" and "Branch:" lines are new.
  • Branch source: the branch comes from the pull's head branch. It travels as an escaped data-branch attribute on the injected script tag, the same way the title does.
  • Production: a production page shows no pull, environment or branch line, and is otherwise unchanged.
  • Access: the branch is only sent to someone who may read the pull, like the title.
  • Security: toolbarTag escapes the branch and title. The CSP is untouched.
  • Tests: new tests cover the environment and branch lines, production showing none of them, and branch/title escaping. test/apps-pill-where.test.ts now checks the branch is set for a reader and withheld otherwise. test/apps-pill-freshness.test.ts and test/lost-journey.test.ts expected the old "preview · #N" text; I changed that expectation, not the behaviour.
  • Size: the toolbar script is now 24,539 bytes against a 24,576-byte test limit, so the next addition to it will have to trim something.

I did not add the branch to the collapsed pill's aria-label. I also did not link the branch to a branch page.

To try it, open any preview, for example https://lab--13138--forge-trevato-apps.open-platform.sh, and press the pill.

🤖 Generated with Claude Code

Closes #13128

commented

A preview's forge toolbar now shows a "Pull #N" link to the pull's page, then "Environment: preview", then the pull title and "Branch: <head branch>". I ran the toolbar, pill and lost-journey tests (76 pass), bun x tsc --noEmit and bun scripts/gate.ts, all green. I did not run the full suite; the forge runs the check on this push.

  • What changed: the pull link was already there but read "preview · #N". It now reads "Pull #N", and the "Environment: preview" and "Branch:" lines are new.
  • Branch source: the branch comes from the pull's head branch. It travels as an escaped data-branch attribute on the injected script tag, the same way the title does.
  • Production: a production page shows no pull, environment or branch line, and is otherwise unchanged.
  • Access: the branch is only sent to someone who may read the pull, like the title.
  • Security: toolbarTag escapes the branch and title. The CSP is untouched.
  • Tests: new tests cover the environment and branch lines, production showing none of them, and branch/title escaping. test/apps-pill-where.test.ts now checks the branch is set for a reader and withheld otherwise. test/apps-pill-freshness.test.ts and test/lost-journey.test.ts expected the old "preview · #N" text; I changed that expectation, not the behaviour.
  • Size: the toolbar script is now 24,539 bytes against a 24,576-byte test limit, so the next addition to it will have to trim something.

I did not add the branch to the collapsed pill's aria-label. I also did not link the branch to a branch page.

To try it, open any preview, for example https://lab--13138--forge-trevato-apps.open-platform.sh, and press the pill.

🤖 Generated with Claude Code

commented

The preview toolbar now says "Pull #N" (linked to the pull), "Environment: preview", and "Branch: …" in plain words. The failed check is fixed and pushed.

  • Gate failure: after merging current main, bun scripts/gate.ts --fix rewrapped comments past 100 columns in src/apps/proxy.ts, src/apps/toolbar.ts and test/lost-journey.test.ts. The gate passes now.
  • Stale test: test/toolbar-injection.test.ts still looked for the old "preview · #" pill string, which this pull replaced. The test was out of date, not the code. I changed it to check for "Pull #".
  • Checks: the gate and tsc --noEmit pass here. The toolbar, proxy, lost-journey and injection tests pass, apart from the one I fixed above; 4 are skipped, among them the keyboard test, which needs Chromium and found none on this machine. I didn't run the full suite: scripts/fast.ts says the diff reaches 2444 of 3336 test files (about 206 minutes). The forge's check runs it on this push.

To try it, open the preview at https://lab--13148--forge-trevato-apps.open-platform.sh and expand the toolbar pill.

Approved

Approved. The toolbar now reads Pull #N (linked), Environment: preview, title, Branch: <head branch>; production shows none of the pull lines. The branch is withheld from non-readers like the title and is escaped in the tag, and the tests cover each. The preview root served no injected toolbar tag to my curl (the app page may not be HTML), so I judged the behaviour from source and tests. Next: (1) the script is 24,539 of 24,576 bytes, so trim or split the pill before the next addition; (2) add the branch to the collapsed pill aria-label so screen-reader users get it without opening the panel.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs