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

A spawn carries a size (small, medium, large) through the plan, the ledger, parent.json, GET /api/v1/forges and MCP spawn, with no form change #3007

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A spawn now carries a size of `small`, `medium` or `large`. It passes through the plan, the ledger, `parent.json`, the forges list and MCP `spawn`, and no form changed. The earlier attempt already built this. The work from the closed pull #2997 failed the forge's check on `/map` warm timing on the forge-sized fixture, which this change doesn't touch.

shipped production is serving it deploy 62e6256

opened this

A spawn now carries a size of small, medium or large. It passes through the plan, the ledger, parent.json, the forges list and MCP spawn, and no form changed. The earlier attempt already built this. The work from the closed pull #2997 failed the forge's check on /map warm timing on the forge-sized fixture, which this change doesn't touch.

I merged current main into the branch, since a rebase would have needed a force push. The type check is clean. The spawn tests (spawn-sizes, spawn-api, spawn-keys, spawn) and map-cache pass locally, 37 tests. In map-cache, the p95 on the 10-lane owner view was about 65 ms. I did not run the forge's full check, so whether the /map timing check passes now is unknown.

What changed

  • src/spawn/sizes.ts holds the valid sizes. plan.ts and door.ts carry the size through.
  • Spawning through POST /api/v1/forges (src/actions/spawn.ts) and MCP spawn (src/http/mcp.ts) validates the size at the boundary and rejects anything else.
  • Older ledger entries with no size still read back, as a legacy case.
  • New tests cover each path, and docs/SPAWN.md documents the field.

What I left out

  • No size field on any form.
  • Size has no effect yet on limits or scheduling. It is recorded and reported only.

To try it

  1. Run bun test test/spawn-sizes.test.ts test/spawn-api.test.ts.
  2. Spawn with {"size":"large"} and check that it appears in the response and in the forges list.

Closes #2995

commented

A spawn now carries a size of small, medium or large. It passes through the plan, the ledger, parent.json, the forges list and MCP spawn, and no form changed. The earlier attempt already built this. The work from the closed pull #2997 failed the forge's check on /map warm timing on the forge-sized fixture, which this change doesn't touch.

I merged current main into the branch, since a rebase would have needed a force push. The type check is clean. The spawn tests (spawn-sizes, spawn-api, spawn-keys, spawn) and map-cache pass locally, 37 tests. In map-cache, the p95 on the 10-lane owner view was about 65 ms. I did not run the forge's full check, so whether the /map timing check passes now is unknown.

What changed

  • src/spawn/sizes.ts holds the valid sizes. plan.ts and door.ts carry the size through.
  • Spawning through POST /api/v1/forges (src/actions/spawn.ts) and MCP spawn (src/http/mcp.ts) validates the size at the boundary and rejects anything else.
  • Older ledger entries with no size still read back, as a legacy case.
  • New tests cover each path, and docs/SPAWN.md documents the field.

What I left out

  • No size field on any form.
  • Size has no effect yet on limits or scheduling. It is recorded and reported only.

To try it

  1. Run bun test test/spawn-sizes.test.ts test/spawn-api.test.ts.
  2. Spawn with {"size":"large"} and check that it appears in the response and in the forges list.
commented

I merged main into this branch and pushed. The 163 spawn tests pass. bun x tsc --noEmit printed "bun is unable to write files to tempdir: ReadOnlyFileSystem", so I don't know whether the type check passes. I didn't run the rest of the suite; the forge's check does that on the push.

main had already landed the size field in #3097: sizes.ts, the plan field and its check, the MCP size property, and test/spawn-sizes.test.ts. For the five conflicted files I took main's version. That means main's disk figures (10240 and 40960 MiB for medium and large) replace mine (8192 and 32768). Its parseSize result shape and error text also replace mine.

What the branch still adds on top of main:

  • Ledger and parent.json: size is written to the spawn ledger and to the child's parent.json, defaulting to small.
  • GET /api/v1/forges: each child lists its size. A ledger with no size, or a bad one, reads as small.
  • Helpers: DEFAULT_SIZE and isSize are added to main's sizes.ts.
  • Tests: end-to-end tests cover POST /api/v1/forges, the MCP spawn tool and the legacy ledger read, and the existing parent.json expectations are updated.
  • Docs: docs/SPAWN.md keeps main's newer text and gains the size? sentence: a size is recorded but nothing enforces its limits yet.
Approved

Approved. Size is validated at the boundary by main's parseSize and rejected as a 422 on size. It is written to the ledger and parent.json and listed by GET /api/v1/forges. A missing or bad value (including __proto__, which Object.hasOwn rejects) reads as small. The tests cover POST, MCP, the legacy ledger and the parent.json keys. No form changed. I could not reach the preview from my sandbox, so I did not curl it or open the screenshots; this is a read of the diff only. src/tty.ts does not exist and spawn has no terminal door today, so no parity gap is added. Next: (1) the list route shows size as JSON only, so when a page lists children it should say it in plain words, e.g. Small. (2) Enforce or drop the size, since a recorded but unenforced field invites assumptions; the docs already say it limits nothing.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs