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

A project's page is a table of its apps with state and ports, merged logs and its compose file, with Start all, Stop all and Update #18639

opened this

Merged 18m ago, goes live with the next release

A game box's compose project now opens at /infra/project/ as a table of its apps, with merged logs, its compose file, and Start all, Stop all and Update. Only the project and gate-related tests were run, not the whole suite.

Notes

opened this

A game box's compose project now opens at /infra/project/<box> as a table of its apps, with merged logs, its compose file, and Start all, Stop all and Update. Only the project and gate-related tests were run, not the whole suite. The new test/infra-project.test.ts passes, as do the first-view budget, attention and design-audit tests. The /infra/project/:box fixture was added to test/pages-budget.test.ts so that route stays inside the first-view budget. The forge's check will run the full suite.

I read "a compose project" as a game box, the only compose project the forge knows. Its apps are the services of its compose file.

What it does

  • Table: each app shows one of Running, Starting, Needs attention, Stopped or Can't tell, always as a word beside a colour, with the ports its compose file publishes.
  • Silent box: a box that hasn't checked in for two minutes makes every app Can't tell.
  • Needs attention: the app gives its reason in a sentence and one button, Restart or Start.
  • Logs: the box's synced lines, merged across apps with each line's app named. The waker never appears.
  • Compose file: shown to the box's owner only, since it can hold settings.
  • Buttons: Start all, Stop all and Update each say in a sentence what they will do, and none opens a dialog.
    • Start all and Stop all come back with an Undo, which is the other one.
    • Update says it has no Undo.
    • They ask the box through askPower, so a held box refuses them the same way it does for the container tab.
  • Who may act: may decides, and the actor must operate the whole box. A read-only token and a person with no grant are refused and nothing is asked.
  • Terminal: o on a box's row in Games opens src/tui/screens/project.ts. There s starts all, x stops all, u updates and z undoes the last start or stop.
  • Reaching it: the page is linked from a machine's containers pane, and docs/features/project.md is the how-to.
  • Reused: askPower, parseCompose, readCompose, mayOnGame, isSilent and the flash Undo. New modules are src/games/project.ts (state, ports, logs) and src/actions/project.ts (buttons).

Left out or different from the issue

  • Non-admin operators: all of /infra is admin-marked, so a non-admin operator never reaches the page. The may check inside the action still refuses them, and the test calls it directly. Moving the project page out of /infra would fix this and needs your call.
  • Container tab: the tab for #18488 is untouched. I added only one link above its containers table.
  • Update: it pulls, then recreates each app. The issue didn't say what Update means, so confirm that's what you want.
  • Apps outside a game box: a project that isn't a game box isn't covered.
  • Gate note: it says named in the new test resembles a helper in tui-thought-notes.test.ts. I left it as a note.
  • Looks: I wrote "No look" in a commit, because no page in app.looks reaches this admin route.

To try

  • Open /infra/project/<box> as an admin, or press o in the terminal's Games.
  • Review block: this is a page change and needs one, which I haven't written. Suggested steps:
    • Go to /infra/project/<box> as an admin. Look at the table. Expect a state word beside a colour and the published ports for each app.
    • Press Stop all. Expect "Stop all: asked N apps to stop" with an Undo button.
    • Press Undo. Expect Start all to run.

Closes #18603

5 earlier comments
commented

A game box's compose project now opens at /infra/project/<box> as a table of its apps, with merged logs, its compose file, and Start all, Stop all and Update. Only the project and gate-related tests were run, not the whole suite. The new test/infra-project.test.ts passes, as do the first-view budget, attention and design-audit tests. The /infra/project/:box fixture was added to test/pages-budget.test.ts so that route stays inside the first-view budget. The forge's check will run the full suite.

I read "a compose project" as a game box, the only compose project the forge knows. Its apps are the services of its compose file.

What it does

  • Table: each app shows one of Running, Starting, Needs attention, Stopped or Can't tell, always as a word beside a colour, with the ports its compose file publishes.
  • Silent box: a box that hasn't checked in for two minutes makes every app Can't tell.
  • Needs attention: the app gives its reason in a sentence and one button, Restart or Start.
  • Logs: the box's synced lines, merged across apps with each line's app named. The waker never appears.
  • Compose file: shown to the box's owner only, since it can hold settings.
  • Buttons: Start all, Stop all and Update each say in a sentence what they will do, and none opens a dialog.
    • Start all and Stop all come back with an Undo, which is the other one.
    • Update says it has no Undo.
    • They ask the box through askPower, so a held box refuses them the same way it does for the container tab.
  • Who may act: may decides, and the actor must operate the whole box. A read-only token and a person with no grant are refused and nothing is asked.
  • Terminal: o on a box's row in Games opens src/tui/screens/project.ts. There s starts all, x stops all, u updates and z undoes the last start or stop.
  • Reaching it: the page is linked from a machine's containers pane, and docs/features/project.md is the how-to.
  • Reused: askPower, parseCompose, readCompose, mayOnGame, isSilent and the flash Undo. New modules are src/games/project.ts (state, ports, logs) and src/actions/project.ts (buttons).

Left out or different from the issue

  • Non-admin operators: all of /infra is admin-marked, so a non-admin operator never reaches the page. The may check inside the action still refuses them, and the test calls it directly. Moving the project page out of /infra would fix this and needs your call.
  • Container tab: the tab for #18488 is untouched. I added only one link above its containers table.
  • Update: it pulls, then recreates each app. The issue didn't say what Update means, so confirm that's what you want.
  • Apps outside a game box: a project that isn't a game box isn't covered.
  • Gate note: it says named in the new test resembles a helper in tui-thought-notes.test.ts. I left it as a note.
  • Looks: I wrote "No look" in a commit, because no page in app.looks reaches this admin route.

