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

A container in the cloud tree has a Logs tab with its recent lines #17958

opened this

Merged 18h 24m ago, live in production

A container in the cloud tree now has a third tab, Logs, at /infra/-/…?tab=logs. The container tests and test/mcp-size.test.ts pass, tsc is clean, and design-lint is clean. I did not run the full suite or load the page on a preview.

Notes

opened this

A container in the cloud tree now has a third tab, Logs, at /infra/-/…?tab=logs. The container tests and test/mcp-size.test.ts pass, tsc is clean, and design-lint is clean. I did not run the full suite or load the page on a preview.

What changed

  • Where the lines come from: the tab shows the newest 200 lines from the rows the box's sync already stored (logsOf), through a new logsOfContainer in src/cloud/containers.ts. Nothing is fetched from the box when the page is read, and the lines are read only when the tab is asked for.
  • Escaping: the page escapes each line as text. The lines are the container's own output, so I also strip control characters, including terminal escapes. ESC[31m becomes the plain text [31m.
  • No lines: the tab says "No lines were synced for <name>. Its box last synced <ago>."
  • Doors:
    • src/cloud/tree.ts adds the logs tab to container nodes only. A machine keeps Facts and File.
    • The web pane renders it in src/web/pages/cloud_tree.ts.
    • The terminal tab cycles through it with [ and ].
    • The infra MCP tool (action: cloud) returns the same lines as logs for a container id. That is a new field on an existing action, not a new tool.
  • Docs: docs/features/infra.md says what the tab shows.
  • Admin only: the cloud tree was already admin-only. The test covers a container with logs, one without, and a non-admin; the non-admin gets a 403 on ?tab=logs and sees no lines.

I added one Try: line to a commit message so the pre-push check would pass.

What I chose not to do

  • No live tailing or refresh.
  • No per-line timestamps.
  • The lines are not part of every request's tree build.

How to try it: open /infra, then a game box's machine, then one of its containers, then the Logs tab. In the terminal, open the same node and press ] to reach Logs.

[
  {"go": "/infra/-/hetzner/eu/games/machine:77/container:hub?tab=logs", "look": "Tabs read Facts, File, Logs with Logs current, then the container's recent lines in a scrollable block", "expect": "Each line is plain text; markup in a line is shown, not run", "ask": "Does the block read like a log, and is 60vh the right height?"},
  {"go": "/infra/-/hetzner/eu/games/machine:77/container:survival?tab=logs", "look": "A container with no synced lines", "expect": "No lines were synced for survival. Its box last synced <ago>."},
  {"go": "/infra/-/hetzner/eu/games/machine:77?tab=logs", "look": "A machine has no Logs tab", "expect": "Its first tab, Facts, opens instead"}
]

Closes #17953

3 earlier comments
commented

A container in the cloud tree now has a third tab, Logs, at /infra/-/…?tab=logs. The container tests and test/mcp-size.test.ts pass, tsc is clean, and design-lint is clean. I did not run the full suite or load the page on a preview.

What changed

  • Where the lines come from: the tab shows the newest 200 lines from the rows the box's sync already stored (logsOf), through a new logsOfContainer in src/cloud/containers.ts. Nothing is fetched from the box when the page is read, and the lines are read only when the tab is asked for.
  • Escaping: the page escapes each line as text. The lines are the container's own output, so I also strip control characters, including terminal escapes. ESC[31m becomes the plain text [31m.
  • No lines: the tab says "No lines were synced for <name>. Its box last synced <ago>."
  • Doors:
    • src/cloud/tree.ts adds the logs tab to container nodes only. A machine keeps Facts and File.
    • The web pane renders it in src/web/pages/cloud_tree.ts.
    • The terminal tab cycles through it with [ and ].
    • The infra MCP tool (action: cloud) returns the same lines as logs for a container id. That is a new field on an existing action, not a new tool.
  • Docs: docs/features/infra.md says what the tab shows.
  • Admin only: the cloud tree was already admin-only. The test covers a container with logs, one without, and a non-admin; the non-admin gets a 403 on ?tab=logs and sees no lines.

I added one Try: line to a commit message so the pre-push check would pass.

What I chose not to do

  • No live tailing or refresh.
  • No per-line timestamps.
  • The lines are not part of every request's tree build.

How to try it: open /infra, then a game box's machine, then one of its containers, then the Logs tab. In the terminal, open the same node and press ] to reach Logs.

[
  {"go": "/infra/-/hetzner/eu/games/machine:77/container:hub?tab=logs", "look": "Tabs read Facts, File, Logs with Logs current, then the container's recent lines in a scrollable block", "expect": "Each line is plain text; markup in a line is shown, not run", "ask": "Does the block read like a log, and is 60vh the right height?"},
  {"go": "/infra/-/hetzner/eu/games/machine:77/container:survival?tab=logs", "look": "A container with no synced lines", "expect": "No lines were synced for survival. Its box last synced <ago>."},
  {"go": "/infra/-/hetzner/eu/games/machine:77?tab=logs", "look": "A machine has no Logs tab", "expect": "Its first tab, Facts, opens instead"}
]
commented

<!-- look-pages 41024792aec6 --> Look pages for 4102479, from the gate:

  • look pages (none): "Looks: /infra" is not a page of app.looks in forge.json; this pull changes src/web/pages/cloud_tree.ts but the forge could not trace the route of /, /docs, /explore and 29 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
commented

A container in the cloud tree now has a Logs tab at /infra/-/…?tab=logs, and the branch is merged with current main and pushed. The container tests, the cloud-tree tests and test/mcp-size.test.ts pass after the merge, and bun x tsc --noEmit is clean. I did not run the full suite or load the page on the preview; the forge runs the full check on push.

The merge conflict was one hunk in the CSS in src/web/pages/cloud_tree.ts. main had renamed [data-largest] to [data-costliest], and my branch had added a [data-logs] rule. I kept the rename and kept the logs rule.

The gate rejected Looks: /infra, because /infra is not in app.looks in forge.json. The Logs tab needs a game box with synced lines, which a look can't set up. The latest commit now says No look: with that reason, and the test renders the tab instead.

What changed

  • Logs tab: a container node gets a third tab, Logs, showing its newest 200 lines as its box last synced them. Nothing is fetched from the box when the page is read, and the lines are read only when the tab is asked for.
  • Escaping: the page escapes each line as text. The lines are the container's own output, so I also strip control characters, including terminal escapes.
  • No lines: the tab says "No lines were synced for <name>. Its box last synced <ago>."
  • Other doors: the terminal tab cycles through Logs with [ and ]. The infra MCP tool (action: cloud) returns the same lines as logs for a container id. That is a new field on an existing action, not a new tool.
  • Admin only: the cloud tree was already admin-only. A non-admin gets a 403 on ?tab=logs and sees no lines.
  • Tests and docs: test/cloud-containers.test.ts covers a container with logs, one without, and a non-admin. docs/features/infra.md describes the tab.

What I chose not to do

  • No live tailing or refresh.
  • No per-line timestamps.
  • The lines are not part of every request's tree build.

How to try it: open /infra, then a game box's machine, then one of its containers, then the Logs tab. In the terminal, open the same node and press ] to reach Logs.

[
  {"go": "/infra/-/hetzner/eu/games/machine:77/container:hub?tab=logs", "look": "Tabs read Facts, File, Logs with Logs current, then the container's recent lines in a scrollable block", "expect": "Each line is plain text; markup in a line is shown, not run", "ask": "Does the block read like a log, and is 60vh the right height?"},
  {"go": "/infra/-/hetzner/eu/games/machine:77/container:survival?tab=logs", "look": "A container with no synced lines", "expect": "No lines were synced for survival. Its box last synced <ago>."},
  {"go": "/infra/-/hetzner/eu/games/machine:77?tab=logs", "look": "A machine has no Logs tab", "expect": "Its first tab, Facts, opens instead"}
]
commented

The check failed because test/cloud-files.test.ts still expected two tabs for a container. This pull adds a third, so I changed the test's expectation. It now expects a machine to have facts and file, and a container to have facts, file and logs. I also renamed the test and referenced #17953 in it. No source code changed in this push.

bun test test/cloud-files.test.ts passes. It is the only test file I re-ran after the fix; the forge runs the full check on this push.

Nothing else changed: a container's Logs tab shows its newest 200 synced lines, or says none were synced and when the box last synced. Only an admin sees it, the infra MCP tool returns the same lines as logs, and nothing is fetched from the box.

What I chose not to do

  • No live tailing or refresh.
  • No per-line timestamps.

How to try it: open /infra, then a game box's machine, then one of its containers, then the Logs tab (?tab=logs).

[
  {"go": "/infra/-/hetzner/eu/games/machine:77/container:hub?tab=logs", "look": "Tabs read Facts, File, Logs with Logs current, then the container's recent lines in a scrollable block", "expect": "Each line is plain text; markup in a line is shown, not run"},
  {"go": "/infra/-/hetzner/eu/games/machine:77/container:survival?tab=logs", "look": "A container with no synced lines", "expect": "No lines were synced for survival. Its box last synced <ago>."},
  {"go": "/infra/-/hetzner/eu/games/machine:77?tab=logs", "look": "A machine has no Logs tab", "expect": "Its first tab, Facts, opens instead"}
]
Sign in to join this conversation.

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

Keyboard shortcuts

Docs