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

The /infra first page shows the costliest resources as a sortable table #17955

opened this

Merged 19h 12m ago, live in production

With no resource chosen, the /infra pane now shows the costliest resources in one table, in the order src/cloud/tree.ts already gives (costliest first). The other /infra tests I ran (cloud-tree, infra-page, cloud-page-shape), tsc, design-lint and the gate pass.

Notes

opened this

With no resource chosen, the /infra pane now shows the costliest resources in one table, in the order src/cloud/tree.ts already gives (costliest first). The other /infra tests I ran (cloud-tree, infra-page, cloud-page-shape), tsc, design-lint and the gate pass. I did not run the full suite or the other tests that cover the terminal screens and the JSON/MCP doors.

What changed (src/web/pages/cloud_tree.ts)

  • Columns: Resource (links to the resource), Kind, Where (cloud ▸ account ▸ region) and Monthly cost.
  • Cost wording: $12.00 list price, $12.00 billed, or unknown. An unknown cost never shows as $0.
  • Filter line: it narrows the same table. Headers sort through the existing listTable and sort terms.
  • Sums and size limits: the page adds no sums of its own. The table is capped at the existing 200 rows (PANE_ROWS), with the usual "filter to see the rest" note.
  • No new script or CSS: no client script was added, and the page reuses the existing listTable styles.
  • Reused: listedOf, listTable, CLOUD_COLUMNS, cloudCell and cloudName.
  • "Where it goes" removed from the root: the table replaces it at the root. Branch panes (cloud, account, region) still show it.

Test: test/cloud-tree.test.ts has a new test that renders the root and checks the rows. It covers list-priced and unknown resources, the Where text, the order matching costliestOf, no $0.00, and q=cloud:hetzner narrowing to one row.

  • Billed not covered: that fixture has no billed resource row, because a bill belongs to a region, not a resource. The billed wording is written but not asserted.
  • Changed assertion: I changed one assertion in an existing test. It looked for "Where it goes" and a hint line that came from that block. It now looks for data-costliest.

Left out

  • Terminal: I made no change to the terminal screen, so the commit says No door: with the reason. src/tui/screens/cloudtree.ts already lists the resources with costs and the same filter line, but it still says "Where it goes".
  • Looks: the commit says No look: because /infra is admin-only and has no sample page among the forge.json app.looks.
  • Billed: nothing was added to show a billed cost per resource.

Try it: open /infra as an admin on the preview with no resource chosen, then add ?q=cloud:hetzner and click a column header.

[
 {"go":"/infra","look":"One table titled 'N resources' with columns Resource, Kind, Where, Monthly cost","expect":"List-priced rows read '$12.00 list price'; resources without a price read 'unknown', never $0; priced rows come first"},
 {"go":"/infra?q=cloud:hetzner","look":"The same table, narrowed","expect":"Only Hetzner resources remain; the heading is hidden and the filter line shows the term"},
 {"go":"/infra","look":"Click the 'Where' column header","expect":"URL gains q=sort:region and the rows reorder by region","ask":"Does 'AWS ▸ main ▸ us-east-1' read clearly as cloud ▸ account ▸ region?"}
]

🤖 Generated with Claude Code

Closes #17952

2 earlier comments
commented

With no resource chosen, the /infra pane now shows the costliest resources in one table, in the order src/cloud/tree.ts already gives (costliest first). The other /infra tests I ran (cloud-tree, infra-page, cloud-page-shape), tsc, design-lint and the gate pass. I did not run the full suite or the other tests that cover the terminal screens and the JSON/MCP doors.

What changed (src/web/pages/cloud_tree.ts)

  • Columns: Resource (links to the resource), Kind, Where (cloud ▸ account ▸ region) and Monthly cost.
  • Cost wording: $12.00 list price, $12.00 billed, or unknown. An unknown cost never shows as $0.
  • Filter line: it narrows the same table. Headers sort through the existing listTable and sort terms.
  • Sums and size limits: the page adds no sums of its own. The table is capped at the existing 200 rows (PANE_ROWS), with the usual "filter to see the rest" note.
  • No new script or CSS: no client script was added, and the page reuses the existing listTable styles.
  • Reused: listedOf, listTable, CLOUD_COLUMNS, cloudCell and cloudName.
  • "Where it goes" removed from the root: the table replaces it at the root. Branch panes (cloud, account, region) still show it.

Test: test/cloud-tree.test.ts has a new test that renders the root and checks the rows. It covers list-priced and unknown resources, the Where text, the order matching costliestOf, no $0.00, and q=cloud:hetzner narrowing to one row.

  • Billed not covered: that fixture has no billed resource row, because a bill belongs to a region, not a resource. The billed wording is written but not asserted.
  • Changed assertion: I changed one assertion in an existing test. It looked for "Where it goes" and a hint line that came from that block. It now looks for data-costliest.

Left out

  • Terminal: I made no change to the terminal screen, so the commit says No door: with the reason. src/tui/screens/cloudtree.ts already lists the resources with costs and the same filter line, but it still says "Where it goes".
  • Looks: the commit says No look: because /infra is admin-only and has no sample page among the forge.json app.looks.
  • Billed: nothing was added to show a billed cost per resource.

Try it: open /infra as an admin on the preview with no resource chosen, then add ?q=cloud:hetzner and click a column header.

[
 {"go":"/infra","look":"One table titled 'N resources' with columns Resource, Kind, Where, Monthly cost","expect":"List-priced rows read '$12.00 list price'; resources without a price read 'unknown', never $0; priced rows come first"},
 {"go":"/infra?q=cloud:hetzner","look":"The same table, narrowed","expect":"Only Hetzner resources remain; the heading is hidden and the filter line shows the term"},
 {"go":"/infra","look":"Click the 'Where' column header","expect":"URL gains q=sort:region and the rows reorder by region","ask":"Does 'AWS ▸ main ▸ us-east-1' read clearly as cloud ▸ account ▸ region?"}
]

🤖 Generated with Claude Code

commented

I pushed the three fixes to the branch. The /infra first page and the terminal now show the same table. The cloud-tree, tui-client-clouds, cloud-doors, infra-page, feature-doors and doorless tests pass, along with tsc, design-lint and the gate. I did not run a "dead code" test (no test file with that name turned up) or the full suite.

  • Billed wording tested: costWords(money) is now a pure function in src/cloud/tree.ts. A new test checks $40.00 billed, $40.00 list price and unknown. I tested the function directly rather than adding a billed fixture. In the code today a resource row only gets a billed cost from costFrom === "billed", and the provider code I read marks only a region or project total that way. A billed resource row can't be seeded through normal reads.
  • Where text pinned: the test now asserts exact rows for web, box and vol-2:
    • web: DigitalOcean ▸ main ▸ site
    • box: Hetzner Cloud ▸ eu ▸ games
    • vol-2: AWS ▸ main ▸ us-east-1

    These resources have a region or a project, so the "no region" fallback to the project name isn't asserted separately.

  • Terminal in line with the page: whereOf, FIRST_COLUMNS and firstCell moved into tree.ts, so the page and the terminal build their cells from the same code. The terminal had no "all clouds" pane. It previewed whichever row the cursor was on, so I made the pane the first-page table when the cursor is at the top and nothing is opened. Moving down previews that row as before, and "Where it goes" is gone from the root.
  • Terminal tradeoff: the very first row (the first cloud) is no longer previewed by hovering. Enter opens it.
  • How-to: docs/features/infra.md has a new "First page" bullet. The "No door" line is replaced by a real terminal change.
  • largest(): it is still used by the branch panes at cloud_tree.ts:290, and largestCosts by the terminal's branch panes, so nothing in them is dead. costWords has a caller in the page's cost cell title, and FIRST_COLUMNS and firstCell have callers in both doors.
  • Preview: /infra answers 303 without an admin session, so I only checked the rendered rows through the tests.
[
 {"go":"/infra","look":"One table: Resource, Kind, Where, Monthly cost","expect":"Rows read '$12.00 list price' or 'unknown'; Where reads 'DigitalOcean ▸ main ▸ site'"},
 {"go":"/infra?q=cloud:hetzner","look":"The same table, narrowed","expect":"Only Hetzner rows"},
 {"go":"ssh in, open Cloud resources","look":"Cursor on the first row, nothing opened","expect":"The right pane is the same four columns with the same words; press j and it previews the highlighted branch","ask":"Is a first page that appears only with the cursor at the top clear enough in the terminal?"}
]

🤖 Generated with Claude Code

commented

I merged main into the branch and pushed it. The only conflict was in src/tui/screens/cloudtree.ts.

How I resolved it:

  • Main's change kept: its new container table, in the line that returns a resource's pane.
  • My change kept: the first-page table for the root, with FIRST_COLUMNS and firstCell.

The page, the tree and the how-to merged without conflicts.

After the merge, tsc, design-lint and the gate pass. So do the tests that touch this change (cloud-tree, tui-client-clouds, cloud-doors, infra-page). I did not run the full suite.

The pull description stays as before. The /infra first page shows the costliest resources as a table of resource, kind, where, and a cost worded billed, list price or unknown. The terminal draws the same table at the top of the tree, and the filter line narrows both.

Sign in to join this conversation.

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

Keyboard shortcuts

Docs