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

One door makes every forge: a paid plan runs where paid.placement says, however it was granted #16394

Merged opened this

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

Merged

The one rule (src/spawn/making.ts): spawnDoor calls it after the plan check. Only an admin may name target/account. Every path goes through spawnDoor: The New forge page: the admin's plan select, a gift plan, and a closed-by-default "Choose where it runs" disclosure with the default sentence from the catalog.

Notes

shipped production is serving it deploy 3fede26

opened this

#16385. The owner: "please bring it all together so i can use the new forge button too. basically we should have a solid endpoint to handle this and then we can use it everywhere."

The one rule (src/spawn/making.ts):

export function whereFor(app, plan, named?) {
  if (named !== undefined) return { where: "cloud", ...named };
  if (plan === undefined || plan.key === FREE) return { where: "hosted" };
  return getPaidPlacement(app.db);
}

spawnDoor calls it after the plan check. Only an admin may name target/account.

Every path goes through spawnDoor:

  • The New forge page: the admin's plan select, a gift plan, and a closed-by-default "Choose where it runs" disclosure with the default sentence from the catalog. A making answer goes to /pricing/done.
  • The pricing form: the same renderer (placeChoiceView).
  • POST /api/v1/forges, MCP spawn, and the terminal new-forge screen (plan and where-it-runs choices).
  • spawnOrder: calls spawnDoor with the order. The old dry door plus Placement.place is deleted. An admin or gift-code cloud forge gets a $0 order, so it gets the same making page, sealed claim link and mail, and never two machines for one order.
  • /deploy-to, the admin pinned API and pinned_forge deploy remain the explicit-target admin surface, sharing deployAs's checks and wording. ownSource now wraps ownCode.

Place: optional provider:datacenter:size. It is checked against the stored catalog with no provider call; a refusal that applies to the place alone is 422 with the catalog's reason, and one that applies everywhere (the ceiling) is 409. It is stored on the order (a new forge_order.place column).

Left out: dearer places for buyers and gift codes are refused with a plain sentence, because adding the difference to the Stripe price needs a recurring-price change. Also left out: lapse and cancel for cloud forges, at-cost codes and crew credit.

Tested on Bun 1.4.2: typecheck clean, gate 0; 922 pass across one-door (new), order-cloud, pricing, spawn, pinned, tui-newforge, tui-pricing, places, schema, plan wiring, billing receipts, attention, client size, MCP size and llms budget, including socket files. Two fail, and neither is this change: spawn-archive-dash-id fails on main too, and spawn-move-cell-sizes passes alone on both.

🤖 Generated with Claude Code

commented

<!-- look-pages 3bf3d16cc815 --> Look pages for 3bf3d16, from the gate:

  • look pages (none): this pull changes src/web/pages/new-forge.ts, src/web/pages/pricing.ts, src/web/pinned.ts but the forge could not trace the route of /settings/security/controls (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
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs