Skip to content

feat(access): let any member list their own grants (me access mine) (TNT-141)#103

Merged
jgpruitt merged 4 commits into
mainfrom
jgpruitt/me-access-mine
Jun 25, 2026
Merged

feat(access): let any member list their own grants (me access mine) (TNT-141)#103
jgpruitt merged 4 commits into
mainfrom
jgpruitt/me-access-mine

Conversation

@jgpruitt

Copy link
Copy Markdown
Collaborator

Summary

me access ls enumerates the whole space's grants and is therefore admin/owner-only. There was no way for a non-admin member to see the grants they hold. This adds me access mine — a self-view of the calling principal's own grants, usable by any member — mirroring the existing me group mine.

Closes TNT-141.

Changes

  • server (packages/server/rpc/memory/grant.ts): grantList gains an ownSelf self-service branch — a caller may list grants where principalId === ctx.principalId without admin/owner rights. The principalId pins the SQL filter, so it can never reveal another principal's grants. No protocol/client/engine/SQL changes — grant.list and list_tree_access_grants already filter by principal.
  • cli (packages/cli/commands/access.ts): createAccessMineCommand() mirrors me group minewhoamigrant.list({ principalId: me.id }) → prints a tree_path | access table (principal omitted since it's always you), with an empty-state message. me access ls is unchanged (stays admin/owner-scoped, matching me group ls).
  • tests (management.integration.test.ts): a non-admin member can list their own grants but is FORBIDDEN for another principal or the whole space; an agent owner can list its agent's grants while a stranger cannot.
  • docs: docs/cli/me-access.md (new section + scoping note) and docs/typescript-client.md.

Design note

Picked ticket option 2 (dedicated me access mine) over making ls adaptive, to mirror me group mine (which is a separate command; me group ls has no self-view fallback). The server relaxation is the mechanism both options would share.

Verification

./bun run check:full — 0 failures (647 unit / 938 db / 26 e2e).

…TNT-141)

`me access ls` enumerates the whole space's grants and stays admin/owner-only.
Add `me access mine` — a self-view of the calling principal's own grants,
usable by any member — mirroring `me group mine`.

- server: grantList gains an ownSelf self-service branch (principalId ===
  caller); the principal filter pins results to the caller, so it can't reveal
  anyone else's grants. No protocol/engine/SQL change — list_tree_access_grants
  already filters by principal.
- cli: createAccessMineCommand (whoami -> grant.list({ principalId: me.id })),
  printing tree_path | access. `me access ls` is unchanged.
- tests + docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a self-service way for non-admin space members to inspect their own tree-access grants, aligning access tooling with the existing “self-view” patterns (e.g. me group mine) while keeping whole-space grant enumeration restricted.

Changes:

  • Server: relaxes grant.list authorization to allow listing grants for principalId === caller (and continues to allow listing grants for an owned agent) without admin/path-owner.
  • CLI: introduces me access mine, which calls whoami then lists grants for the caller and prints a simplified table.
  • Tests/docs: adds integration coverage for the new authorization behavior and documents the new command and scoping rules.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/server/rpc/memory/grant.ts Adds a self-service authorization branch for listing the caller’s own grants.
packages/cli/commands/access.ts Adds me access mine command to list and display the caller’s grants.
packages/server/rpc/memory/management.integration.test.ts Adds integration tests covering self-service grant listing and permission denials.
docs/cli/me-access.md Documents the new me access mine command and clarifies list scoping.
docs/typescript-client.md Notes self-service behavior when grant.list is scoped to caller/owned agent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/cli/commands/access.ts Outdated
Comment thread packages/server/rpc/memory/grant.ts Outdated
Comment thread docs/cli/me-access.md Outdated
jgpruitt and others added 3 commits June 25, 2026 13:25
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: John Pruitt <jgpruitt@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: John Pruitt <jgpruitt@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: John Pruitt <jgpruitt@gmail.com>
@jgpruitt jgpruitt merged commit d4e9f83 into main Jun 25, 2026
5 checks passed
@jgpruitt jgpruitt deleted the jgpruitt/me-access-mine branch June 25, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants