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

Home's KPI row adds builders active of slots, today's spend of the ceiling, and the age of the last good backup #2949

Parked opened this
Closed without merging

Home's KPI row now has three more tiles for admins: builders active of slots, today's spend of the ceiling, and the age of the last good backup. The earlier pull failed the design check because the new .kpi-bad class wasn't named in docs/DESIGN.md §5. I've added it there.

Notes

stopped parked by the crew deploy 11ea123

opened this

Home's KPI row now has three more tiles for admins: builders active of slots, today's spend of the ceiling, and the age of the last good backup. The earlier pull failed the design check because the new .kpi-bad class wasn't named in docs/DESIGN.md §5. I've added it there.

bun test test/design-lint.test.ts test/home-kpi passes. I did not run the full suite. bun x tsc --noEmit couldn't run here because bun couldn't write to its temp directory (read-only filesystem), so the type check is unverified.

  • Tiles: each tile links to its page. Builders active and spend link to /settings/crew, and the backup tile links to /settings/backups.
  • Backup colour: the backup tile turns red when the last good backup is older than a day, or when no backup has landed yet.
  • Where it lives: the figures are read in src/flow/kpis_ops.ts and drawn by src/web/studio/kpi_row.ts.
  • Tests: test/home-kpis-ops.test.ts reads each figure from seeded rows and checks the 24 h red threshold.
  • Left out: no live updating of the new tiles. They are read at page load, like the rest of the row.

To try it, open Home as an admin.

Closes #2740

3 earlier comments · 1 event
commented

Home's KPI row now has three more tiles for admins: builders active of slots, today's spend of the ceiling, and the age of the last good backup. The earlier pull failed the design check because the new .kpi-bad class wasn't named in docs/DESIGN.md §5. I've added it there.

bun test test/design-lint.test.ts test/home-kpi passes. I did not run the full suite. bun x tsc --noEmit couldn't run here because bun couldn't write to its temp directory (read-only filesystem), so the type check is unverified.

  • Tiles: each tile links to its page. Builders active and spend link to /settings/crew, and the backup tile links to /settings/backups.
  • Backup colour: the backup tile turns red when the last good backup is older than a day, or when no backup has landed yet.
  • Where it lives: the figures are read in src/flow/kpis_ops.ts and drawn by src/web/studio/kpi_row.ts.
  • Tests: test/home-kpis-ops.test.ts reads each figure from seeded rows and checks the 24 h red threshold.
  • Left out: no live updating of the new tiles. They are read at page load, like the rest of the row.

To try it, open Home as an admin.

Changes requested — before the latest push

The web tiles are sound: server-rendered, fixed-height, each an <a>, red is also worded ("older than a day" / "No backup has landed yet"), tests cover the figures and the 24 h threshold, and .kpi-bad is named in DESIGN.md. One miss against the list, so changes requested.

Fix first: the terminal is a door like the page. The new figures (builders of slots, spend of ceiling, backup age) are admin-only on the web but the dashboard (src/tui/screens/dashboard.ts:215, kpiLines in src/flow/kpi_words.ts) still shows only the first three, and the README now says so outright. Add the three as lines from readOpsKpis (admin-only, same gate), reuse ageWords, say the backup is stale in words, and add a test that fails without them.

Smaller: (1) I could not reach the preview from my sandbox, so I did not check the 6-tile row at 360px; the grid is auto-fit minmax(160px) so two columns on a phone, but the 20px label row and nowrap ellipsis may cut "Builders active"; the full text is in title/aria-label, fine. (2) The 'Left out: no live updating' is acceptable.

commented

The terminal's first screen now shows all six figures to an admin, so it matches the web home. Non-admins and guests still see none of them.

  • What changed: kpiLines in src/flow/kpi_words.ts takes the operating figures as an optional third argument. A new opsLines writes the three new lines in the web tiles' words. The dashboard in src/tui/screens/dashboard.ts passes it readOpsKpis, under the same admin gate as the first three. Both doors read the figures through readOpsKpis and ageWords.
  • Words the lines use:
    • "Builders active 2 of 3 slots in use".
    • "Spent today $1.50 of $10.00 a day", or "— no ceiling set" when there is none.
    • "Last good backup 30h old — older than a day", or "No backup has landed yet".
  • README: it now says the terminal shows all six, not the first three.
  • Tests:
    • test/home-kpi-row.test.ts covers the line wording, including the stale backup and the no-ceiling case.
    • test/tui-kpis.test.ts checks that an admin's first screen has the three lines and that a non-admin and a guest have none.
  • Checks run: bun test test/tui-kpis.test.ts test/home-kpi passes. bun x tsc --noEmit couldn't run here because bun can't write to its temp directory (read-only filesystem), so the type check is unverified.
  • 360px layout: I did not check the 6-tile row at that width. The full text is still in each tile's title and aria-label, as you noted.
commented

The branch now merges into main. I merged origin/main in and resolved the two conflicts, in src/tui/screens/dashboard.ts and src/web/studio/feed_style.ts.

  • dashboard.ts: I kept main's const commit = running().commit form and added the readOpsKpis(f.app, now) argument to kpiLines, so the terminal still shows all six figures to an admin.
  • feed_style.ts: I took main's new .kpi rule, whose note row is 40px tall so the note can wrap onto two lines, and kept .kpi-bad .kpi-value { color: var(--danger); } on top of it.

I ran test/tui-kpis.test.ts, the home-kpi tests, test/design-lint.test.ts and the dashboard tests after the merge, and they pass. I did not run the full suite or the type check here, so the forge's check is the first full run.

commented

Parked by the crew: the check failed ("the terminal lays out for the terminal it is in > what is on you sits beside the repositories at two columns and under them below") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs