Repository navigation
perf(cli): resolve a teamspace for drive reads from the org and memberships only - #209
Merged
Merged
Conversation
…rships only
lightning cp, ls and walk built a full Teamspace to learn its ID, fetching
memberships and the project twice. Reads now resolve an org-owned teamspace
from GET /v1/orgs and GET /v1/memberships alone, so they no longer need
GET /v1/projects/{id}. User-owned teamspaces and lit:/// paths still go
through the full lookup; uploads keep it for cloud-account resolution.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Danidapena
requested review from
ethanwharris,
justusschock,
k223kim,
owbone,
rusenask and
tejapulagam
as code owners
October 21, 2026 21:00
Teamspaces are always owned by an organization, so drop the fallback to the full lookup for a named teamspace: an unknown org or a teamspace the user is not a member of is now an error. lit:/// paths still resolve the current teamspace. Tests for the read paths mock resolve_teamspace_ref. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…amspace lit:/// read the current teamspace's name and org from the environment or config, then built a full Teamspace. Resolve those names the same way and use the org-and-memberships lookup, so a relative path makes the same two requests as lit://<org>/<teamspace>/. With no current teamspace configured it is now a ValueError pointing at the long form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
owbone
approved these changes
Oct 22, 2026
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.
Resolve the teamspace for
lightning cpdownloads,lsandwalkfrom its org and the user's memberships alone, so drive reads no longer callGET /v1/projects/{id}.Summary
resolve_lit_urlbuilds a fullTeamspacejust to learn its ID. That fetches memberships and the project twice per command, and needsGET /v1/projects/{id}.resolve_teamspace_ref/resolve_lit_url_refresolvelit://<org>/<teamspace>/...fromGET /v1/orgs/?name=<org>andGET /v1/memberships?filterByUserId=True, one call each, and return only the teamspace's ID and name.ValueError.lit:///paths take the current teamspace's name and org from the same sourcesTeamspaceuses (LIGHTNING_TEAMSPACE/LIGHTNING_ORG, then~/.lightning/config.yaml), then make the same two requests. With no current teamspace configured they raise aValueErrorpointing at the long form.Filesystem.copydownloads,listdirandwalkuse it. Uploads keep the fullTeamspace, since they may need its cloud account.OrgApi.find_org_id(Noneon 404) andTeamspaceApi.find_teamspace_id, which matches on name or display name and raises on ambiguity likeget_teamspace.Why
During the platform relaunch only a small allow-list of
/v1/paths is reachable. With this change a download needsGET /v1/orgs/,GET /v1/membershipsand the drive'strees/blobsroutes, and no longerGET /v1/projects/{id}.Testing
tests/core/filesystem/test_filesystem_teamspace_lookup.py, 10 tests: the org/memberships path makes no project or full-resolution call; display-name match;lit:///from env, from config, and with nothing configured; unknown org and non-member teamspace errors; a non-404 org error is raised; ambiguous names; a file download end to end.copy/listdir/walkread tests now mockresolve_teamspace_refinstead ofresolve_teamspace.uv, which wasn't installed, and running mypy directly on the changed files reported only missing third-party stubs.lit://<org>/<teamspace>/andlit:///, now makesorgs→memberships→trees, with no/v1/projects/{id}. Not verified live: a real file download through the blob route.🤖 Generated with Claude Code
— Claude Opus 5.5, on direct instruction; reviewed before posting