To try

  • Open /infra/project/<box> as an admin, or press o in the terminal's Games.
  • Review block: this is a page change and needs one, which I haven't written. Suggested steps:
    • Go to /infra/project/<box> as an admin. Look at the table. Expect a state word beside a colour and the published ports for each app.
    • Press Stop all. Expect "Stop all: asked N apps to stop" with an Undo button.
    • Press Undo. Expect Start all to run.
commented

The project page at /infra/project/<box> now has no terminal screen. I removed it because main froze src/tui/screens in #18559, which was one of the three red checks. The other two are fixed too. I ran the affected tests locally and they pass, and the forge's full check has not run on this push yet.

  • Duplicate import: src/http/infra_routes.ts imported ../games/store.ts twice. It is now one import.
  • Walk's skipped list: test/no-polling.test.ts now names /infra/project/:box as unwalked, with its reason. The seed holds no game box, and test/infra-project.test.ts and the budget walk's own fixture cover the page.
  • Frozen terminal screens: I merged main, deleted src/tui/screens/project.ts and dropped its o key from Games. docs/features/project.md now says the terminal door is missing. The commit carries a No door: line giving the reason.

One local run of test/no-polling.test.ts failed on its 5 s timeout while other tests were running. It passes when run alone.

Left out: the terminal door. It has to be a command in src/cli over a public API route for starting, stopping and updating a project. That route doesn't exist, and I didn't build it here.

Gate notes: bun scripts/gate.ts still prints a note that test/infra-project.test.ts#named looks like test/tui-thought-notes.test.ts#mk, and I didn't act on it. It also notes long comments in four files, and --fix ran without leaving anything to commit.

commented

I fixed one of the two failures and pushed. The other, the big-blob test, I couldn't reproduce, so I changed nothing for it.

  • Seed list: test/security-floor-routes.test.ts now names /infra/project/:box among the routes its seed can't fill. The seed has no game box, and test/infra-project.test.ts covers the page. That test and test/large-blobs.test.ts both pass locally, 32 tests in all, and bun x tsc --noEmit is clean.
  • Big-blob test: test/large-blobs.test.ts passes here. The check log also says it is green on main in 3 runs, and this pull doesn't touch that code, so I'm treating the red as a shard flake.
  • Main: I merged the latest main first.

The security-floor run printed two SQLITE_IOERR lines from its scratch database, but the tests still passed.

I haven't seen the forge's new check result yet.

commented

I merged main into the branch and pushed it. The one conflict was in the import block of src/web/pages/infra.ts, and I kept both sides: main's fiveBlock and machineFive imports, and this pull's badge and emptyLine.

bun x tsc --noEmit is clean. The tests for the project page, the router walks, duplicate imports, frozen terminal screens and the 332 infra and machine tests all pass locally. I haven't seen the forge's check on this push yet.

The sandbox blocked four *.forge.test hosts during the machine tests. The tests still passed.

commented

A project's page at /infra/project/<box> is a table of its apps with state and ports, merged logs, its compose file, and Start all, Stop all and Update. This round answers sentinel's six points. tsc, the design lint and test/infra-project.test.ts (11 tests) pass, as does the gate's --fix. I haven't run the full suite, which the forge's check does.

Changes

  • State: the project's own STATES, TONE and stateOf vocabulary is gone. stateOf now calls containerFive, the same mapping the containers table uses, and the page draws it with fiveBadge. Only the reason and the one fix button stay in the project code.
  • Undo: Start all and Stop all now report which apps they actually asked. The Undo posts them as a names field, and the opposite act acts on those names alone. A test shows an app left alone stays alone. If the names would run past the 200-character flash-field limit, the Undo is left off. Update still has no Undo.
  • Tests: added a test for the Start button of a dead app, and stateOf cases for restarting, dead and paused. Under the five states, paused is Stopped with no button, not Needs attention. So Start belongs to dead apps only, and I changed the test to match.
  • Logs: mergedLogs now filters by service in SQL, so it returns the newest 200 lines of the shown apps. A test with a chatty hidden app covers it.
  • Doors: the first commit line says No door: src/tui/screens is frozen (#18559)…. docs/features/project.md says there is no terminal door. It also states the limit that non-admin operators cannot reach the page because it sits under /infra, and it describes the new Undo and the logs cap.

Review block

[
  {"go": "/infra/project/<box>", "look": "the apps table", "expect": "each app has the forge's five-state badge (a word beside its colour) and its ports; a failing app gives its reason and one button"},
  {"go": "Press Start all", "look": "the flash message", "expect": "it names how many apps were asked, and the Undo stops only those apps"},
  {"go": "Press Stop all", "look": "the flash message", "expect": "its Undo starts only the apps that were running and got stopped"},
  {"go": "/infra/project/<box>", "look": "the Logs section", "expect": "merged lines from the shown apps only, each with its app named, never the waker"}
]

I did not add a terminal screen or an API route for the page, and I did not move it out from under /infra.

commented

I merged main into the branch and pushed it. tsc is clean, test/infra-project.test.ts passes (11 tests), and the gate's --fix changed nothing. I haven't run the full suite, which the forge's check does.

The only conflict was in the import block of src/http/infra_routes.ts. Both sides edited the games/store.ts import, so I kept the page's names (mayDo, roleOn, seesBox) together with main's type GameBox.

The page's behaviour is unchanged from the last round, and the review block in the earlier description still applies.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs