Skip to content

feat: make server commands respect workspace context#256

Merged
leechenghsiu merged 1 commit into
mainfrom
matthewlee/des-718-cli-server-list-should-respect-workspace-context
Jun 17, 2026
Merged

feat: make server commands respect workspace context#256
leechenghsiu merged 1 commit into
mainfrom
matthewlee/des-718-cli-server-list-should-respect-workspace-context

Conversation

@leechenghsiu

@leechenghsiu leechenghsiu commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • ListServers now accepts ownerID and passes it to servers(ownerID:) GraphQL query, matching the pattern used by ListProjects
  • All server subcommands (list, get, reboot, ssh, sshinfo, rename) now pass f.CurrentOwnerID() so they return the correct workspace's servers

Context

When using --workspace or workspace switch, server commands still returned personal servers because ListServers didn't pass the owner context to the backend. This is a sub-task of DES-715 (team-level agent quota).

Closes DES-718

Test plan

  • zeabur server list returns personal servers (no workspace set)
  • zeabur server list --workspace <teamId> returns team servers
  • zeabur workspace switch <team> then zeabur server list returns team servers

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Server management commands (list, get, reboot, rename, SSH, and SSH info) now correctly display only servers owned by the current user instead of all available servers.

ListServers now accepts ownerID and passes it to the servers(ownerID:)
GraphQL query, matching the existing pattern used by ListProjects.

All server subcommands (list, get, reboot, ssh, sshinfo, rename) now
pass f.CurrentOwnerID() so they return the correct workspace's servers
when --workspace is set or workspace switch has been used.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jun 17, 2026

Copy link
Copy Markdown

DES-718

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 09dfa41d-7540-416a-ba71-d31f9c0d00e4

📥 Commits

Reviewing files that changed from the base of the PR and between 43b89e5 and 10378d9.

📒 Files selected for processing (8)
  • internal/cmd/server/get/get.go
  • internal/cmd/server/list/list.go
  • internal/cmd/server/reboot/reboot.go
  • internal/cmd/server/rename/rename.go
  • internal/cmd/server/ssh/ssh.go
  • internal/cmd/server/sshinfo/sshinfo.go
  • pkg/api/interface.go
  • pkg/api/server.go

📝 Walkthrough

Walkthrough

The ServerAPI.ListServers method signature in pkg/api/interface.go is updated to accept an ownerID string parameter. The implementation in pkg/api/server.go conditionally constructs either an unfiltered GraphQL servers query (when ownerID is empty) or a filtered servers(ownerID: $ownerID) query with ownerID cast to ObjectID (when non-empty). All six server subcommands (list, get, reboot, rename, ssh, sshinfo) are updated to pass f.CurrentOwnerID() at their respective ListServers call sites.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: making server commands respect workspace context by passing owner scope to server operations.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@leechenghsiu leechenghsiu self-assigned this Jun 17, 2026
@leechenghsiu leechenghsiu requested a review from BruceDu521 June 17, 2026 04:14

@BruceDu521 BruceDu521 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.

LGTM. The server listing path now follows the same owner-scoped pattern as projects, and the affected interactive server commands pass the effective workspace owner through correctly.

@leechenghsiu leechenghsiu merged commit bf02b75 into main Jun 17, 2026
5 checks passed
@leechenghsiu leechenghsiu deleted the matthewlee/des-718-cli-server-list-should-respect-workspace-context branch June 17, 2026 04:46
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