Skip to content

fix(sdk): find a user's teamspaces under their personal org - #216

Closed
owbone wants to merge 2 commits into
mainfrom
owbone/teamspace-personal-org
Closed

owbone wants to merge 2 commits into
mainfrom
owbone/teamspace-personal-org

Conversation

@owbone

@owbone owbone commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Find a user's teamspaces under their personal org, so lookups by a user owner keep working once the control plane stops listing user-owned copies of them.

Summary

  • TeamspaceApi.list_teamspaces and find_teamspace_id take an owner ID and match it against GET /v1/memberships. When nothing there is listed under the owner ID, and that ID is the authed user's, they also match the user's personal org: the org from GET /v1/orgs with is_personal_org set and creator_id equal to the user's ID. The lookup is cached per client, and with no personal org the behaviour is unchanged.
  • Another user's ID can't be mapped to their org, so it still matches only itself.
  • This covers every caller that finds a teamspace by a user without touching them: Teamspace.__init__ (the owner/name slug fallback, user=, LIGHTNING_USERNAME, teamspace_owner_type: user), Owner.teamspaces for a User, and the default teamspace in llm.py.
  • The drive CLI (ls, cp) and accessible_teamspaces are unchanged: they already resolve by org.

Why

gridai/grid#49036 removes a shim from ListMemberships that added a user-owned copy of every teamspace in the caller's personal org (from gridai/grid#41843). Without it, every SDK lookup by a user owner finds nothing.

Testing

  • New tests in tests/api/test_teamspace_api.py, against memberships listed only by org: the authed user's ID finds its personal org's teamspaces and lists orgs once; with no personal org, nothing is found; another user's ID and an org ID are not mapped and list no orgs.
  • test_get_teamspace_error now mocks whoami, since its owner has no memberships.
  • Full suite: 2689 passed, 8 skipped. Ruff 0.1.0 and mypy are clean; the pre-commit hooks weren't run.
  • Against staging, which still lists the user-owned copies: the authed user's personal org resolves to oliver-org, and with the user-owned copies filtered out of the memberships, find_teamspace_id("general", <user id>) still finds general. Not verified: list_teamspaces and Teamspace(..., user=...) end to end.

🤖 Generated with Claude Code

— Claude Opus 5.5, on direct instruction; text not reviewed

owbone and others added 2 commits October 27, 2026 20:02
The control plane is dropping the user-owned copies of personal-org
teamspaces from ListMemberships (gridai/grid#49036). Every lookup that
finds a teamspace by a user owner then comes up empty.

When nothing in the memberships is listed under the authed user's own ID,
TeamspaceApi.list_teamspaces and find_teamspace_id also match the user's
personal org, found from GET /v1/orgs and cached per client. Another
user's ID still matches only itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@owbone

owbone commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

Closing in favour of removing user-owner teamspace lookups altogether: every teamspace is owned by an org now.

— Claude Opus 5.5, on direct instruction; text not reviewed

@owbone owbone closed this Oct 27, 2026
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.

1 participant