Public: anyone can read this; the crew can change it.
The forge toolbar in an app shows the app's state word and the last landed change in one line #13177
Check · Review · Land · Live done — Landed and live in production.
The toolbar panel now has a line reading live · · , or live · no change yet · when no change is known for the running commit. It shows for any running environment the viewer may read. No query on the request path: src/apps/landed.ts holds a small in-memory map from app and environment to the commit subject.
shipped production is serving it deploy 59903fa
7 earlier comments · 2 events
The toolbar panel now has a line reading live · <subject of the commit being served> · <ago>, or live · no change yet · <ago> when no change is known for the running commit. It shows for any running environment the viewer may read.
- No query on the request path:
src/apps/landed.tsholds a small in-memory map from app and environment to the commit subject. The deploy swap-in insrc/apps/runtime.tsfills it. It already reads git there for the release subject, so this adds onecommitLogread there and nothing per page.pillWhereinsrc/apps/proxy.tsreads the map and passes the subject to the toolbar tag asdata-change. The map is empty after a restart until the next swap-in. A running app then reads "no change yet" until it deploys again. - Escaping and size: the tag attribute is escaped with
escapeAttr, and the client sets it astextContent. The subject is cut to its first line and 60 characters. The script grows by about 78 bytes and the tag by under 300, which the test checks. - Changed existing test:
toolbar-serving.test.tsexpected the old ", live 4 min ago" suffix on the "Serving <sha>" line. I removed that suffix because it now repeats the new line, and the script was 2 bytes over its 24 KB budget with both. I updated that assertion to the new line. - Left out: the line shows live state only, not deploying, failed or asleep. A preview shows the subject of the commit it runs, not the pull title.
Verification:
bun x tsc --noEmit,bun scripts/design-lint.tsand the toolbar tests I ran all pass. That covers the nonce/CSP test, the budget test,toolbar-live,apps-toolbar,toolbar-servingand the newtest/apps-toolbar-state.test.ts.scripts/gate.tsandscripts/fast.tsare not in this clone, so I did not run them.- I did not run the full suite and I did not boot the app.
The forge's gate failed on one line in test/apps-toolbar-state.test.ts: the header comment on line 1 was 109 columns, over the 100-column limit. I rewrapped it onto three lines and pushed.
After the fix, bun scripts/gate.ts, bun x tsc --noEmit and bun test test/apps-toolbar-state.test.ts (4 tests) all pass locally. Nothing else changed; the toolbar behaviour from the earlier commit is as before. I haven't seen the forge's check run on the new push yet.
The gate's comment-wrapping rule failed again, this time on four files I had touched. I merged the latest main into the branch and ran bun scripts/gate.ts --fix. It rewrapped comments in src/apps/proxy.ts, src/apps/runtime.ts, src/apps/toolbar.ts and test/toolbar-serving.test.ts. Those are the only changes in the commit, and I pushed it.
bun scripts/gate.ts and bun x tsc --noEmit pass. The two toolbar test files, test/apps-toolbar-state.test.ts and test/toolbar-serving.test.ts, pass (8 tests).
Before the merge, --fix found nothing to rewrap on the branch alone. So the failing check was probably judging the merged tree, not my branch.
I did not run the wider fast tier. After the merge, scripts/fast.ts listed far too many files, and that run timed out here, so I stopped it. The forge's own check will run it. The forge's check has not yet run on this push.
I merged main into this branch and pushed. The toolbar and proxy test files pass (162 tests), tsc is clean, and gate.ts --fix changed nothing. I did not run the full suite: scripts/fast.ts named 2685 files, over its 5-minute budget, so I ran only those toolbar and proxy tests. Chromium doesn't start in this sandbox, so test/toolbar-keyboard.test.ts was skipped.
- Conflict in
src/apps/toolbar.ts: only thePillWhere.servingtype conflicted. I kept this branch'schange?: stringfield, since the pill's "live · change · ago" line reads it, andmaindidn't use it. - Byte budget: the merge put the toolbar script 13 bytes over its 24 KB limit, which failed
test/toolbar-budget.test.tsandtest/apps-toolbar.test.ts. I shortened theagohelper by using| 0instead ofMath.floor. Its output is the same. - Left out: I made no other changes to the pull's behaviour.
I pushed a fix for the module-state failure. The other failing test, "an entry still waiting for its answer stays out of the fold" in test/thread-window.test.ts, I didn't change, and it passes when I run it here.
- Cause:
src/apps/landed.tskept the last-landed-change notes in a module-levelMap, whichtest/module-state.test.tsrefuses (state belongs to a forge, not the process). - Fix: the notes are now a
WeakMapkeyed by the forge's app object.noteLandedandlandedChangetake that object first, andruntime.tsandproxy.tspass the same key (this.appandruntime.app). The test intest/apps-toolbar-state.test.tspasses a forge object too. - Checked here:
tscis clean andgate.ts --fixchanged nothing.module-state, the toolbar tests andthread-windowall pass (96 tests). - Not checked: the full suite, so the thread-window failure is only judged by its passing locally, not by a repeat of the shard run. It touches nothing this pull changed, so I took it for a shard flake. If it fails again on this push, it needs a separate look.
Security is fine: the subject is escaped with escapeAttr and set as textContent, and it is read only behind the reads gate. Four things to fix in one round:
- Nothing tests the wiring. No test fails if
pillWherestops passingchange, or if the swap-in stops callingnoteLanded. Add a test that drivespillWhere(a reader getsserving.change, a non-reader gets none) and one for the runtime swap-in. - The 'no change yet' test only greps the script source for a string. Execute the toolbar script as
toolbar-serving.test.tsdoes and assert the rendered text for both cases. - Unrelated edits: remove the deleted comment in toolbar.ts and the comment rewraps that are not forced by the gate. The comment in runtime.ts is now above the wrong block.
- After every restart the map is empty, so every running app says 'no change yet', which is false. Fall back to reading the subject lazily outside the request path, or omit the line when unknown.
Pushed to the same branch. I addressed all four points, with one disagreement on point 3. The toolbar, landed-change and module-state tests pass (168 pass, 4 skipped) and tsc is clean. I did not run the full suite.
1. Wiring tests. New test/apps-landed-wiring.test.ts runs a real deploy on a private app:
- Swap-in: after the swap-in, the served commit's subject is noted. This fails if
noteLandedis dropped. pillWhere: a reader getsserving.change, and a stranger gets noservingat all. This fails ifpillWherestops passingchange.- Teardown: the note is gone afterwards.
I did not mutation-test these, so I haven't seen them fail with the wiring removed.
2. Rendered text. test/apps-toolbar-state.test.ts now runs the script through boot and asserts the rendered line, with and without a change. A change containing markup renders as plain text.
3. Unrelated edits.
- Deleted comment: restored in
toolbar.ts. - Runtime comment: the new block now sits above the "same statement…on the bus" comment, and a new comment says why the empty
catch {}is safe: a git read failure must not fail an already-live deploy. - Comment rewraps (disagree): the two rewrapped comments in
runtime.tsstay.gate.ts --fixrewrites them to the wrapped form whenever they differ, and the check runs the gate.
4. Empty map after a restart. I took your "omit the line" option. With no change known, the pill says live · 4 min ago, so it never claims "no change yet". I did not add a lazy git read after a restart, so an app shows no change until its next deploy.
Entries never removed. forgetLanded is called from AppsRuntime.teardown, so retired previews no longer accumulate in the map.
The check failed on a rule that bans as never in tests. I fixed it and pushed. Locally the gate, tsc --noEmit and test/apps-landed-wiring.test.ts (3 tests) all pass. I didn't wait for the forge's re-run of the check.
What changed: only test/apps-landed-wiring.test.ts.
pillWherenow gets a fullGrantWho(id,name,role: "user") built fromforge.alice, instead of{ id } as never.- The
target()helper is typed asAppTarget, which drops theas AppTargetcast that sat beside the flagged one.
Nothing changed in src, and no assertions were weakened. The rest of the pull is as before: the toolbar shows the served commit's subject, only for a reader, and a torn-down environment forgets it.
Try it: bun test test/apps-landed-wiring.test.ts.
Reviewed from the source and tests; I did not exercise the preview, which only shows the line inside an app page.
Two changes, both on the same line.
- Fix first: the issue (box 2) says an app with no landed change reads
no change yet. This head drops the segment and showslive · 4 min agoinstead, and the test asserts that. Restore the issue's wording:live · no change yet · <ago>.
- The map is empty after every restart or rollout, and it is only refilled at the next swap-in. Every running app then shows no change, and that is the common state in production. That is exactly what #6611 (the queue survives a rollout) is about. Note the subject where the runtime adopts or boots an already-running environment too, not only at the swap-in. Alternatively read it once, off the request path, on first sight of that commit. Add a test for the boot case.
Smaller points, not blocking on their own: the empty catch {} in runtime.ts swallows every error, so log one line there. test/apps-landed-wiring.test.ts ends with a stray blank line.
The security, escaping, no-query-on-request-path and CSP/nonce points are fine. This is also a feature pull while the direction says pipeline first, so keep it small.
The forge toolbar inside an app now reads live · <last landed change> · <ago>, with a link to the commit it serves. Each environment's last landed change is the first line of the commit message it serves, noted outside the request path: at the swap-in and when the forge boots. When nothing is noted, it reads live · no change yet · <ago>, as the issue asks. The change rides in the page escaped, and only for someone who can read the app.
This revision answers the review:
no change yet(src/apps/toolbar.ts): the line now prints the issue's wording instead of dropping the segment.test/apps-toolbar-state.test.tsandtest/toolbar-serving.test.tsasserted the old wording, so both were wrong and now assert the issue's text.- After a restart or rollout (
src/apps/runtime.ts): a newnoteChangehelper reads the commit's subject. The swap-in calls it, and so doesreconcileAppat boot: once for each production tip and once for each preview it brings back asleep. A preview woken later serves that same commit, so the note made at boot covers it. A dormant preview is redeployed when roused, so the swap-in notes it. This adds one git read per environment at boot, never on a request. - Boot test (
test/apps-landed-wiring.test.ts): a new test stops the runtime, clears the note to mimic a fresh process, and starts a new runtime. The note is there as soon asstart()returns, before any swap-in. With the boot call removed, the test fails. - Errors: a failed git read now logs one
warnline instead of an emptycatch {}. - Earlier check failure: the earlier commit on this branch replaced the
as nevercast in the wiring test with a real identity object, and the stray blank line at the end of that file is gone.
I left out branches the app keeps running from the boot note. They still get their note at their first swap-in, which keeps the change small.
Checks run locally: bun scripts/gate.ts --fix, bun x tsc --noEmit, and these tests: every test/toolbar- suite, test/apps-idle, test/apps-rollout, test/apps-sleep, test/apps-landed-wiring and test/apps-toolbar-state (109 pass, 4 skip, 0 fail). The 4 skipped suites need unix sockets, which this sandbox can't bind; the forge's check runs them. scripts/fast.ts named 2,686 files for this diff (about 226 minutes), so I chose these suites by hand.
To try it: run bun test test/apps-landed-wiring.test.ts test/apps-toolbar-state.test.ts, or open an app page on the preview and restart the forge.
🤖 Generated with Claude Code
Earlier asks are met. The wording is now the issue's live · <change> · <ago> / no change yet. A boot-time note covers a restart, so apps do not all say "no change yet" falsely. A git failure logs a warning instead of an empty catch. Wiring tests drive the swap-in, pillWhere (reader vs stranger), boot and teardown. The rendered text is asserted by running the script. The change is escaped via escapeAttr and set as textContent, read only behind the reads gate, with no query on the request path. The toolbar is not a feature with its own screen, so there is no TUI or docs obligation.
Two things I would do next:
- Non-blocking: note the change at boot for kept-running variant branches too; they say "no change yet" until their first swap-in.
- Non-blocking: the 60-char subject truncation counts UTF-16 units, so it can split a surrogate pair; truncate by code point.
The toolbar panel now has a line reading
live · <subject of the commit being served> · <ago>, orlive · no change yet · <ago>when no change is known for the running commit. It shows for any running environment the viewer may read.src/apps/landed.tsholds a small in-memory map from app and environment to the commit subject. The deploy swap-in insrc/apps/runtime.tsfills it. It already reads git there for the release subject, so this adds onecommitLogread there and nothing per page.pillWhereinsrc/apps/proxy.tsreads the map and passes the subject to the toolbar tag asdata-change. The map is empty after a restart until the next swap-in. A running app then reads "no change yet" until it deploys again.escapeAttr, and the client sets it astextContent. The subject is cut to its first line and 60 characters. The script grows by about 78 bytes and the tag by under 300, which the test checks.toolbar-serving.test.tsexpected the old ", live 4 min ago" suffix on the "Serving <sha>" line. I removed that suffix because it now repeats the new line, and the script was 2 bytes over its 24 KB budget with both. I updated that assertion to the new line.Verification:
bun x tsc --noEmit,bun scripts/design-lint.tsand the toolbar tests I ran all pass. That covers the nonce/CSP test, the budget test,toolbar-live,apps-toolbar,toolbar-servingand the newtest/apps-toolbar-state.test.ts.scripts/gate.tsandscripts/fast.tsare not in this clone, so I did not run them.Closes #13163