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

An invite carries a bundle: the owner picks Use, Host or Build, each with a line saying what it allows #18473

opened this

Merged 3h 14m ago, live in production

An invite now carries a bundle, Use, Host or Build, chosen when the owner mints it. The new test/invite-bundles.test.ts and the existing invite, MCP-invite and TUI-invite tests pass (78), and tsc is clean.

Notes

opened this

An invite now carries a bundle, Use, Host or Build, chosen when the owner mints it. The new test/invite-bundles.test.ts and the existing invite, MCP-invite and TUI-invite tests pass (78), and tsc is clean. I did not run the full suite or the dead-code, duplicate-import, page-budget and module-state checks the issue lists; scripts/fast.ts called the change too broad to name tests, and the forge's check runs the rest on this push.

What changed

  • src/core/bundles.ts (new): holds the three bundles in one place. Each has a label, one plain line of what it allows, the role it lets the person in as, and its grants as plain may() action names. It holds no check and applies nothing.
  • Migration 20261206100000-invite-bundle: adds four nullable columns, bundle, host_machine, host_containers and host_memory_mb, and is pinned. A null bundle reads as Use, so old invites still list as Use.
  • mint: takes a bundle, defaulting to Use, and puts it in the invite.minted event.
  • Host: needs a machine from the offered list plus positive container and memory caps. The offered list is the running, non-game machines on /infra, read through infraOf. That is my reading of "machines this forge can offer"; say if you meant something else.
  • Refusals: an unknown bundle, a machine not on the list, a bad cap or Host with no machine is refused. The API and MCP answer 422; the page flashes the reason.
  • Mint form on /admin/limits: shows each bundle as a radio with its line. With no machine to offer, Host is disabled and the form says why; otherwise the machine select and cap fields appear.
  • Listing: each invite shows its bundle line and, for Host, its machine and caps.
  • API and MCP: POST /api/v1/admin/invites and mint_invite accept bundle, machine, containers and memoryMb.
  • Docs: docs/features/invite-bundle.md is the how-to.

What I left out

  • No grants are applied; that is the next issue.
  • The terminal's m still mints a Use invite. The commit says "No door" for it.
  • Host's caps are stored only; nothing enforces them yet.

Tests

  • Each bundle mints and lists with its line.
  • Host with no machine is refused and the page says why.
  • A stranger machine or a bad cap is refused.
  • The API answers 422.
  • An old invite reads as Use.
  • I changed two existing tests because they were out of date. test/invites-action.test.ts expected the exact invite.minted payload, which now also carries bundle. test/invites-core.test.ts builds its schema by hand, so it now runs the new migration.

For the reviewer

  • bundles.ts#positive resembles flow/valve.ts#parseLevel (0.64, flagged by the gate). Their bounds differ, so I kept both.
  • I added no dependency.

Try it Open /admin/limits as an admin, pick Use or Build, and make a link; the "Invite links made" list shows the bundle line. Or POST /api/v1/admin/invites {"bundle":"root"} for a 422.

Looks: /admin/limits

[{"go":"/admin/limits","look":"Invite links: three bundle choices, each with its line; Host disabled with a reason when no machine is offered","expect":"Use is selected; Build makes a link; the list below names the bundle"}]

🤖 Generated with Claude Code

Closes #18453

5 earlier comments
commented

An invite now carries a bundle, Use, Host or Build, chosen when the owner mints it. The new test/invite-bundles.test.ts and the existing invite, MCP-invite and TUI-invite tests pass (78), and tsc is clean. I did not run the full suite or the dead-code, duplicate-import, page-budget and module-state checks the issue lists; scripts/fast.ts called the change too broad to name tests, and the forge's check runs the rest on this push.

What changed

  • src/core/bundles.ts (new): holds the three bundles in one place. Each has a label, one plain line of what it allows, the role it lets the person in as, and its grants as plain may() action names. It holds no check and applies nothing.
  • Migration 20261206100000-invite-bundle: adds four nullable columns, bundle, host_machine, host_containers and host_memory_mb, and is pinned. A null bundle reads as Use, so old invites still list as Use.
  • mint: takes a bundle, defaulting to Use, and puts it in the invite.minted event.
  • Host: needs a machine from the offered list plus positive container and memory caps. The offered list is the running, non-game machines on /infra, read through infraOf. That is my reading of "machines this forge can offer"; say if you meant something else.
  • Refusals: an unknown bundle, a machine not on the list, a bad cap or Host with no machine is refused. The API and MCP answer 422; the page flashes the reason.
  • Mint form on /admin/limits: shows each bundle as a radio with its line. With no machine to offer, Host is disabled and the form says why; otherwise the machine select and cap fields appear.
  • Listing: each invite shows its bundle line and, for Host, its machine and caps.
  • API and MCP: POST /api/v1/admin/invites and mint_invite accept bundle, machine, containers and memoryMb.
  • Docs: docs/features/invite-bundle.md is the how-to.

What I left out

  • No grants are applied; that is the next issue.
  • The terminal's m still mints a Use invite. The commit says "No door" for it.
  • Host's caps are stored only; nothing enforces them yet.

Tests

  • Each bundle mints and lists with its line.
  • Host with no machine is refused and the page says why.
  • A stranger machine or a bad cap is refused.
  • The API answers 422.
  • An old invite reads as Use.
  • I changed two existing tests because they were out of date. test/invites-action.test.ts expected the exact invite.minted payload, which now also carries bundle. test/invites-core.test.ts builds its schema by hand, so it now runs the new migration.

For the reviewer

  • bundles.ts#positive resembles flow/valve.ts#parseLevel (0.64, flagged by the gate). Their bounds differ, so I kept both.
  • I added no dependency.

Try it Open /admin/limits as an admin, pick Use or Build, and make a link; the "Invite links made" list shows the bundle line. Or POST /api/v1/admin/invites {"bundle":"root"} for a 422.

Looks: /admin/limits

[{"go":"/admin/limits","look":"Invite links: three bundle choices, each with its line; Host disabled with a reason when no machine is offered","expect":"Use is selected; Build makes a link; the list below names the bundle"}]

🤖 Generated with Claude Code

commented

<!-- look-pages 2f909920f0c0 --> Look pages for 2f90992, from the gate:

  • look pages (named): this pull changes src/web/pages/admin-limits.ts; a commit names /admin/limits
commented

The terminal can now pick a bundle, the mint form follows the design system, and the three doors share one refusal helper. I pushed this to the same branch. These pass: tsc, the design lint, and the invite, TUI, MCP, page-budget, dead-code, duplicate-import and module-state tests. I did not run the full suite; the forge's check does that on push.

  • Terminal: m on Invite links asks for the days, then the bundle (Use, Host or Build). Host goes on to a machine picked from hostMachines, then the two caps. With no machine it says why, in the same BUNDLE_WORDS the page uses. The docs line now says how to pick in the terminal.
  • Mint form on /admin/limits: the hand-rolled radios are now a selectField for the bundle, with each line in its option. Host's machine and caps sit in a disclosure labelled "Host only", so they work without JavaScript. The one deviation from the issue: with no machine on offer, Host is left out of the select and the field's hint says why, instead of showing a disabled option.
  • Invite list: each invite shows its bundle label, plus the machine and caps for Host. The full sentence stays on the form only.
  • Refusal words: mintRefusal in src/actions/invites.ts now words the refusal for the page, API, MCP and terminal, replacing the nested ternaries.
  • role and grants in src/core/bundles.ts: I kept them, as you allowed, and added a test that every grant is an action may() answers. Nothing reads them yet; the next issue applies them.
  • New tests:
    • an API Host mint that succeeds (201) with its machine and caps;
    • MCP mint_invite with Host, good and with a stranger machine;
    • the terminal picking Build, and Host with no machine.
    • I also changed three existing terminal tests, because m now has one more step (the bundle picker).
  • Gate: it still prints two "one implementation?" notes: mintRefusal (0.61, against verifiedSentence) and positive (0.64, against parseLevel). The first words different errors and the second has different bounds, so I kept both.

Looks: /admin/limits

[{"go":"/admin/limits","look":"Invite links: a select 'what it allows' with Use, Host, Build and each line; a closed 'Host only' disclosure when a machine is offered","expect":"Without a machine Host is absent and the hint says why; the list below shows only the bundle label"}]

🤖 Generated with Claude Code

commented

<!-- look-pages 6e468c4bb3eb --> Look pages for 6e468c4, from the gate:

  • look pages (named): this pull changes src/web/pages/admin-limits.ts; a commit names /admin/limits
commented

Neither failure comes from this pull, so I changed nothing and pushed nothing.

  • each page of tools/list stays under 40 KB…: the failing assertion names plan.issues.owner (91 bytes), a property description from the planning tool, which this pull does not touch. The check log says the same test is red on main at 840ab71 too ("not counted against this pull"). On this branch alone, test/mcp-size.test.ts passes (12 of 12), including with the bundle, machine, containers and memoryMb fields I added to mint_invite. The failure comes from main's own tool list, so it needs a fix there.
  • a page the printer says it cannot take is refused with a sentence… (test/print_raster.test.ts): this one the check did count against the pull, but I couldn't reproduce it. It passes here on this branch (4 of 4). The test drives a loopback printer stub for raster refusal and has no connection to invites, so I read it as a flake under shard load. The check re-ran it alone and it still failed, so I can't rule out a race in the test itself. A person should look if it fails again.

A fresh check run, with no change from me, should show whether the printer test fails again. Main also has newer commits (840ab712e and others), so the next merge starts from there.

commented

The only new item is the gate's look-pages note. It is informational and asks for no change: it names /admin/limits, and the Looks: /admin/limits line and the review block are already there.

I met the four listed checks before my last push. These all passed on this branch: the dead-code test (test/unused-exports.test.ts), the duplicate-import test (test/dup-imports.test.ts), the page-budget test (test/page-budget.test.ts) and the module-state test (test/module-state.test.ts).

Nothing new is open on my side, so I changed nothing and pushed nothing. The two failures from the last check run are not caused by this pull; the details are in my earlier message:

  • test/mcp-size.test.ts is red on main too, over a description on the planning tool.
  • test/print_raster.test.ts passes here and has nothing to do with invites. I read it as a flake under shard load, but I can't rule out a race in the test.
Sign in to join this conversation.

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

Keyboard shortcuts

Docs