Skip to content

cli: read the camelCase -o json spin#1605 writes, and its failure kinds - #64

Merged
aledbf merged 3 commits into
mainfrom
cli-camelcase
Dec 1, 2026
Merged

aledbf merged 3 commits into
mainfrom
cli-camelcase

Conversation

@aledbf

@aledbf aledbf commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Why

spin-stack/spin#1828 (closing spin#1605) makes -o json one contract on every command. The extension reads the CLI's old output, so the first spin release that carries #1828 breaks it once versions.yaml moves to it (#60). Against a spin built from spin main (252c2020c), test/cli/real-spin.test.ts fails 4 of 4 on main and passes 4 of 4 on this branch.

What spin changed that the extension reads

  • Keys are camelCase: signedIn, verificationUrl/userCode/expiresIn, workspaceId/folderUri/notGiven, preparing.vscodeVersion/vscodeCommit, confirmingKey, and the envelope's workspaceId. Checked against spin main's struct tags and code.go, not only the issue.
  • The ssh status file is version 2, camelCase (sshPid, startedAt, updatedAt). A version 1 file left by an older spin is skipped.
  • A failure exits with its kind's status (spin help exit-codes: 64, 65, 66, 69, 75, 77), not 1. The extension never branched on the status, so only CliError.exitCode and the tests change.
  • Nine new codes: usage, invalid, not_found, already_exists, permission_denied, not_confirmed, refused, unavailable, timed_out, plus the actions help and confirm. Without a case, showCliError would have shown nothing for them. unavailable and timed_out offer Retry. The others show the CLI's message with Show Details and Copy Diagnostics, as no_vscode_server does.
  • errorActions is gone: spin pairs codes in failureKinds (exitcodes.go). hack/errcodes now reads spin's whole cmd/cli/cmd package, test files excluded, and task contract:spin checks it out sparsely.

The pin moves here

spin v20261201.01 is the first release that carries #1828. The Bump spin workflow checks main's contract before it proposes, so its run for that release failed (no errorActions, run 46724498387), and no bump could pass until this lands. This PR moves versions.yaml to v20261201.01 and package.json to 0.0.14, as spin:propose would, so the merge releases the extension with that CLI.

Rebased on #65, which gave every showEnvelope case an again. The nine new codes answer it too: unavailable and timed_out retry (true), the rest go through internal (false). The unknown-code case now uses quota_exceeded, since refused is a real code.

Local after the rebase: task contract:spin against v20261201.01 says the contract's codes are spin's. task ci passes (348 tests).

Checks

Run in a node:22 container (pnpm 11.27.1 via corepack, install through sfw):

  • pnpm typecheck, pnpm lint, pnpm build: clean.
  • pnpm test: 284 passed (248 on main, plus the new codes' cases).
  • pnpm test:cli with build/spin/linux-x64/spin built from spin main: 4/4. On main: 0/4.
  • go test ./hack/...: passes. hack/errcodes against spin main: the contract's codes are spin's. Against main's contract it lists the nine missing codes.
  • task gate: OK.
  • Not run: test:integration (real VS Code under xvfb) and the spin-remote/remote-ssh lanes.

spin-stack/open-remote-ssh#30 is the same change for Spinbox Remote (ssh-session's hostKey/workspaceId, code's notGiven/workspaceId).

🤖 Generated with Claude Code

spin-stack/spin#1828 makes -o json one contract: every key camelCase, the
error envelope's included, the ssh status file at version 2, and a failure's
exit status naming its kind (spin help exit-codes) where it was 1. It adds
nine codes to the envelope, which failureKinds in cmd/cli/cmd/exitcodes.go
pairs with their actions now that errorActions is gone.

The contract types, their callers, the fake spin and the tests read the new
keys and statuses. unavailable and timed_out offer Retry; the other new codes
show the CLI's message with Show Details and Copy Diagnostics. hack/errcodes
reads failureKinds from spin's whole cmd/cli/cmd package, which task
contract:spin now checks out sparsely, rather than one file.

Closes #60

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aledbf
aledbf marked this pull request as ready for review December 1, 2026 19:24
aledbf and others added 2 commits December 1, 2026 16:27
#65 gave every showEnvelope case an again; the nine codes this branch
adds arrived without one, and refused, the code the unknown-code case
used, is now the contract's. unavailable and timed_out retry, so they
answer true; the rest go through internal and answer false.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Bump spin workflow checks main's contract before it proposes, and
main's contract is the old one, so no bump past spin#1828 could pass
(run 46724498387: no errorActions). The pin moves with the contract
that reads it, and package.json to the next patch so the merge
releases it, as spin:propose would.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aledbf
aledbf enabled auto-merge (rebase) December 1, 2026 19:27
@aledbf
aledbf merged commit 58b13cc into main Dec 1, 2026
3 checks passed
@aledbf
aledbf deleted the cli-camelcase branch December 1, 2026 19:30
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