Skip to content

fix: apply versioningEnabled in canvases update#3903

Merged
forestileao merged 7 commits intomainfrom
cursor/cli-versioning-enabled-5a05
Apr 2, 2026
Merged

fix: apply versioningEnabled in canvases update#3903
forestileao merged 7 commits intomainfrom
cursor/cli-versioning-enabled-5a05

Conversation

@forestileao
Copy link
Copy Markdown
Collaborator

@forestileao forestileao commented Apr 1, 2026

What

  • superplane canvases update -f now applies metadata.versioningEnabled from canvas YAML.
  • The CLI blocks attempts to disable canvas versioning when organization-level versioning is enabled.

Why

  • versioningEnabled is canvas metadata, not part of canvas version updates, so it was being ignored.
  • The backend enforces org-level versioning (org > canvas); attempting to disable at the canvas level should be an explicit error.

How

  • When YAML explicitly sets metadata.versioningEnabled, the CLI issues an additional PUT /api/v1/canvases/{id} with {"versioningEnabled": <bool>}.
  • Toggle logic is now encapsulated in a small planning helper (planCanvasVersioningUpdate) to keep Execute readable.

Tests

  • Canvas update tests were simplified using an expectation-based API test server helper to avoid large handlers and make request ordering assertions easier to read.
Open in Web Open in Cursor 

Co-authored-by: Pedro Leão <forestileao@users.noreply.github.com>
@superplanehq-integration
Copy link
Copy Markdown

👋 Commands for maintainers:

  • /sp start - Start an ephemeral machine (takes ~30s)
  • /sp stop - Stop a running machine (auto-executed on pr close)

@cursor cursor Bot mentioned this pull request Apr 1, 2026
Comment thread pkg/cli/commands/canvases/update.go Outdated
@forestileao forestileao marked this pull request as ready for review April 2, 2026 11:08
Comment thread pkg/cli/commands/canvases/update.go Outdated
Co-authored-by: Pedro Leão <forestileao@users.noreply.github.com>
Comment thread pkg/cli/commands/canvases/update.go Outdated
Comment thread pkg/cli/commands/canvases/update.go Outdated
Comment thread pkg/cli/commands/canvases/update_test.go Outdated
@forestileao
Copy link
Copy Markdown
Collaborator Author

@cursoragent the current PR is very complex to understand. it has a lot of nesting. And the test is hard to aunderstand too

Take a look also in the undersolved comments from @shiroyasha

@cursor
Copy link
Copy Markdown
Contributor

cursor Bot commented Apr 2, 2026

Reduced complexity per review feedback

  • Refactored canvases update versioning logic out of Execute into small helpers in pkg/cli/commands/canvases/update.go:
    • requestedCanvasVersioningEnabled(...) isolates “did YAML explicitly set it?”
    • planCanvasVersioningUpdate(...) encapsulates the multi-condition logic (addresses @shiroyasha’s “4-condition ifs” + “move logic into helper” feedback) and returns a simple versioningPlan (effectiveEnabled, enableAfterSpecUpdate).

Simplified tests

  • Reworked pkg/cli/commands/canvases/update_test.go to use a small expectation-based API test server (newAPITestServer) instead of large per-test handler switch blocks. Each test now reads as an ordered list of expected requests + small inline handlers.

Verification + PR update

  • Ran gofmt and go test ./pkg/cli/commands/canvases.
  • Committed and pushed the refactor (refactor: simplify canvases update versioning flow) and updated the PR description to reflect the simplification.

View PR

Open in Web Open in Cursor 

Co-authored-by: Pedro Leão <forestileao@users.noreply.github.com>
Comment thread pkg/cli/commands/canvases/update_test.go Outdated
Comment thread .gitignore Outdated
cursoragent and others added 2 commits April 2, 2026 12:49
Co-authored-by: Pedro Leão <forestileao@users.noreply.github.com>
Co-authored-by: Pedro Leão <forestileao@users.noreply.github.com>
Comment thread pkg/cli/commands/canvases/update.go Outdated
@shiroyasha
Copy link
Copy Markdown
Collaborator

Looks better.

Co-authored-by: Pedro Leão <forestileao@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread pkg/cli/commands/canvases/update_test.go
@forestileao forestileao merged commit 3db8df6 into main Apr 2, 2026
5 checks passed
@forestileao forestileao deleted the cursor/cli-versioning-enabled-5a05 branch April 2, 2026 14:04
harxhist pushed a commit to harxhist/superplane that referenced this pull request Apr 4, 2026
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
### What
- `superplane canvases update -f` now applies
`metadata.versioningEnabled` from canvas YAML.
- The CLI blocks attempts to disable canvas versioning when
organization-level versioning is enabled.

### Why
- `versioningEnabled` is canvas *metadata*, not part of canvas version
updates, so it was being ignored.
- The backend enforces org-level versioning (org > canvas); attempting
to disable at the canvas level should be an explicit error.

### How
- When YAML explicitly sets `metadata.versioningEnabled`, the CLI issues
an additional `PUT /api/v1/canvases/{id}` with `{"versioningEnabled":
<bool>}`.
- Toggle logic is now encapsulated in a small planning helper
(`planCanvasVersioningUpdate`) to keep `Execute` readable.

### Tests
- Canvas update tests were simplified using an expectation-based API
test server helper to avoid large handlers and make request ordering
assertions easier to read.

<!-- CURSOR_AGENT_PR_BODY_END -->

<div><a
href="https://cursor.com/agents/bc-9cf85b36-e0b9-437a-96a3-a7416f0b8601"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-9cf85b36-e0b9-437a-96a3-a7416f0b8601"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Pedro Leão <forestileao@users.noreply.github.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.

3 participants