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

The forge toolbar in a running app names the release it serves and when it shipped #14115

Merged opened this

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

Merged

The toolbar in a production app now reads "Live since 3 h ago". It adds "· behind main" when the served commit is not the default branch's tip. The pill-side tests and tsc are green; I did not run test/toolbar-where.test.ts, which a first run passed, but the edits that followed were not rerun against it.

Notes

shipped production is serving it deploy 4adf612

opened this

The toolbar in a production app now reads "Live since 3 h ago". It adds "· behind main" when the served commit is not the default branch's tip. The pill-side tests and tsc are green; I did not run test/toolbar-where.test.ts, which a first run passed, but the edits that followed were not rerun against it. I did not run the new "Live since" row in a browser, and I did not check any other test/apps-pill-*.test.ts or the other toolbar tests against the final edits.

  • What changed: the pill's line used to read "live · <change> · <ago>" and now reads "Live since <ago> · <change>". The exact time (UTC) is in its title. The "Serving <commit>" row is unchanged.
  • Where the behind check comes from: src/apps/pill_behind.ts compares the served commit with the default branch tip. It is one loose-ref read (or the cached packed-refs), never a git process and never a per-request lookup. pillWhere sets serving.behind only for production, and the tag carries it as data-stale.
  • MCP: the pill is the only surface, so there is no MCP change, and test/mcp-size.test.ts passes.
  • Size: the pill script change is small (the "Live since" line stays under the 300-byte check in test/apps-toolbar-state.test.ts), and test/toolbar-size.test.ts passes. The row is added inside the existing fixed shadow host, so there is no layout shift.
  • Tests: test/toolbar-since.test.ts covers a current and a behind app (the tip check, the tag attribute, and the rendered pill text).
  • Existing test changed: I edited test/apps-toolbar-state.test.ts because it pinned the old "live · … · ago" wording, which this issue replaces.
  • Not tested: the exact-time title has no assertion. The fake document in the test helper does not expose it, so it is untested.
  • Not done: I did not add a "behind" count of commits, only the one clause. Previews are unchanged.
  • To try: open a production app whose default branch has moved on, and press the pill.

🤖 Generated with Claude Code

Closes #14101

3 earlier comments · 1 event
commented

The toolbar in a production app now reads "Live since 3 h ago". It adds "· behind main" when the served commit is not the default branch's tip. The pill-side tests and tsc are green; I did not run test/toolbar-where.test.ts, which a first run passed, but the edits that followed were not rerun against it. I did not run the new "Live since" row in a browser, and I did not check any other test/apps-pill-*.test.ts or the other toolbar tests against the final edits.

  • What changed: the pill's line used to read "live · <change> · <ago>" and now reads "Live since <ago> · <change>". The exact time (UTC) is in its title. The "Serving <commit>" row is unchanged.
  • Where the behind check comes from: src/apps/pill_behind.ts compares the served commit with the default branch tip. It is one loose-ref read (or the cached packed-refs), never a git process and never a per-request lookup. pillWhere sets serving.behind only for production, and the tag carries it as data-stale.
  • MCP: the pill is the only surface, so there is no MCP change, and test/mcp-size.test.ts passes.
  • Size: the pill script change is small (the "Live since" line stays under the 300-byte check in test/apps-toolbar-state.test.ts), and test/toolbar-size.test.ts passes. The row is added inside the existing fixed shadow host, so there is no layout shift.
  • Tests: test/toolbar-since.test.ts covers a current and a behind app (the tip check, the tag attribute, and the rendered pill text).
  • Existing test changed: I edited test/apps-toolbar-state.test.ts because it pinned the old "live · … · ago" wording, which this issue replaces.
  • Not tested: the exact-time title has no assertion. The fake document in the test helper does not expose it, so it is untested.
  • Not done: I did not add a "behind" count of commits, only the one clause. Previews are unchanged.
  • To try: open a production app whose default branch has moved on, and press the pill.

🤖 Generated with Claude Code

commented

The two failing tests were out of date with this pull, not broken by it. I've updated them and pushed. test/toolbar-serving.test.ts now passes (4 of 4), the gate and tsc --noEmit are clean, and I didn't run the full suite.

  • Wording: the toolbar now reads "Live since <time>" where it used to read "live · no change yet · <time>". The first test checked the old text, so it now checks the new one.
  • Behind field: pillWhere now adds behind: "main" to the serving record when production serves a commit that isn't the default branch's tip. The second test used an exact match, so it now uses toMatchObject. In that test the repository's main tip differs from the commit it serves, so behind: "main" is the correct result there.

What changed overall: the toolbar says "Live since <time>" with the exact time in the title, and it says when production is behind its default branch. The behind check is a single loose-ref read in src/apps/pill_behind.ts, with no git process.

What I chose not to do: no new dependencies and no new egress hosts.

How to try it: open the preview at https://lab--14115--forge-trevato-apps.open-platform.sh and look at the toolbar's serving line.

Changes requested — before the latest push

Direction fit is fine (small, no git process on the request path), but three things must change in one round:

  1. The exact-time title (box 1) has no assertion. Add one: extend test/helpers/toolbar-boot.ts so the fake element exposes title, then assert it equals the UTC string.
  2. pillWhere sets serving.behind only for production, and no test covers that. Add a pillWhere test with env production where the tip differs (behind set) and equals (unset), plus a preview env that never sets it. Restore the toEqual in toolbar-serving.test.ts rather than loosening it to toMatchObject.
  3. The 300-byte test (box 3) measures a 200-character slice of one line, so it does not bound what this change added. Measure the real script delta against base (and the tag delta) and assert under 300. Also: the tag now has data-behind (preview, existing) and data-stale (production); name the new one data-lagging or document the difference in a comment. Also say in the pull whether this needs a docs/features note; no TUI screen is involved since the toolbar is page-only.
commented

All three changes are in and pushed, along with the data-lagging rename and a docs note. The three toolbar test files pass (14 tests), and tsc, the gate and the design lint are clean. I did not run the full suite; the forge's check does that on the push.

  • Title assertion: test/helpers/toolbar-boot.ts now gives the fake element a title and exposes els(). test/toolbar-since.test.ts asserts the title equals Sun, 15 Nov 2026 10:00:00 GMT. It also covers the case with no change that is behind, where only · behind main follows "Live since …".
  • Invalid time: I didn't add a separate guard. The serving block only runs when ago(d.live) returns text, and ago returns an empty string for an unparsable or missing d.live, so the new Date(...).toUTCString() line can't throw. A new test boots with live: "not a date" and checks the line is left out without throwing.
  • pillWhere behind field: the new test sets the repository's default-branch tip with a loose ref. It checks that production is behind when the tip differs, that a preview (pull-7) never sets behind, and that production is unset when the tip equals the served commit. toEqual is back in test/toolbar-serving.test.ts. That test now points the tip at the served commit first, so its result no longer depends on the repository's real main.
  • Size bound: test/apps-toolbar-state.test.ts compares toolbarJs against BASE_SCRIPT_BYTES = 22623, the script's size at the base commit bfb7e8dc2, and asserts the delta is under 300. It is currently 106 bytes. I pinned the number because a test shouldn't call git. The tag delta is also bounded, both for the change line and for the lagging attribute.
  • Rename: data-stale is now data-lagging, with a comment next to it saying how it differs from the preview's data-behind.
  • Docs note: yes, this needs one. I updated the "Which commit" bullet in docs/features/forge-toolbar.md. No TUI screen is involved, since the toolbar is page-only.
commented

This push fixes the failed gate check: test/toolbar-serving.test.ts no longer uses as never. The gate, tsc --noEmit and test/toolbar-serving.test.ts (5 tests) all pass locally. I have not run the full suite; the forge's check does that on this push.

  • What the gate flagged: pillWhere already accepts undefined for its who argument, so the cast at line 76 is gone.
  • Line 58: the helper that builds who now takes a typed GrantWho instead of casting it. That line passed the gate only because it used a different cast.

The app code and the toolbar behaviour are unchanged from the earlier commits on this pull.

Approved

Earlier asks are met: the title assertion (fake element title, UTC string checked), the invalid-time case (line left out, no throw), a pillWhere test for behind (production only, never a preview), a real size delta against a pinned base (106 bytes, under 300), the data-lagging rename, the docs bullet, and the as never casts removed. The behind check is one loose-ref read with no git process, and the toolbar is page-only so no TUI screen is owed. I did not see the behind clause live: the preview is not production, and I judged it from the tests and source.

Next, in order:

  1. Non-blocking: BASE_SCRIPT_BYTES is a pinned number, so it goes stale when the script legitimately grows. Consider a ratchet note beside it.
  2. Non-blocking: check the Live since row on a 360px phone at 200% text size. overflow-wrap:anywhere is set, but I have not seen it.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs