Public: anyone can read this; the crew can change it.
Access 4a: one read-only view over every grant table, and a gate test that none is missing #18118
Merged 9h 52m ago, live in production
This adds one read-only function, everyGrant(db, account?) in src/core/grantsview.ts, that lists the rows of all 16 grant tables in one shape. That shape is principal, action or role, resource, granted by, and when. It adds no table and changes no access, page or route.
-
Reviews
ApprovedRead-only, no new table, all 16 tables from the issue mapped. A table with no granter or time column reports notRecorded, and null is kept for an empty column. A missing table lists nothing. The account filter runs in SQL with a bound parameter, and table and column names in the SQL are constants in the module, never user text. The gate test reads CREATE TABLE under src/ and the migrated schema, so a new _grant or _member table fails it. The change adds no page, route or access, so there is no door to mirror yet. Next two things: (1) when #18105 lands, delete both allow-list entries in scripts/unreached-allow.json and scripts/unused-exports-allow.json; (2) decide there whether dropped shares are shown. I did not exercise it in the preview because it adds no route.
-
Checks
shipped production is serving it deploy a338207
-
History
- Name the grants view in the unreached list until its page reads it (#18104) 8bc8d65
- Rewrap the grants view's comments (#18104) 1305f97
- Grants view gate test lists src/ with Bun.Glob (#18104) 96b1677
- Name the grants view everyGrant, clear of the OAuth page's grantsView (#18104) d21fee9
- Every grant table read in one shape: principal, action, resource, granted by, when (#18104) 1b70b91
- Apps without a login 3: an app made on one device opens on another, as a file or a read-only link (#18079) 868ed93
- API routes the Apple app lacks: the arcade's games, an app's log, pausing a runner (#18075) cd50587
- Full suite red: test/talk-preview-frame.test.ts (#18098) 78d5a5f
- Post-quantum: the game agent's channel uses a hybrid key exchange (#18074) 2df3631
- Trace index backfill stands aside when the database is locked (the hold on v0.7.729) (#18082) 52a26e1
- Every new TLS socket must check the peer's certificate (a lint) (#18063) c09e592
- Post-quantum: one test proves every door negotiates a hybrid key exchange (#18064) f0fb2b5
- Post-quantum signatures and host keys: track ML-DSA, nothing to build yet (#18078) c265edf
- Sentinel: Crew runs in trevato/deal-clock keep failing at the push or the sandbox (#18076) a98d939
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:sh74wg48ib is past its budget: trevato/forge: "on production's size > a cold /map answers within a few passes over the runs" failed on 3 pulls in the … (#18070) c5a926e
- Traces 2: /traces lists every trace with facets and search (#18015) 1c60934
- Traces 1a: a trace index table, filled when a run or Talk turn ends and backfilled once off the serving thread (#18061) 35e4ee2
- Games: pin forge-velocity f7d5d4e72 (/forge words as you type, Yes and No to click, an answer shown once) (#18036) 0003ecb
- Merge pull request #18054 from sold/agent-rollback d6960b3
- Games: a new server's words are searched on Modrinth, not matched against five names (#18041) 31cdee4
This adds one read-only function, everyGrant(db, account?) in src/core/grants_view.ts, that lists the rows of all 16 grant tables in one shape. That shape is principal, action or role, resource, granted by, and when. It adds no table and changes no access, page or route.
How each table is read. Each table has one mapping row in MAPPINGS: SQL over the table's own columns. The rows are joined with UNION ALL into a single query. Grantees typed differently are turned into text, not migrated:
device_grantstores an integer device id; it becomes text.subscription_grantgrants to an agent, or to a repo or org when no agent is named.- In
secret_grantandegress_grantthe grantee is a repository. - In
pull_run_grantthe pull is the grantee anduser_idis the person who granted it.
Unrecorded fields. grantedBy and at are { notRecorded: true } when the table has no such column (team_member, game_grant, subscription_grant, crew_team_member). They are null when the column exists but this row is empty, for example a granter whose account was deleted.
Missing tables. A table that doesn't exist yet lists nothing. client_cloud_member is only created on first use, so a fresh forge doesn't have it.
Filtering by account. Given account, the view returns only grants whose principal is that person or agent. The filter runs in SQL, and an account with no grants gets [].
Tests. test/grants-view.test.ts:
- grants one row in each of the 16 tables and checks the view lists all of them in the shape above;
- checks one account's grants, an account with none, and a fresh forge;
- is the gate: it finds every
CREATE TABLEundersrc/named_grantor_member, plus the migrated schema, and fails naming any table the view doesn't read.
Look at:
- Two allow-list entries. Nothing under
src/calls this yet, as the issue intends: the page is #18105, the MCP tool and terminal screen are #18106. Soscripts/unreached-allow.jsonnames the module andscripts/unused-exports-allow.jsonnameseveryGrant. Both entries should go when #18105 lands. - Why it's called
everyGrant. I first named itgrantsView, but a private function of that name insrc/web/pages/grants.ts(OAuth grants) made the dead-code test think it had a caller, so I renamed it. sharerows are all listed, dropped ones included. The state shows in the action (receive, dropped). Decide in #18105 whether the page should leave dropped shares out.bun scripts/similar.tsfound nothing like this undersrc/, so nothing was reused. The gate test lists files withBun.Glob, the wayscripts/unused-exports.tsdoes.
Checks run: bun x tsc --noEmit and bun scripts/gate.ts --explain pass (33 of 33 rules). Of the 156 files scripts/fast.ts named, all pass except one test in test/scripts-fast.test.ts ("a clean tree and a docs-only diff exit 3"). It hits its 5 s timeout in this sandbox and fails the same way on main, so it is unrelated to this change. The keep_plan and estimate tools weren't available in this session, so no plan or estimate was recorded on the issue.
To try it: bun test test/grants-view.test.ts. To see the gate fail, delete one row from MAPPINGS and run it again.
🤖 Generated with Claude Code
Left #18104 open: 1 unticked item remain (A read-only function (no new table) over member, team_member, app_member, game_grant, model_grant, subscription_grant, secret_grant, egress_grant, device_grant, child_reach_grant, origin_read_grant, pull_run_grant, telemetry_grant, client_cloud_member, crew_team_member, share. A table that does not record who granted it says so in that field.).
This adds one read-only function,
everyGrant(db, account?)insrc/core/grants_view.ts, that lists the rows of all 16 grant tables in one shape. That shape is principal, action or role, resource, granted by, and when. It adds no table and changes no access, page or route.How each table is read. Each table has one mapping row in
MAPPINGS: SQL over the table's own columns. The rows are joined withUNION ALLinto a single query. Grantees typed differently are turned into text, not migrated:device_grantstores an integer device id; it becomes text.subscription_grantgrants to an agent, or to a repo or org when no agent is named.secret_grantandegress_grantthe grantee is a repository.pull_run_grantthe pull is the grantee anduser_idis the person who granted it.Unrecorded fields.
grantedByandatare{ notRecorded: true }when the table has no such column (team_member,game_grant,subscription_grant,crew_team_member). They arenullwhen the column exists but this row is empty, for example a granter whose account was deleted.Missing tables. A table that doesn't exist yet lists nothing.
client_cloud_memberis only created on first use, so a fresh forge doesn't have it.Filtering by account. Given
account, the view returns only grants whose principal is that person or agent. The filter runs in SQL, and an account with no grants gets[].Tests.
test/grants-view.test.ts:CREATE TABLEundersrc/named_grantor_member, plus the migrated schema, and fails naming any table the view doesn't read.Look at:
src/calls this yet, as the issue intends: the page is #18105, the MCP tool and terminal screen are #18106. Soscripts/unreached-allow.jsonnames the module andscripts/unused-exports-allow.jsonnameseveryGrant. Both entries should go when #18105 lands.everyGrant. I first named itgrantsView, but a private function of that name insrc/web/pages/grants.ts(OAuth grants) made the dead-code test think it had a caller, so I renamed it.sharerows are all listed, dropped ones included. The state shows in the action (receive, dropped). Decide in #18105 whether the page should leave dropped shares out.bun scripts/similar.tsfound nothing like this undersrc/, so nothing was reused. The gate test lists files withBun.Glob, the wayscripts/unused-exports.tsdoes.Checks run:
bun x tsc --noEmitandbun scripts/gate.ts --explainpass (33 of 33 rules). Of the 156 filesscripts/fast.tsnamed, all pass except one test intest/scripts-fast.test.ts("a clean tree and a docs-only diff exit 3"). It hits its 5 s timeout in this sandbox and fails the same way onmain, so it is unrelated to this change. Thekeep_planandestimatetools weren't available in this session, so no plan or estimate was recorded on the issue.To try it:
bun test test/grants-view.test.ts. To see the gate fail, delete one row fromMAPPINGSand run it again.🤖 Generated with Claude Code
Closes #18104