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

small: every container, project and machine shows one of five states, each a colour with a word #18633

opened this

Merged 48m ago, live in production

Every container, machine and project on Infrastructure now shows one of five states: Running, Starting, Needs attention, Stopped or Can't tell. Each state is a coloured badge with its word. I ran the container, cloud-tree, infra and new five-state tests, plus the rest of the files listed below.

Notes

opened this

Every container, machine and project on Infrastructure now shows one of five states: Running, Starting, Needs attention, Stopped or Can't tell. Each state is a coloured badge with its word. I ran the container, cloud-tree, infra and new five-state tests, plus the rest of the files listed below. They pass, and tsc and bun scripts/gate.ts are clean. I did not run the page-budget tests, the full suite or a booted app.

What changed

  • src/machines/five_states.ts is the one mapping. It has one table per raw state: Docker's states, a container's health check, and a machine row's state. Any state not in a table is Can't tell and says it doesn't know the word. A box that hasn't synced in two minutes is Can't tell too.
  • Needs attention gives a plain reason and one fix:
    • A failing health check offers Restart.
    • A dead container offers Start.
    • A failed machine with nothing at its provider offers Clear this row.
  • A project (a machine and its containers) is its worst container. A machine with no containers on record is Can't tell.
  • On the page, src/web/five_badge.ts draws the badge, reason and fix button. It is used in the Infrastructure machine rows, the cloud-tree rows and container table, and the container and machine pane. The old Clear button in the machine actions is replaced by this one, so there is a single button.
  • In the terminal, src/tui/screens/infra.ts and src/tui/screens/cloudtree.ts show the same words. In the cloud tree, f restarts or starts the selected container. In Infrastructure, c still clears a dead row.
  • test/five-states.test.ts lists every raw state and its mapping. It also checks that the word is always present, that prototype names like constructor are not states, and how a project combines its containers.
  • I changed three existing assertions in test/cloud-containers.test.ts and test/infra-page.test.ts because their expected text was the old raw state. They now expect "Running" and "Stopped", and the machine-row markup. I added one assertion that a failed machine row has one fix button.
  • The how-to is a new section in docs/features/infra.md.

What I left out

  • /games server rows and the topology still use their own wording (nowWords, netState). Those pages aren't tree rows or infra views, so I left them.
  • A project's reason names the failing container, but its button isn't drawn, because a project has no single fix target. The container's own row has the button.
  • Runner heartbeats (idle, busy, paused) are not mapped. They describe work, not whether the machine is up.
  • A restarting container maps to Starting, matching existing /games behaviour. A crash loop therefore doesn't show as Needs attention.

Commit lines

  • The gate asks for a "No door" line because the two new modules are helpers that the existing terminal screens import.
  • No page in app.looks shows /infra, so the commit says "No look" instead of naming one.

Try

  • Open /infra to see machine rows with state, reason and button.
  • Open /infra/-/<cloud>/<account>/<project>/machine:<id>/container:<name> for a container.

I found no similar function elsewhere in the repo to reuse beyond statusBadge, row and btn in the web UI. The existing progressOf and netState mappings are left as they are.

🤖 Generated with Claude Code

Closes #18617

commented

Every container, machine and project on Infrastructure now shows one of five states: Running, Starting, Needs attention, Stopped or Can't tell. Each state is a coloured badge with its word. I ran the container, cloud-tree, infra and new five-state tests, plus the rest of the files listed below. They pass, and tsc and bun scripts/gate.ts are clean. I did not run the page-budget tests, the full suite or a booted app.

What changed

  • src/machines/five_states.ts is the one mapping. It has one table per raw state: Docker's states, a container's health check, and a machine row's state. Any state not in a table is Can't tell and says it doesn't know the word. A box that hasn't synced in two minutes is Can't tell too.
  • Needs attention gives a plain reason and one fix:
    • A failing health check offers Restart.
    • A dead container offers Start.
    • A failed machine with nothing at its provider offers Clear this row.
  • A project (a machine and its containers) is its worst container. A machine with no containers on record is Can't tell.
  • On the page, src/web/five_badge.ts draws the badge, reason and fix button. It is used in the Infrastructure machine rows, the cloud-tree rows and container table, and the container and machine pane. The old Clear button in the machine actions is replaced by this one, so there is a single button.
  • In the terminal, src/tui/screens/infra.ts and src/tui/screens/cloudtree.ts show the same words. In the cloud tree, f restarts or starts the selected container. In Infrastructure, c still clears a dead row.
  • test/five-states.test.ts lists every raw state and its mapping. It also checks that the word is always present, that prototype names like constructor are not states, and how a project combines its containers.
  • I changed three existing assertions in test/cloud-containers.test.ts and test/infra-page.test.ts because their expected text was the old raw state. They now expect "Running" and "Stopped", and the machine-row markup. I added one assertion that a failed machine row has one fix button.
  • The how-to is a new section in docs/features/infra.md.

What I left out

  • /games server rows and the topology still use their own wording (nowWords, netState). Those pages aren't tree rows or infra views, so I left them.
  • A project's reason names the failing container, but its button isn't drawn, because a project has no single fix target. The container's own row has the button.
  • Runner heartbeats (idle, busy, paused) are not mapped. They describe work, not whether the machine is up.
  • A restarting container maps to Starting, matching existing /games behaviour. A crash loop therefore doesn't show as Needs attention.

Commit lines

  • The gate asks for a "No door" line because the two new modules are helpers that the existing terminal screens import.
  • No page in app.looks shows /infra, so the commit says "No look" instead of naming one.

Try

  • Open /infra to see machine rows with state, reason and button.
  • Open /infra/-/<cloud>/<account>/<project>/machine:<id>/container:<name> for a container.

I found no similar function elsewhere in the repo to reuse beyond statusBadge, row and btn in the web UI. The existing progressOf and netState mappings are left as they are.

🤖 Generated with Claude Code

commented

All four review points are fixed and pushed. I did not boot the app, so I haven't looked at /infra at 360px.

  • Accent per row: the fix button in src/web/five_badge.ts is now ghost/sm, so a list of failing rows draws no accent. A new test checks the button is ghost.
  • Two ways to restart: fiveHead in src/web/pages/cloud_tree.ts now shows only the reason when the pane already draws the power control (game?.power). Containers without that control keep the one Restart/Start fix.
  • Project fix: a project that Needs attention now draws its worst container's fix, posting to that container's route.
  • Crash loop: restarting now maps to Needs attention, with the reason "it keeps restarting, which is a crash loop" and a Restart fix. This also made the project's worst-of rule show it. I updated the mapping assertion in test/five-states.test.ts, which pinned the old value, and added a crash-loop test.
  • Docs: the doubled blank line is gone from docs/features/infra.md. The terminal bullet now names its screens: f on the cloud tree for Restart/Start, c on the Infra machine list for Clear.
  • 360px: I added a rule in src/web/style/components.ts so a row's meta wraps and the block can't push the button off the edge. This is the part to check by eye.
  • Terminal door: the commit says No door:. src/tui/ already shows the same words, and its f key restarts a crash-looping container, so nothing new is needed there.

tsc is clean. The five-states, cloud-tree, infra-page, web-budget, design-audit and audit tests pass, and design-lint and the gate pass. I did not run the full suite; the forge's check does that on the push.

🤖 Generated with Claude Code

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs