Repository navigation
feat(grants): the Tools page's three read routes (piece 4, option A) - #1668
Merged
Merged
Conversation
…he trail with counts, and a projected grant read Tools plan §6 Sequencing (docs/plans/tools-catalogue-room-grants.md), piece 4 option A, the routes before the page: - GET /api/pods/:podId/grants — every grant whose target is the pod or a seat in it, gated by DMService.canViewPod, each row in the explicit field list. Mounted beside the pod routes. - GET /api/grants/:grantId/calls — the trail from ToolCall.listForGrant plus COUNT(*) by outcome (new ToolCall.countsForGrant). Gated by canViewPod on the target pod; a seat grant's trail goes only to the granter and that seat (dualAuth, so the seat reads on its runtime token). Every line carries argsDigest and never args. - GET /api/grants/:grantId now returns the field list and nothing else — grantId, installationId, target, tools, writeMode, budget, effectiveAudience, expiresAt, revokedAt, parentGrantId, rootGrantId, createdAt, grantedBy (the Connection's owner). Never connectionId, brokerId or the raw audience snapshot (Vera 67560/67568). Named tests: the pod grants list refuses a non-member; the trail refuses a non-member and never returns args; a seat grant's trail is visible only to its granter and the seat; GET /api/grants/:id returns the field list and never connectionId or brokerId. Plus the seat-in-pod list shape, the 404 and limit clamp, and countsForGrant on pg-mem. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5
…d gate the grant read like its trail Two of Vera's blockers on #1668 (67727), one of them also Wren's 67721: - pods.ts ends with `router.get('/:type/:id', getPodById)`, so with podRoutes mounted first `/api/pods/:podId/grants` answered as type=<podId>, id='grants' and podGrantsRouter was never reached. The list now mounts ahead of podRoutes in server.ts, and the suite mounts routes/pods in the same order with the controller stubbed so the shadowing would show: `GET /api/pods/:podId/grants is reachable with the pod routes mounted` (goes red with the order reversed, 3 of 7). - A seat grant's read had no gate: ensureTargetAccess has no pod census for a seat, so a stranger in no pod read the tools and the granter with 200 while the trail refused them. Both reads now share one gate — a pod grant belongs to the pod (canViewPod, human or seat on its token), a seat grant goes only to the granter and that seat — pinned by `a seat grant's read is gated like its trail`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5
samxu01
force-pushed
the
wave/piece4-read-routes
branch
from
September 11, 2026 19:51
de691b8 to
3ce5219
Compare
…unted Mounts routes/pods after podGrantsRouter, the server.ts order, with the pod controller stubbed so its `/:type/:id` catch-all would show: `GET /api/pods/:podId/grants is reachable with the pod routes mounted` goes red (3 of 8) with the order reversed. The test was written for the mount fix and lost to a `git checkout` during its own mutation check before the commit. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5
This was referenced Sep 11, 2026
samxu01
pushed a commit
that referenced
this pull request
Sep 11, 2026
…ays free of GitHub crypto After the rebase onto #1668, grants.read.test.js mounted routes/grants.ts unmocked and the new resolveBrokerFor import pulled toolBrokerService → githubAppService → jsonwebtoken at load, which throws on Node 26 (SlowBuffer is gone). The broker definitions are only needed when seeding or projecting tools, so require them on first use. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lilyshen0722
added a commit
that referenced
this pull request
Sep 11, 2026
…erives brokerId (#1670) * feat(tools): builtin GitHub tool Installable in the catalogue; mint derives brokerId Piece 2 follow-up (tools plan §2, §6). The catalogue returned only channel providers, so the Tools page had no not-yet row, no allow-list and no broker to mint against (lily-shen 67719). - seed-builtin-tools.ts upserts the builtin GitHub Installable at boot with one mcp-server component named for the broker (commonly-grant-broker) and enabledTools projected from TOOL_DEFINITIONS, never hand-written. - GET /api/installables is one response, two lists: every entry carries list: 'channels' | 'tools'. A tool entry adds broker, tools (name, tier, irreversible) and the caller's own connected GitHub App connections (connectionId, owner, repo). No credential or Connection _id leaves the route. - POST /api/grants reads brokerId from the seeded row and ignores the body's; a tool outside enabledTools is 400 invalid_tools, no seed row is 503 broker_unavailable. - V2ConnectorsPage filters list: 'tools' out of its rows. Named tests: the builtin GitHub Installable enables exactly the broker's GitHub tools; brokerId comes from the tool Installable, never the body; the mint refuses a tool the Installable does not enable; the catalogue returns the GitHub tool Installable with its tools, broker and the caller's connections, on the tools list; a tool Installable in the catalogue never renders as a channel row. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(grants): refuse a client-supplied brokerId at mint Vera 67728: the field naming who holds the credential must not be caller-written. A body carrying brokerId is now 400 invalid_broker; the server still sets it from the seeded tool Installable. Named test: a client-supplied brokerId is refused. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * fix(tools): load the broker definitions lazily so routes/grants.ts stays free of GitHub crypto After the rebase onto #1668, grants.read.test.js mounted routes/grants.ts unmocked and the new resolveBrokerFor import pulled toolBrokerService → githubAppService → jsonwebtoken at load, which throws on Node 26 (SlowBuffer is gone). The broker definitions are only needed when seeding or projecting tools, so require them on first use. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
samxu01
pushed a commit
that referenced
this pull request
Sep 11, 2026
…ption A) Tools plan §6: a second list under the channels in the same row grammar, one row per RoomGrant the person can see (live · pulsing when used in the last 10 min · hollow when revoked or expired), the aside from the projected grant (who granted it and when it ends, the agents allowed, the allow-list under its write mode, what asks a person first, budget, two-click Revoke) and the trail from the broker's rows — one muted mono line per ToolCall with the three COUNT(*) numbers in display 22 / mono 11. Heading with the mono count, a search field and a segment on the same line. 390 as the channels list. SEAM (Wren 67724/67725): the not-yet row, the Add form and Change access wait on the builtin GitHub Installable landing in GET /api/installables with its McpServer.enabledTools; the server derives brokerId. Until then `catalog` is empty and those controls do not render — nothing pretends to grant. Reads only /api/pods/:podId/grants, /api/grants/:id/calls, /api/registry/pods/:podId/agents (#1668). GitHub glyph added to the platform set. Layout invariants: trail line is muted mono with no semantic colour; counts are 22/11; the display titles reset under :lang(zh). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5
samxu01
pushed a commit
that referenced
this pull request
Sep 12, 2026
…ption A) Tools plan §6: a second list under the channels in the same row grammar, one row per RoomGrant the person can see (live · pulsing when used in the last 10 min · hollow when revoked or expired), the aside from the projected grant (who granted it and when it ends, the agents allowed, the allow-list under its write mode, what asks a person first, budget, two-click Revoke) and the trail from the broker's rows — one muted mono line per ToolCall with the three COUNT(*) numbers in display 22 / mono 11. Heading with the mono count, a search field and a segment on the same line. 390 as the channels list. SEAM (Wren 67724/67725): the not-yet row, the Add form and Change access wait on the builtin GitHub Installable landing in GET /api/installables with its McpServer.enabledTools; the server derives brokerId. Until then `catalog` is empty and those controls do not render — nothing pretends to grant. Reads only /api/pods/:podId/grants, /api/grants/:id/calls, /api/registry/pods/:podId/agents (#1668). GitHub glyph added to the platform set. Layout invariants: trail line is muted mono with no semantic colour; counts are 22/11; the display titles reset under :lang(zh). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5
lilyshen0722
added a commit
that referenced
this pull request
Sep 12, 2026
…ption A) (#1669) * feat(v2): Tools on the Connectors page — the granted half (piece 4, option A) Tools plan §6: a second list under the channels in the same row grammar, one row per RoomGrant the person can see (live · pulsing when used in the last 10 min · hollow when revoked or expired), the aside from the projected grant (who granted it and when it ends, the agents allowed, the allow-list under its write mode, what asks a person first, budget, two-click Revoke) and the trail from the broker's rows — one muted mono line per ToolCall with the three COUNT(*) numbers in display 22 / mono 11. Heading with the mono count, a search field and a segment on the same line. 390 as the channels list. SEAM (Wren 67724/67725): the not-yet row, the Add form and Change access wait on the builtin GitHub Installable landing in GET /api/installables with its McpServer.enabledTools; the server derives brokerId. Until then `catalog` is empty and those controls do not render — nothing pretends to grant. Reads only /api/pods/:podId/grants, /api/grants/:id/calls, /api/registry/pods/:podId/agents (#1668). GitHub glyph added to the platform set. Layout invariants: trail line is muted mono with no semantic colour; counts are 22/11; the display titles reset under :lang(zh). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5 * feat(v2): Tools — the not-yet row, Add, Change access and Grant again from the catalogue (#1670), with direction-A marks The seam closes on Wren's catalogue: GET /api/installables now lists the GitHub tool Installable (list: 'tools') with its projected allow-list and the caller's Connections, so the page draws what the server enforces: - not-yet row per tool Installable with no live grant — dashed dot, muted name, what it does, `read, or read and write`, `not granted`, Add (ink); without a Connection or on an unconfigured instance the row says so and offers no Add. - Add opens in the aside: room, connection (when more than one), a writeMode segment, the allow-list the mode admits (read → read tools; write modes → all), what asks first (the catalogue's irreversible tools under `write`), every non-internal seat in the room checked, expiry 7/30/90 days, Grant (ink). The mint body is the server's: connectionId, installationId, target, tools, writeMode, audience, expiresAt — never a brokerId (Vera 67728). - Change access pre-fills from the grant (effectiveAudience, not the raw snapshot — Vera 67568) and is a new grant plus a revoke of the old one; Grant again on an expired/revoked row only mints. - "what asks first" under `write` lists the catalogue's irreversible tools. - direction A (Sam 2026-09-11): the grant's mode and a trail line's outcome carry a 14px mark with the word in `title`; the granted row no longer repeats the tool's description sentence. glyphs.tsx is the same file #1671 adds (identical content, merges clean). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5 * fix(v2): the Add form sends no installationId — the mint takes it from the Connection (#1677) Vera 67821 via #1677: a grant on connection A must not be able to name installation B, so the mint derives installationId from the Connection and refuses a client-supplied one. The body is now exactly the six keys the route takes — audience, connectionId, expiresAt, target, tools, writeMode — pinned by key list, with brokerId and installationId both asserted absent. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5 * fix(v2): Tools — Revoke and Change access are the granter's; a failed revoke after Change access is retried alone; the trail says "awaiting a person" Vera 67912 / Wren 67913 on 0368992: - Revoke and Change access render only when grant.grantedBy is the viewer — the route 403s anyone else, so the page never draws a control the server would refuse. A member still reads the grant and its trail. - Change access keeps the minted grant whatever happens next. If the revoke of the old grant fails, the aside says the old one is still live and offers "Revoke the old grant", which retries only the revoke — never a third mint. - A trail line's outcome reads like the count: pending_approval → "awaiting a person" (the mark's title too). Tests: "Revoke renders only for the granter"; the failed-revoke retry pins the three POSTs as mint, revoke, revoke. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5 --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Piece 4 of the connectors build, option A — the read routes named in
docs/plans/tools-catalogue-room-grants.md§6 Sequencing, before the page. Assignment: Connectors v2 pod 67699. Reviewer: Vera clears the exact head.Routes
GET /api/pods/:podId/grants— every grant whose target is the pod or a seat in it (seat id ∈ pod members), gated byDMService.canViewPod, each row projected. Malformed id → 403, missing pod → 404. Mounted under/api/podsbeside the pod routes (server.ts).GET /api/grants/:grantId/calls—ToolCall.listForGrant(limit ≤500, default 100) pluscounts= COUNT(*) by outcome ({total, ok, refused, pending_approval, failed}; newToolCall.countsForGrant). Pod target:canViewPodfor a human or a seat on its runtime token (dualAuth). Seat target: only the granter (Connection owner) or that seat; membership never substitutes. Lines carryargsDigest, neverargs.GET /api/grants/:grantId— tightened to the explicit field list:grantId, installationId, target, tools, writeMode, budget, effectiveAudience, expiresAt, revokedAt, parentGrantId, rootGrantId, createdAt, grantedBy. NeverconnectionId,brokerId,audience,_id(Vera 67560/67568).grantedByis resolved from the Connection's owner.Named tests (
backend/__tests__/unit/routes/grants.read.test.js, memory Mongo forRoomGrant; pod, connection and trail mocked at their module boundaries):the pod grants list refuses a non-memberthe trail refuses a non-member and never returns argsa seat grant's trail is visible only to its granter and the seatGET /api/grants/:id returns the field list and never connectionId or brokerIdToolCall.countsForGranton pg-mem (ToolCall.counts.test.js).Backend 18/18 across the grant suites (
mcpGrants.test.jsneeds@modelcontextprotocol/sdk, absent from my local node_modules — CI has it),lint:ts0 errors. No frontend changes in this PR; the page follows in its ownwave/piece4-*branch once these are cleared.🤖 Generated with Claude Code
https://claude.ai/code/session_016DspLEe1mFV94dPGCqA1u5