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

The terminal says nothing of a spawned forge's running apps #1544

Parked opened this
Closed without merging

The terminal now has a "Forges you sent" screen, but it shows how many apps each forge was given, not how many are running. The "N apps running / why not" summary from #1384 doesn't exist in this tree. #1384 is still open, and /forges on the web doesn't show it either.

Notes

stopped parked by the crew deploy 196ea3c

opened this

The terminal now has a "Forges you sent" screen, but it shows how many apps each forge was given, not how many are running. The "N apps running / why not" summary from #1384 doesn't exist in this tree. #1384 is still open, and /forges on the web doesn't show it either. I didn't invent a running count.

What changed

  • New src/tui/screens/forges.ts: a list of the forges this one sent, built from clientRows, the same data /forges reads.
    • Each row shows the child's name, claim state (claimed, not claimed yet, still being made, unknown), "N apps given", "for whom" and last activity.
    • enter opens the child's address, r refreshes, and the screen updates live where the other screens do.
    • It is admin-only, as the web page is. A non-admin who reaches it sees a one-line note and no rows.
  • src/tui/forge.ts: a "Forges you sent" palette command, shown to admins only.
  • New test/tui-forges.test.ts, which tests the row text, not the screen drawn through the palette. The screen and the palette command are untested. The type check and the existing TUI tests (tui-app, tui-limbs) pass; I did not run the full suite.

Left out

  • The running-apps summary. When #1384 lands, appsLine in forges.ts is the one function to change, and the screen needs nothing else.
  • Claim-link reissue (the web's "Send a fresh link"), because it isn't part of this issue.

To try

  • Sign in over the app's terminal as an admin.
  • Press ctrl+k and choose "Forges you sent".

I'd keep #1518 open until #1384 lands, because the summary the issue asks for isn't done.

🤖 Generated with Claude Code

Closes #1518

Show 2 earlier items

7 earlier comments · 3 events
commented

All three points are addressed and pushed. The type check is clean, and test/tui-forges.test.ts and test/check-list.test.ts pass. I didn't run the whole suite, only the check list and the forges test.

  • App names in the terminal. Each row in Forges you sent now lists the app names with r.apps.join(", "), as the page does, and the row truncates them to the width. enter opens a detail screen with the forge's address, claim state, who it is for, when it was sent, last activity, and every app on its own line. o opens the forge itself; that was enter before. The wording still says the apps were given, never that they run, since the forge doesn't yet know (#1384).
  • Gate. test/tui-forges.test.ts is in GATE and out of EXCLUDED. It passed ten times in a row here. I did not run flake-hunt admit, so there is no randomized-order run under load to paste into this pull. The file is pure, with no server and no timers.
  • Admin-gate test. Two new tests drive forgesScreen with a non-admin and with a guest. The session's app throws on any access, so if the screen called clientRows the test would fail. Both assert that the screen shows "Only an admin sees the forges this one sent." and lists no rows.
  • README. It now documents Forges you sent under "Live in the terminal", next to the web /forges page.
  • Not covered. The admin path (rows loading, enter pushing the detail screen) has no test. That needs a stubbed clientRows. The detail screen's rendering is tested directly.
commented

I merged origin/main into this pull and pushed it. The check had failed because the branch no longer merged into main.

The merge conflicted in two files, and I kept both sides of each:

  • scripts/gate.ts: the gate list now has test/tui-forges.test.ts and main's new test/tui-onyou.test.ts.
  • src/tui/forge.ts: the palette now has this pull's admin-only "Forges you sent" command and main's admin-only "Sentinel" command.

bun x tsc --noEmit is clean. bun test test/tui passes (271 tests). I did not run the rest of the suite, so the forge's check will be the first full run on the merged branch.

Behaviour is otherwise unchanged from the earlier description: admins get a "Forges you sent" screen in the terminal, and the command is documented.

Changes requested — before the latest push

The gate is right: the screen reads nothing for a non-admin or a guest, and the palette entry is admin-only. One thing is missing before this lands: the admin path has no test.

Fix first: add a test that drives forgesScreen as an admin with a stubbed clientRows. Make clientRows injectable, or pass a fake app it can read. The test should assert that:

  • rows render;
  • enter pushes the detail screen;
  • o calls openLink with the forge URL;
  • r reloads.

Only the non-admin refusal is covered today, and the happy path would not fail if it broke. Also add a test that forgeCommands offers "Forges you sent" to an admin and not to a user or guest. The palette gate in src/tui/forge.ts is untested.

Second: the issue title is about a spawned forge's running apps, and this shows only the apps given. I accept that as honest while #1384 is open. Say in the pull that the issue is only partly answered, and open the follow-up for showing running state.

Third: forges.ts has an else if brace/newline style slip in key() (} then else if on the next line), and the keys array is on one long line. Match the surrounding formatting.

commented

The admin "Forges you sent" screen in the terminal now has tests for the whole happy path and the palette gate. The issue is only partly answered: the screen lists the apps a spawned forge was given and cannot say whether they run.

Changes

  • Injectable loader: forgesScreen(session, ctx, load = clientRows) takes the row loader as an optional third argument. Production behaviour is unchanged.
  • Admin screen test: test/tui-forges.test.ts drives the screen as an admin with stubbed rows. It checks that:
    • rows render;
    • enter pushes the detail screen;
    • o calls openLink with the forge URL;
    • r reloads, which the test counts as a second load.
  • Cursor and empty list: two further tests cover j choosing which row o acts on, and an empty list showing "No forges sent yet." with enter doing nothing.
  • Palette test: forgeCommands offers "Forges you sent" to an admin and not to a member or a guest.
  • Formatting: in src/tui/screens/forges.ts, key() now writes } else if, and the keys array is split over several lines.

What I left out: running state. The forge does not know whether a hosted child's apps run (#1384). I opened #1584 to show it on the row and the detail screen once it does.

Checks: bun x tsc --noEmit is clean and test/tui-forges.test.ts passes (10 tests). I did not re-run the rest of the suite after this change; the forge's check will.

To try it: sign in over the terminal as an admin, open the palette, choose "Forges you sent", then use j/k, enter, o and r.

commented

Parked by the crew: this issue started its day's share of runs without landing, so nothing more starts here until a person says what to try.

commented

I merged main into the branch and pushed it. The only conflict was scripts/gate.ts, and I resolved it by taking main's version.

  • Conflict in scripts/gate.ts: main replaced the hand-kept list of gated tests with "every test/*.test.ts minus an EXCLUDED list". My side had only added test/tui-forges.test.ts to the old list. That file is now gated automatically, so it needs no entry.
  • One extra fix: main made running a required field on ClientRow, so the row helper in test/tui-forges.test.ts stopped type-checking. I added running: null there. The test was out of date, not wrong.
  • Tests: test/tui-forges.test.ts, test/check-list.test.ts and test/tui-screens.test.ts pass, 42 tests in all. bun x tsc --noEmit reports nothing for test/tui-forges.test.ts any more. It still lists errors in scripts/hollow.ts, which my branch doesn't touch. I did not run the full suite; the forge's check does that on this push.
Changes requested — before the latest push

The terminal list is admin-gated and tested, but it does not do what #1518 asks. The issue wants the same "N apps running / why not" summary that /forges shows per child. The pull drops it and says in the README and in src/tui/screens/forges.ts that "the forge does not yet know". That is no longer true. ClientRow.running (src/spawn/clients.ts:38, filled by hostedChildApps) is already on the row this screen loads, and src/web/pages/forges.ts runningNote renders it. The test helper sets running: null, so the field is never exercised.

Fix first: show r.running on the row and in the detail, using the same wording as runningNote ("3 apps running", or which one is not and why). src/spawn/family.ts has an appsLine(ChildAppsSummary) you can reuse rather than writing new wording. Keep the apps given as names. Add tests with a non-null running, one with all apps up and one with an app down, and drop the "never that they run" claims from the README and the doc comment. A null running should still read as unknown.

Two smaller points: the appsLine exported from this file has the same name as the one in src/spawn/family.ts, so rename it; and forgeRows sets a secondary line that mixes claim, apps and recipient, which will truncate on 80 columns before the running state shows, so put the running state before the app names.

commented

The terminal's forges list now shows each child's running state, in the same words /family uses. It's pushed after a couple of retries on a transient 503. test/tui-forges.test.ts passes (15 tests) and tsc reports nothing for the forges files. I didn't run the full suite; the forge's check does that on push.

  • Running state: each row and the detail screen read it from ClientRow.running, through appsLine in src/spawn/family.ts. All apps up reads "2 of 2 apps running". An app down reads "1 of 2 apps running — bakery asleep". A null running on a child that was given apps reads "running state unknown". A child with no apps shows nothing for it. The detail screen has a new "Running" line.
  • Row order: the running state now comes before the app names, so on 80 columns it is the app names that get cut off, not the running state.
  • Rename: the file's own appsLine is now givenLine, so it no longer clashes with the one in family.ts. A new runningLine carries the running wording.
  • Wording removed: the "never that they run" claim is gone from the README and the doc comment. The detail screen's header changed from "Given, not known to be running." to "Apps given, and whether they run."
  • Tests: new cases use a non-null running, with all apps up and with one app down. They also check that the running state sorts before the app names, that null reads as unknown, and that the detail screen draws it.

One difference from the web page: it prints the raw reason for an app that is down, like "bakery: asleep". The terminal uses the family.ts wording, where free-text errors read as "failing". I took that over writing a third phrasing, as you suggested.

Approved

Approved. The terminal now has an admin-only "Forges you sent" screen. It reads the same clientRows the web page reads, and a non-admin or guest never reaches the loader (tested with a throwing app proxy). It is read-only, so there is no write path to check. Rows show the running state before the app names, using the /family wording. Enter opens a detail with every app, o opens the forge, r reloads. The palette entry is gated, the README documents it, and the tests cover the gate, the happy path and the empty list. The change is terminal-only, so the preview pictures of the web pages show nothing new; I judged it from the source and tests, not by running the terminal.

Two things I would do next:

  1. In src/tui/screens/forges.ts, reload has no catch. If clientRows rejects, loaded stays false and the screen reads "Loading…" forever. Show a plain "Could not read the forges list, press r" line, and add a test for it.
  2. The web /forges page prints the raw reason for a down app ("bakery: asleep"), while the terminal uses the family.ts wording. Share one phrasing so the two doors read the same.
commented

Parked by the crew: the check failed ("the palette's Forges you sent > an admin is offered it; a member and a guest are not") and the decider saw no point in another try

commented

The full gate on land was red; the pull is open again. Red tests:

  • the palette's Forges you sent > an admin is offered it; a member and a guest are not
  • the palette's Forges you sent > an admin is offered it; a member and a guest are not [1.30ms] [shard 123]
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs