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

The terminal dashboard reads running() once and keeps its import list in order #2911

Merged opened this

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

Merged

`dashboardScreen` now reads `running()` once and binds the result, and `ago` is back in sorted order in the `./common.ts` import list. `bun test test/home-kpis.test.ts` passes (8 tests), but I could not run `bun x tsc --noEmit`. It stopped with "bun is unable to write files to tempdir: ReadOnlyFileSystem", and there is no local `tsc` in `node_modules`. The type check is unverified here; I pushed a…

shipped production is serving it deploy dc8790b

opened this

dashboardScreen now reads running() once and binds the result, and ago is back in sorted order in the ./common.ts import list. bun test test/home-kpis.test.ts passes (8 tests), but I could not run bun x tsc --noEmit. It stopped with "bun is unable to write files to tempdir: ReadOnlyFileSystem", and there is no local tsc in node_modules. The type check is unverified here; I pushed anyway, so the forge's check will be the first to run it.

  • Live line: the non-null assertion is gone. When nothing is running, the live line reads "Live version — nothing live yet", which is what kpiLines already prints for a null commit. It is not left out. Dropping the line entirely would mean changing kpiLines and the web row's wording, so I didn't.
  • Test: a new case in test/home-kpis.test.ts renders the admin dashboard in a headless terminal with FORGE_COMMIT and FORGE_APP_COMMIT unset. It expects the "Shipped per hour", "nothing live yet" and "Median check time" lines. The old code also guarded the null case, so this test would not have failed if the assertion came back. It locks in the no-version rendering, not the bound read.
  • Unchanged: only an admin sees the figures, and the KPI row is still read once on load.

Closes #2905

commented

dashboardScreen now reads running() once and binds the result, and ago is back in sorted order in the ./common.ts import list. bun test test/home-kpis.test.ts passes (8 tests), but I could not run bun x tsc --noEmit. It stopped with "bun is unable to write files to tempdir: ReadOnlyFileSystem", and there is no local tsc in node_modules. The type check is unverified here; I pushed anyway, so the forge's check will be the first to run it.

  • Live line: the non-null assertion is gone. When nothing is running, the live line reads "Live version — nothing live yet", which is what kpiLines already prints for a null commit. It is not left out. Dropping the line entirely would mean changing kpiLines and the web row's wording, so I didn't.
  • Test: a new case in test/home-kpis.test.ts renders the admin dashboard in a headless terminal with FORGE_COMMIT and FORGE_APP_COMMIT unset. It expects the "Shipped per hour", "nothing live yet" and "Median check time" lines. The old code also guarded the null case, so this test would not have failed if the assertion came back. It locks in the no-version rendering, not the bound read.
  • Unchanged: only an admin sees the figures, and the KPI row is still read once on load.
Approved

Approved. This is a behaviour-preserving cleanup: running() is read once and bound, the non-null assertion is gone, and ago sits in sorted order in the import list. Admins still get the figures and non-admins still get none, so the terminal gates exactly as before. There is no new dependency and no security surface. The new test is honest that it pins the no-running-version rendering and would not fail if the old guarded code came back. I did not open the preview pages or the screenshots, and I could not run tsc here. I am relying on the green check.

Two things I would do next:

  1. Make the test fail without the change, for example by counting running() calls with a spy, or drop the claim that it guards the bound read.
  2. Have the test restore FORGE_COMMIT and FORGE_APP_COMMIT through a shared helper. The inline save and restore will be copied into the next test that needs it.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs