Skip to content

feat: platform login, logout and workspace commands - #1791

Draft
skevetter wants to merge 9 commits into
mainfrom
mission/client-integration
Draft

skevetter wants to merge 9 commits into
mainfrom
mission/client-integration

Conversation

@skevetter

Copy link
Copy Markdown
Contributor

Summary

CLI integration with the managed platform gateway.

  • devsy login / devsy logout: email/password login mints an org-scoped API key stored in the config (0600, no password or session token stored). Logout revokes the key and keeps the gateway URL as a logged-out marker.
  • devsy workspace list|create|sleep|wake|delete against the platform. Read-only keys are denied on writes. After logout, commands fail with an authentication error and a devsy login hint. --skip-platform keeps local behavior.
  • tuistory e2e scripts in hack/platform-e2e (mise run cli:test:e2e:platform) covering lifecycle, cross-org delete refusal, member removal and key revocation.
  • README section documenting the platform commands.

Testing

Scoped go test -p 1, go vet and golangci-lint on the changed packages pass; live e2e scripts pass against the platform stack (14/14 client assertions).

Known pre-existing failures, unrelated and not fixed: hack/sign_commit test and 8 cyclop/funlen lint findings in untouched files (cmd/workspace/up/*, pkg/devcontainer/*).

Companion PR: devsy-org/platform mission/beta-hardening.

skevetter and others added 9 commits November 7, 2026 17:17
`devsy login <gateway-url>` prompts for email and password (no echo on a
terminal), signs in with POST /v1/auth/login, picks the org (only org,
--org, or a numbered prompt), creates a read/write API key named
devsy-cli, and stores the key, key IDs, org and gateway URL under
`gateway:` in config.yaml (mode 0600). The password and session token are
never stored or printed, and the key is never printed. Failures before the
key is saved leave the config untouched; a key that cannot be saved is
revoked.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…eway

Add `devsy workspace sleep|wake NAME` and route `devsy workspace delete NAME...`
to the gateway when logged in (--skip-platform keeps the local delete). Each
call must be answered 202, otherwise the command exits non-zero with the
gateway's message.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
A 403 from the platform gateway now reads "permission denied: the stored
API key lacks write scope", naming read for GET calls and write for
everything else, and the command exits non-zero. Adds the tuistory check
for a read-only key creating a workspace (VAL-CLI-009).

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
`devsy logout` calls DELETE /v1/orgs/{org}/api-keys/{id} with the stored key
as bearer. On 204 or 404 it clears the key, key ID and org from the config and
keeps the gateway URL. Any other error exits non-zero and keeps the key.

Because the URL stays, `devsy workspace list` now fails with an authentication
error after logout instead of falling back to local workspaces; --skip-platform
still lists local ones.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
cross-lifecycle.sh runs workspace create, sleep, wake and delete as an org A
user and requires kubectl, GET /v1/workspaces and `devsy workspace list` to
agree at every step (VAL-CROSS-001). cross-org-delete.sh checks that an org A
CLI session cannot delete an org B workspace (VAL-CROSS-002). Both are run by
the new cli:test:e2e:platform mise task.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…key revoke

access-revocation.sh logs a user in with devsy, removes them through
DELETE /v1/orgs/{org}/members/{user} (204) and requires the next
`devsy workspace list` to exit non-zero with an authentication error
(VAL-CROSS-003). A second login's key is revoked through
DELETE /v1/orgs/{org}/api-keys/{id} (204) and the next list must exit
non-zero with the `devsy login` hint (VAL-CROSS-004). Both run in the
cli:test:e2e:platform mise task.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
…cally

runPlatform returned handled=false for a logged-out config (gateway URL
set, key cleared), so `devsy workspace delete NAME` fell through to the
local delete path. Return the authentication error, as list and create
already do. --skip-platform still deletes locally. The logged-out message
now says "work with local workspaces" since it is shared by delete.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@netlify

netlify Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 8388c3f
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6af01b4bfc4215de5f1cea2d

@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@netlify

netlify Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 8388c3f
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6af01b4b0d10fc0df1e6327d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant