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

A forge's size is written to the ledger and parent.json and listed by GET /api/v1/forges and MCP spawn #3117

Parked opened this
Closed without merging

A made forge's size is now written to the ledger and to parent.json, and GET /api/v1/forges lists it for each forge. tsc --noEmit is clean and the spawn, mcp, client-list, family, everyday and stranger suites pass.

Notes

stopped parked by the crew deploy 592b8db

opened this

A made forge's size is now written to the ledger and to parent.json, and GET /api/v1/forges lists it for each forge. tsc --noEmit is clean and the spawn, mcp, client-list, family, everyday and stranger suites pass. I did not run the whole bun test, and one earlier run hit "bun is unable to write files to tempdir: ReadOnlyFileSystem".

  • Default: plan.size ?? DEFAULT_SIZE is stored, with DEFAULT_SIZE = "small" added to src/spawn/sizes.ts. A ledger row with no size reads as small.
  • MCP spawn: this needed no change. It already took size through the shared door and plan validation from #3097, so a bad size is refused there the same way as over the API.
  • Pinned tests updated: test/spawn-keys.test.ts (the exact key set of parent.json), test/spawn.test.ts (the full parent.json record), and test/spawn-api.test.ts (the exact shape of the forges list).
  • New test: in test/spawn-api.test.ts, a large child shows large in the list and in its parent.json. A child made with no size shows small in both, and a ledger row with the size deleted still reads small.
  • Left alone: src/web/ui.ts and src/web/pages/new-forge.ts.
  • Not done: nothing enforces the size limits yet. The MCP forges tool, which reads the client list, does not show size.

The code change is in src/actions/spawn.ts and src/spawn/sizes.ts. To try it, send POST /api/v1/forges with {"name":"kid","apps":[],"size":"medium","dryRun":false}, then read GET /api/v1/forges.

🤖 Generated with Claude Code

Closes #3094

5 earlier comments · 2 events
commented

A made forge's size is now written to the ledger and to parent.json, and GET /api/v1/forges lists it for each forge. tsc --noEmit is clean and the spawn, mcp, client-list, family, everyday and stranger suites pass. I did not run the whole bun test, and one earlier run hit "bun is unable to write files to tempdir: ReadOnlyFileSystem".

  • Default: plan.size ?? DEFAULT_SIZE is stored, with DEFAULT_SIZE = "small" added to src/spawn/sizes.ts. A ledger row with no size reads as small.
  • MCP spawn: this needed no change. It already took size through the shared door and plan validation from #3097, so a bad size is refused there the same way as over the API.
  • Pinned tests updated: test/spawn-keys.test.ts (the exact key set of parent.json), test/spawn.test.ts (the full parent.json record), and test/spawn-api.test.ts (the exact shape of the forges list).
  • New test: in test/spawn-api.test.ts, a large child shows large in the list and in its parent.json. A child made with no size shows small in both, and a ledger row with the size deleted still reads small.
  • Left alone: src/web/ui.ts and src/web/pages/new-forge.ts.
  • Not done: nothing enforces the size limits yet. The MCP forges tool, which reads the client list, does not show size.

The code change is in src/actions/spawn.ts and src/spawn/sizes.ts. To try it, send POST /api/v1/forges with {"name":"kid","apps":[],"size":"medium","dryRun":false}, then read GET /api/v1/forges.

🤖 Generated with Claude Code

Changes requested — before the latest push

The ledger and parent.json now carry the size, and GET /api/v1/forges lists it, with an old-ledger fallback to small. That part is right and tested. I could not open the preview from this sandbox, so this review rests on the diff and the source.

What is missing is the MCP door. The title says MCP, and 'done' means reachable through MCP. The MCP forges tool (src/http/mcp.ts:1537) lists children through clientRows (src/spawn/clients.ts), which does not pass size through, and its description does not mention it. The pull says so itself ('Not done'), but it is the second half of the title. No test covers MCP either: the new test reads only the REST list and parent.json.

Fix first: carry size from Child through clientRows into the MCP forges rows. Add 'its size' to the tool description. Extend the existing MCP forges assertion, or add one, with a large child that shows size: "large". Also check that the MCP spawn answer names the size it made, and test that. Add a short line to the README so the field is documented.

Small: the new test mutates the shared kid ledger file. That is fine only because it runs last, so give it its own child instead.

commented

A forge's size is now written to the ledger and parent.json and shown at every door: the spawn answer, GET /api/v1/forges, and the MCP spawn and forges tools. A child's size is small unless the caller sends medium or large, and a ledger row with no size reads as small. tsc --noEmit is clean and the spawn, mcp, client-list, family, everyday and stranger suites pass (255 tests, none failing). I did not run the whole bun test; the forge's check runs it.

Review fixes

  • forges tool: size now passes through Child and clientRows (src/spawn/clients.ts) into the MCP forges rows. The tool description now says "its size".
  • Spawn answer: Spawned carries size, so the REST and MCP answers both include it. The MCP says line now reads Spawned kid (medium) at …. size is also set when the answer is for a child that already existed.
  • MCP spawn input: it already took size and validated it through the shared door, so that is unchanged.
  • README: one short paragraph documents the field and its default, and says nothing enforces the limits yet.

Tests

  • Added: test/client-list.test.ts makes lou large and asserts the MCP forges rows show lou as large and maria as small. test/spawn-api.test.ts now has a test for the spawn answer, list and parent.json, one for the MCP spawn answer naming medium, and one for the old-ledger fallback.
  • Own child, not shared: the old-ledger test uses its own child, old-kid, instead of editing the shared kid ledger file.
  • Pinned key sets: test/spawn-keys.test.ts and test/spawn.test.ts (parent.json) and the forges-list shape in test/spawn-api.test.ts gained size.

src/web/ui.ts and src/web/pages/new-forge.ts are untouched. Nothing enforces the size limits yet.

To try it: POST /api/v1/forges {"name":"kid","apps":[],"size":"large","dryRun":false}, then read GET /api/v1/forges or call the MCP forges tool.

🤖 Generated with Claude Code

commented

The check failed on a type error in test/tui-forges.test.ts, and I've fixed it and pushed. That test builds a ClientRow by hand, and ClientRow now has a required size. I added size: "small" to the test's row helper (89cbd210). This is the only change since the last push.

tsc --noEmit is clean, and test/tui-forges.test.ts passes (4 tests). I did not re-run the wider suites. bun x tsc printed bun is unable to write files to tempdir: ReadOnlyFileSystem here, but the type check still came back clean.

The rest of the pull is as in the previous description:

  • A forge's size is written to the ledger and parent.json.
  • It is shown by GET /api/v1/forges, the spawn answer, and the MCP spawn and forges tools.
  • The README documents it.

🤖 Generated with Claude Code

Approved — before the latest push

Approved. This does what #3094 asks. The size goes into the ledger and parent.json, defaults to small, and a ledger row with no size reads as small. The spawn answer, GET /api/v1/forges and the MCP spawn and forges tools all report it. src/web/ui.ts and src/web/pages/new-forge.ts are unchanged, as the issue asks.

Security: the new field adds no input of its own. size comes in through the shared door and parseSize from #3097, and what comes out is a value from a closed set of three. Size is part of planHash, so a resume or repeat can't write a ledger size that differs from the parent.json size. Plans without a size still hash as they always did.

Tests: the pinned key sets (spawn-keys, spawn, the forges-list shape) gained size. New tests cover the large child across the answer, list and parent.json, the MCP spawn saying (medium), the MCP forges rows, and the old-ledger fallback, which uses its own child. At 89cbd210, spawn-api, client-list, spawn-keys, spawn, tui-forges and spawn-sizes give 44 pass, 0 fail.

The preview wasn't reachable from my sandbox. Nothing on a page changes here, so this verdict rests on the code and the tests.

For later, not this pull: neither /forges nor the tty forges card shows the size yet. When sizes are enforced, show them in both places together.

commented

I merged main into the branch, resolved the conflicts, and pushed. The spawn tests pass (166 tests). I couldn't run the type check here because bun failed with "unable to write files to tempdir" and tsc isn't installed locally. I started the full bun test but it passed the 120s limit and I didn't wait for it. The forge's check on this push will be the first full run.

  • src/actions/spawn.ts: main had landed the same size field on the ledger and the list. I took its versions, so the list row now uses isSize(ledger.size) ? ledger.size : DEFAULT_SIZE. That reads a missing or malformed size as small.
  • src/spawn/sizes.ts: both sides had added DEFAULT_SIZE and isSize, so the merged file declared them twice and every spawn suite failed to load. I took main's file.
  • test/spawn-api.test.ts: I kept both sides' new tests.
commented

I merged main into the branch and pushed it. The only conflict was the list_clients description in src/http/mcp.ts.

Main had shortened that description and my side had added the child's size to it. I kept main's shorter wording and added "size", so it now reads: "The forges you sent from here (an admin's list): name, address, whom for, apps, size, claimed or not, last activity."

I ran test/client-list.test.ts and the test/mcp*.test.ts files, and they pass (8 and 93 tests). I did not run the full bun test suite; the forge's check runs it on this push. tsc --noEmit failed with "Cannot find type definition file for 'bun'" even after the install, so the type check did not run here.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs