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

Upgrade a shared forge to a dedicated one, keeping its data #17167

opened this

Check · Review · Land · Live — Its check is red. Next: builder, its check is red.

Ready to land

An admin can now upgrade a shared forge to a dedicated plan, and its data moves with it. bun x tsc --noEmit is clean. The new test/upgrade-shared.test.ts, the MCP, page and terminal move-door tests, and the route-mark, hollow-code and unused-export checks pass.

Notes · 10 files · +443 −7

opened this

An admin can now upgrade a shared forge to a dedicated plan, and its data moves with it. bun x tsc --noEmit is clean. The new test/upgrade-shared.test.ts, the MCP, page and terminal move-door tests, and the route-mark, hollow-code and unused-export checks pass. I didn't run the full suite, and I didn't write the keep_plan or estimate entries.

What changed

  • The action. src/actions/upgrade_shared.ts has planUpgrade, which only previews, and upgradeShared, which does the move and then the plan change. The preview shows the machine, the move steps, and the price before and after (shared → small: $19.00 / month). The move is moveToMachine from src/spawn/move_machine.ts: copy through the backup destination, start, switch the router. The plan changes only once the forge answers on the machine. A failed move leaves it shared and billed as shared.
  • Billing. On success it writes the entitlement (kept in entitlement_change, source upgrade), tells the forge its new plan, and emits a billing.plan event. The earlier price falls back to the shared density price when a stored plans list lacks the shared plan.
  • Web. An "Upgrade to a dedicated forge" button on /forges, shown only for shared forges in their own cell when a machine is declared. It opens /forges/<name>/upgrade, where ?plan=&to= previews and the POST does it, with a route mark and the lazy list updated.
  • Terminal. Key e on the Forges screen asks which forge, plan and machine, shows the same plan, then confirms.
  • MCP. The forges tool takes action: "upgrade" with forge, plan and to. It previews by default and dryRun: false does it.
  • Docs. The "Not done" line in docs/features/shared-tier.md is now an "Upgrading" section.
  • Reused. I reused planMove, moveToMachine, previewChange, changeLine, centsFor, putEntitlement and tellPlan rather than writing new ones.

Left out

  • A forge whose subscription is at a payment provider is refused with words saying to change it there. This forge can't change what Stripe bills, and I didn't want to move the price here behind its back.
  • Only an admin who is a person can do it, and agents are refused. An owner upgrading their own forge is not built.
  • It needs a declared machine (FORGE_MACHINES) and a forge in its own cell. A forge hosted inside this process is told to sandbox first.

Gate notes

  • The both-doors rule would not accept the terminal key and the how-to edit as doors for a new page, so the commit says No door: with the reason. A No look: line says why there is no look page: the look fixture has no declared machine.
  • The gate's "one implementation?" similarity notes remain on upgradeOne, forgeUpgradeForm, forgeUpgradeSubmit and a test helper. Each follows the shape of its machine-move sibling, and I left them.

Try it Declare a machine, put a forge on the shared plan, then open /forges/<name>/upgrade on the preview. You can also call MCP forges with { action: "upgrade", forge, plan: "small", to: "<machine>" }.

🤖 Generated with Claude Code

Closes #17024

commented

An admin can now upgrade a shared forge to a dedicated plan, and its data moves with it. bun x tsc --noEmit is clean. The new test/upgrade-shared.test.ts, the MCP, page and terminal move-door tests, and the route-mark, hollow-code and unused-export checks pass. I didn't run the full suite, and I didn't write the keep_plan or estimate entries.

What changed

  • The action. src/actions/upgrade_shared.ts has planUpgrade, which only previews, and upgradeShared, which does the move and then the plan change. The preview shows the machine, the move steps, and the price before and after (shared → small: $19.00 / month). The move is moveToMachine from src/spawn/move_machine.ts: copy through the backup destination, start, switch the router. The plan changes only once the forge answers on the machine. A failed move leaves it shared and billed as shared.
  • Billing. On success it writes the entitlement (kept in entitlement_change, source upgrade), tells the forge its new plan, and emits a billing.plan event. The earlier price falls back to the shared density price when a stored plans list lacks the shared plan.
  • Web. An "Upgrade to a dedicated forge" button on /forges, shown only for shared forges in their own cell when a machine is declared. It opens /forges/<name>/upgrade, where ?plan=&to= previews and the POST does it, with a route mark and the lazy list updated.
  • Terminal. Key e on the Forges screen asks which forge, plan and machine, shows the same plan, then confirms.
  • MCP. The forges tool takes action: "upgrade" with forge, plan and to. It previews by default and dryRun: false does it.
  • Docs. The "Not done" line in docs/features/shared-tier.md is now an "Upgrading" section.
  • Reused. I reused planMove, moveToMachine, previewChange, changeLine, centsFor, putEntitlement and tellPlan rather than writing new ones.

Left out

  • A forge whose subscription is at a payment provider is refused with words saying to change it there. This forge can't change what Stripe bills, and I didn't want to move the price here behind its back.
  • Only an admin who is a person can do it, and agents are refused. An owner upgrading their own forge is not built.
  • It needs a declared machine (FORGE_MACHINES) and a forge in its own cell. A forge hosted inside this process is told to sandbox first.

Gate notes

  • The both-doors rule would not accept the terminal key and the how-to edit as doors for a new page, so the commit says No door: with the reason. A No look: line says why there is no look page: the look fixture has no declared machine.
  • The gate's "one implementation?" similarity notes remain on upgradeOne, forgeUpgradeForm, forgeUpgradeSubmit and a test helper. Each follows the shape of its machine-move sibling, and I left them.

Try it Declare a machine, put a forge on the shared plan, then open /forges/<name>/upgrade on the preview. You can also call MCP forges with { action: "upgrade", forge, plan: "small", to: "<machine>" }.

🤖 Generated with Claude Code

Sign in to join this conversation.

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

Keyboard shortcuts

Docs