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

Access 3, terminal: the palette offers a screen by its `asks` through may(); the entries' own gates go #18431

opened this

Merged 8h 53m ago, live in production

The terminal's palette now uses may() alone to decide which screens to offer. Every entry that names an action has lost its own gate, and nobody is offered anything different from before.

Notes

opened this

The terminal's palette now uses may() alone to decide which screens to offer. Every entry that names an action has lost its own gate, and nobody is offered anything different from before.

What changed

  • src/tui/screens/entries.ts: an entry now either names an action (asks) or keeps its own offered gate, never both, and the type checker refuses an entry that has both. A new offers(entry, session) decides in this order:
    1. the entry's shows check, if it has one;
    2. its own offered, if it names no action;
    3. otherwise may for the terminal's account.

    The shadow count and the per-session WeakMap are gone, so the palette writes no access_disagreement rows any more.

  • The 121 entries that name an action lost their offered. A gate that also left agents out became for: "person". A data condition moved into shows (or was already there: own forge for crewbudgets, files for cores and madefrom, bills, returns). Eleven gate helpers had no callers left and were deleted. Every other helper is still used in a screen's own code.
  • The two expected partings are decided, written up in docs/features/may.md and pinned in test/terminal-games-may.test.ts:
    • Signed out: forge.read is open to everyone, but a signed-out terminal has no account to ask as. It is offered only entries that name no action, the same as the web asking you to sign in.
    • An admin agent: it holds forge.administer, so it gets the admin screens. Screens marked for: "person" are not offered to it, because they are a person's screens, not a permission it lacks. A test pins that the for: "person" set is exactly the 80 ids the old gates left agents out of.
  • Entries that name no action (18 of them) keep their gate with a // Names no \asks\: … comment saying why.
  • src/design/door_checks.ts now also reads src/tui/screens/. It flags any entry's own offered that lacks that comment, and leaves the screens' other uses of isAdmin alone.
  • Tests: about 110 calls to entry.offered(...) across 34 test files now call offers(entry, ...). Fake sessions are built with sessionFor (which now accepts a missing user) instead of as never. The tests themselves were not wrong; they faked sessions with no app, and may needs one.

Production rows: I couldn't read production's access_disagreement rows for terminal %, because the sandbox can't reach the forge's database. The old check-everything test passed with exactly these two partings carved out, and the new code gives the old answers everywhere else. So the only rows there should be these two kinds, and they are decided above.

What I left alone: I didn't add an "account required" action to may's list. It would change the can lists on the API, MCP and the terminal's "What I can do", so signing in stays the palette's own rule, written in one place. Gates for organisations, subscriptions and game grants also stay, since may has no action for them yet.

Checks run: bun x tsc --noEmit and bun scripts/gate.ts --explain pass (0 fail, one note about long comment lines that were already there). I ran the test files that call the palette or its entries: 270 files, 2,547 tests, all passing after fixes. The dead-code, duplicate-import, module-state, door-check and palette tests pass too. I did not run the whole suite; the forge runs it on the push. I reused the existing sessionFor helper (test/helpers/tui-text.ts) and holds/principalOfUser rather than writing new ones. I didn't run scripts/similar.ts, and the plan and estimate tools weren't available in this run.

Try it: on the preview, ssh into the terminal as an admin, then as a member, and open the palette. The admin sees Sentinel and Billing, the member sees neither, and a signed-out session sees only the screens open to everyone.

[{"go":"ssh to the preview terminal ($FORGE_APP_SSH) as the forge admin","look":"the palette (Ctrl-K)","expect":"Sentinel, Billing and People are listed"},{"go":"the same terminal as a member who is not an admin","look":"the palette","expect":"Payments and Profile are listed; Sentinel and Billing are not"},{"go":"the same terminal signed out","look":"the palette","expect":"only the screens open to everyone (Audit, Bugs, Front); no account screens"}]

🤖 Generated with Claude Code

Closes #18426

commented

The terminal's palette now uses may() alone to decide which screens to offer. Every entry that names an action has lost its own gate, and nobody is offered anything different from before.

What changed

  • src/tui/screens/entries.ts: an entry now either names an action (asks) or keeps its own offered gate, never both, and the type checker refuses an entry that has both. A new offers(entry, session) decides in this order:
    1. the entry's shows check, if it has one;
    2. its own offered, if it names no action;
    3. otherwise may for the terminal's account.

    The shadow count and the per-session WeakMap are gone, so the palette writes no access_disagreement rows any more.

  • The 121 entries that name an action lost their offered. A gate that also left agents out became for: "person". A data condition moved into shows (or was already there: own forge for crewbudgets, files for cores and madefrom, bills, returns). Eleven gate helpers had no callers left and were deleted. Every other helper is still used in a screen's own code.
  • The two expected partings are decided, written up in docs/features/may.md and pinned in test/terminal-games-may.test.ts:
    • Signed out: forge.read is open to everyone, but a signed-out terminal has no account to ask as. It is offered only entries that name no action, the same as the web asking you to sign in.
    • An admin agent: it holds forge.administer, so it gets the admin screens. Screens marked for: "person" are not offered to it, because they are a person's screens, not a permission it lacks. A test pins that the for: "person" set is exactly the 80 ids the old gates left agents out of.
  • Entries that name no action (18 of them) keep their gate with a // Names no \asks\: … comment saying why.
  • src/design/door_checks.ts now also reads src/tui/screens/. It flags any entry's own offered that lacks that comment, and leaves the screens' other uses of isAdmin alone.
  • Tests: about 110 calls to entry.offered(...) across 34 test files now call offers(entry, ...). Fake sessions are built with sessionFor (which now accepts a missing user) instead of as never. The tests themselves were not wrong; they faked sessions with no app, and may needs one.

Production rows: I couldn't read production's access_disagreement rows for terminal %, because the sandbox can't reach the forge's database. The old check-everything test passed with exactly these two partings carved out, and the new code gives the old answers everywhere else. So the only rows there should be these two kinds, and they are decided above.

What I left alone: I didn't add an "account required" action to may's list. It would change the can lists on the API, MCP and the terminal's "What I can do", so signing in stays the palette's own rule, written in one place. Gates for organisations, subscriptions and game grants also stay, since may has no action for them yet.

Checks run: bun x tsc --noEmit and bun scripts/gate.ts --explain pass (0 fail, one note about long comment lines that were already there). I ran the test files that call the palette or its entries: 270 files, 2,547 tests, all passing after fixes. The dead-code, duplicate-import, module-state, door-check and palette tests pass too. I did not run the whole suite; the forge runs it on the push. I reused the existing sessionFor helper (test/helpers/tui-text.ts) and holds/principalOfUser rather than writing new ones. I didn't run scripts/similar.ts, and the plan and estimate tools weren't available in this run.

Try it: on the preview, ssh into the terminal as an admin, then as a member, and open the palette. The admin sees Sentinel and Billing, the member sees neither, and a signed-out session sees only the screens open to everyone.

[{"go":"ssh to the preview terminal ($FORGE_APP_SSH) as the forge admin","look":"the palette (Ctrl-K)","expect":"Sentinel, Billing and People are listed"},{"go":"the same terminal as a member who is not an admin","look":"the palette","expect":"Payments and Profile are listed; Sentinel and Billing are not"},{"go":"the same terminal signed out","look":"the palette","expect":"only the screens open to everyone (Audit, Bugs, Front); no account screens"}]

🤖 Generated with Claude Code

commented

The terminal's palette now uses may() alone to decide which screens to offer, and every entry that names an action has lost its own gate. Nobody is offered anything different from before. The branch now includes the latest main.

What changed

  • src/tui/screens/entries.ts: an entry now either names an action (asks) or keeps its own offered gate, never both, and the type checker refuses an entry that has both. A new offers(entry, session) decides in this order:
    1. the entry's shows check, if it has one;
    2. its own offered, if it names no action;
    3. otherwise may for the terminal's account.

    The palette no longer counts may disagreements, so the per-session WeakMap is gone.

  • The 121 entries that name an action lost their offered. A gate that also left agents out became for: "person". A data condition moved into shows (or was already there: own forge for crewbudgets, files for cores and madefrom, bills, returns). Eleven gate helpers had no callers left and were deleted.
  • The two expected partings are decided, written up in docs/features/may.md and pinned in test/terminal-games-may.test.ts:
    • Signed out: forge.read is open to everyone, but a signed-out terminal has no account to ask as. It is offered only entries that name no action, the same as the web asking you to sign in.
    • An admin agent: it gets the admin screens. Screens marked for: "person" are not offered to it, because they are a person's screens, not a permission it lacks. A test pins that this set is exactly the 80 ids the old gates left agents out of.
  • Entries that name no action (18 of them) keep their gate with a // Names no \asks\: … comment saying why.
  • src/design/door_checks.ts: the merge with main keeps both sides' scans. The check reads main's new src/web/pages/ and also this pull's src/tui/screens/, where it flags any entry's own offered that lacks that comment. Its fix message points at src/tui/screens/entries.ts for an entry, and at main's new helpers for a web page or route.
  • Tests: test calls to entry.offered(...) now call offers(entry, ...), and fake sessions are built with sessionFor, which now accepts a missing user, instead of as never. The tests were not wrong; they faked sessions with no app, and may needs one.

Production rows: I couldn't read production's access_disagreement rows for terminal % from the sandbox. The old test that checked every entry passed with only these two partings carved out, so those should be the only rows there, and both are decided above.

What I left alone: I didn't add an "account required" action to may's list. It would change the can lists on the API, MCP and the terminal's "What I can do", so signing in stays the palette's own rule, in one place. Gates for organisations, subscriptions and game grants also stay, since may has no action for them.

Checks after the merge: bun x tsc --noEmit passes, and bun scripts/gate.ts --explain shows 0 fails (one note about long comment lines already on main). The door, terminal-and-games, palette, web-pages, dead-code, duplicate-import and module-state tests all pass (172 tests). Before the merge, the 270 test files that call the palette or its entries passed (2,547 tests). The full suite runs on the forge.

Try it: on the preview, ssh into the terminal as an admin, then as a member, and open the palette. The admin sees Sentinel and Billing, the member sees neither, and a signed-out session sees only the screens open to everyone.

[{"go":"ssh to the preview terminal ($FORGE_APP_SSH) as the forge admin","look":"the palette (Ctrl-K)","expect":"Sentinel, Billing and People are listed"},{"go":"the same terminal as a member who is not an admin","look":"the palette","expect":"Payments and Profile are listed; Sentinel and Billing are not"},{"go":"the same terminal signed out","look":"the palette","expect":"only the screens open to everyone (Audit, Bugs, Front); no account screens"}]

🤖 Generated with Claude Code

Sign in to join this conversation.

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

Keyboard shortcuts

Docs