Skip to content

fix(sdk): stop looking up teamspaces by a user owner - #217

Draft
owbone wants to merge 1 commit into
mainfrom
owbone/drop-user-owner-teamspaces
Draft

owbone wants to merge 1 commit into
mainfrom
owbone/drop-user-owner-teamspaces

Conversation

@owbone

@owbone owbone commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Stop looking up teamspaces by a user owner. Every teamspace is owned by an org now, so these lookups now fail with an error that says to use <org>/<teamspace>.

Summary

  • Teamspace resolves its owner as an org only. These now raise a ValueError pointing to <org>/<teamspace>:
    • user= (already deprecated)
    • an owner/name slug whose owner isn't an org you're a member of, which used to fall back to a user
    • a saved teamspace_owner_type: user config, with a hint to run lightning config set teamspace <org>/<teamspace>
  • LIGHTNING_USERNAME with no org set is no longer used to pick the owner, so you get the "No organization specified" error instead.
  • User.teamspaces and User.create_teamspace raise the same error. UserApi.create_teamspace has no callers left and is removed.
  • Studio, Job, MMT, Deployment and the CLI's deprecated --user flag all pass user= through to Teamspace, so they raise the same error. Their signatures are unchanged.
  • llm.py:
    • An owner/teamspace is resolved as an org only. It used to try a user first.
    • With no teamspace set, the default is the first teamspace in the user's personal org, rather than the user's own teamspaces.
  • models.py no longer builds user/teamspace paths, and saved config always records an org owner.
  • Teamspace completion and lightning teamspace list no longer list the username as an owner, so completion stops suggesting an empty lit://<username>/.
  • The examples drop their --user flag, and teamspaces.rst recommends Teamspace("org/name").

Why

gridai/grid#49036 stopped ListMemberships from returning user-owned copies of personal-org teamspaces. Without them, every lookup by a user owner finds nothing and fails with a "does not exist" error that doesn't say what's wrong. Rather than map users to their personal org in the SDK, this drops user owners and says what to use instead.

Testing

  • Tests that built a teamspace from a user owner now use org-abc/ts-abc. Tests of the removed behaviour now assert the new errors:
    • user=
    • a non-org slug
    • a saved user-owner config
    • LIGHTNING_USERNAME without an org
    • User.teamspaces and User.create_teamspace
    • <user>/<teamspace> not found in models.py
  • New test_get_auth_info_defaults_to_personal_org_teamspace checks that the LLM default comes from the personal org.
  • Full suite: 2665 passed, 8 skipped. Ruff 0.1.0 and mypy are clean; the pre-commit hooks weren't run.
  • Against staging, Teamspace("oliver/general") and Teamspace("general", user="oliver") both raise the new error naming <org>/<teamspace>. Not verified against staging: resolving an org-owned teamspace end to end, and the LLM default.

🤖 Generated with Claude Code

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

Every teamspace is owned by an org now, and the control plane no longer
lists user-owned copies of personal-org teamspaces (gridai/grid#49036),
so a lookup by a user owner can only fail.

Teamspace resolves its owner as an org only. user=, a slug whose owner
isn't an org, LIGHTNING_USERNAME without an org, and a saved
teamspace_owner_type of "user" now raise an error that says to use
'<org>/<teamspace>'. User.teamspaces and User.create_teamspace raise the
same way, and UserApi.create_teamspace is gone.

The LLM default teamspace comes from the user's personal org, and an
'owner/teamspace' passed to LLM resolves the owner as an org. Teamspace
completion and `lightning teamspace list` no longer list the username as
an owner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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