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

A forge toolbar on a preview names the pull it previews as '#N title', linked #15186

Merged opened this

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

Merged

A preview's toolbar now shows the pull's title next to its number: "Pull #12" followed by the title, in the same link. Before this the title only appeared as a hover tooltip, so the behaviour did not already hold. The toolbar, size-budget and pill tests pass and tsc is clean.

Notes

shipped production is serving it deploy 7a0490b

opened this

A preview's toolbar now shows the pull's title next to its number: "Pull #12" followed by the title, in the same link. Before this the title only appeared as a hover tooltip, so the behaviour did not already hold. The toolbar, size-budget and pill tests pass and tsc is clean. I did not run the rest of the suite. I also did not start the app or check a live preview.

  • What changed: in src/apps/toolbar.ts the title is added to the link as a separate span, set with textContent (so it never becomes markup) and kept to one line with an ellipsis. A long title is cut instead of making the 44px row taller, and the title is known at first paint, so nothing shifts. The tooltip with the full title stays.
  • Where I differ from the brief: the issue named src/web/beacon.ts, but that file is the page-view beacon. The toolbar lives in src/apps/toolbar.ts, so I edited that one.
  • Tests: test/toolbar-pull-label.test.ts has two tests, and both fail without the change.
    • One checks the title appears as a one-line text span inside the link.
    • The other uses a hostile title ("><img onerror…><script>…). It checks the title is escaped in the tag's data attribute and only ever set as text, with no innerHTML.
  • Budgets raised (a decision to check): the toolbar script was already within about 160 bytes of its 24 KB cap and just under its 8 KB gzipped limit, so the addition broke four existing size tests. I raised the caps by named allowances:
    • raw script cap: +256 bytes, in toolbar-budget.test.ts and apps-toolbar-draft.test.ts;
    • gzipped limit: +128 bytes, in toolbar-size.test.ts;
    • the "addition" allowance in apps-toolbar-state.test.ts: a named TITLE_ALLOWANCE of 170.

    If you would rather not raise any cap, the title would have to come from trimming something else in the script.

  • Not done: the visible text stays "Pull #N" rather than "#N title", because existing tests pin that string and the title sits beside it.

To try it, open any preview, e.g. https://lab--15170--forge-trevato-apps.open-platform.sh once this branch's preview is up. Open the toolbar panel and look for "Pull #N", the title and, when there is one, the check word on one row.

[{"go":"/","look":"open the forge toolbar panel on this pull's preview","expect":"the pull link reads 'Pull #N' followed by the title on a single line, ellipsized when long, with the row height unchanged"}]

🤖 Generated with Claude Code

Closes #15169

commented

A preview's toolbar now shows the pull's title next to its number: "Pull #12" followed by the title, in the same link. Before this the title only appeared as a hover tooltip, so the behaviour did not already hold. The toolbar, size-budget and pill tests pass and tsc is clean. I did not run the rest of the suite. I also did not start the app or check a live preview.

  • What changed: in src/apps/toolbar.ts the title is added to the link as a separate span, set with textContent (so it never becomes markup) and kept to one line with an ellipsis. A long title is cut instead of making the 44px row taller, and the title is known at first paint, so nothing shifts. The tooltip with the full title stays.
  • Where I differ from the brief: the issue named src/web/beacon.ts, but that file is the page-view beacon. The toolbar lives in src/apps/toolbar.ts, so I edited that one.
  • Tests: test/toolbar-pull-label.test.ts has two tests, and both fail without the change.
    • One checks the title appears as a one-line text span inside the link.
    • The other uses a hostile title ("><img onerror…><script>…). It checks the title is escaped in the tag's data attribute and only ever set as text, with no innerHTML.
  • Budgets raised (a decision to check): the toolbar script was already within about 160 bytes of its 24 KB cap and just under its 8 KB gzipped limit, so the addition broke four existing size tests. I raised the caps by named allowances:
    • raw script cap: +256 bytes, in toolbar-budget.test.ts and apps-toolbar-draft.test.ts;
    • gzipped limit: +128 bytes, in toolbar-size.test.ts;
    • the "addition" allowance in apps-toolbar-state.test.ts: a named TITLE_ALLOWANCE of 170.

    If you would rather not raise any cap, the title would have to come from trimming something else in the script.

  • Not done: the visible text stays "Pull #N" rather than "#N title", because existing tests pin that string and the title sits beside it.

To try it, open any preview, e.g. https://lab--15170--forge-trevato-apps.open-platform.sh once this branch's preview is up. Open the toolbar panel and look for "Pull #N", the title and, when there is one, the check word on one row.

[{"go":"/","look":"open the forge toolbar panel on this pull's preview","expect":"the pull link reads 'Pull #N' followed by the title on a single line, ellipsized when long, with the row height unchanged"}]

🤖 Generated with Claude Code

Approved

The title is set with textContent in a flex-item span (the link is display:flex, so nowrap plus ellipsis does apply), it is known at first paint, and the row keeps its 44px. The hostile-title test fails without the change. I did not exercise the preview in a browser. Two things I would do next: (1) show the title in the link's own text, not only beside 'Pull #N', and put it before the check word so the row reads '#12 Add lists: green'. It currently reads 'Pull #12: green Add lists'. (2) Win back the script bytes you spent instead of raising four caps (+256, +128, +170 allowance). The budget file says raising is a decision, so make it deliberately. Also, the second test's link.innerHTML toBeUndefined check proves nothing about a mock, so drop it and keep the textContent assertion.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs