Skip to content

fix: persist published templates without runtime setup#4177

Open
orange-dot wants to merge 13 commits intosuperplanehq:mainfrom
orange-dot:upstream/fix-template-create-canvas-validation
Open

fix: persist published templates without runtime setup#4177
orange-dot wants to merge 13 commits intosuperplanehq:mainfrom
orange-dot:upstream/fix-template-create-canvas-validation

Conversation

@orange-dot
Copy link
Copy Markdown

Summary

This is a narrow backend correctness fix for template-backed canvas creation. It preserves the published-template path while restoring the expected InvalidArgument error semantics for the auto-layout failure case.

Why

On the current path, a template auto-layout failure can escape with the wrong gRPC status even though the caller-level failure is still an invalid input/configuration condition. This makes the published-template flow harder to reason about and weakens the contract at the API boundary.

What changed

  • mark template auto-layout failures through a dedicated internal sentinel path
  • map that path back to codes.InvalidArgument at the create-canvas boundary
  • keep the published-template persistence path intact rather than reintroducing runtime setup coupling
  • add a focused regression test that locks the auto-layout semantics directly

Scope guardrails

  • no schema or API shape changes
  • no changes to runtime execution semantics beyond the error mapping fix
  • no broad refactor outside the create-canvas/template-canvas surface

Validation

  • isolated superplane_test DB recreate plus schema/data migrations
  • docker compose -f docker-compose.dev.yml run --rm --no-deps -e DB_NAME=superplane_test app go test ./pkg/grpc/actions/canvases -run 'TestCreateCanvasTemplateSkipsSetupValidationForOrgSpecificIntegrationNodes|TestCreateCanvasTemplateAutoLayoutReturnsInvalidArgument' -count=1 -p 1
  • docker compose -f docker-compose.dev.yml run --rm --no-deps -e DB_NAME=superplane_test app go test ./pkg/grpc/actions/canvases -run 'TestCreateCanvas' -count=1 -p 1

Observed results:

  • targeted template regression tests passed
  • focused TestCreateCanvas* slice passed
  • the signed-off single-commit snapshot was rerun as-is after metadata cleanup

Request for review

Would appreciate confirmation that this is the right place to preserve the published-template flow while restoring the InvalidArgument contract for the template auto-layout path.

Signed-off-by: Bojan Janjatović <bojan.janjatovic@mamut-studio.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)

Comment thread pkg/templates/seed.go
Comment thread pkg/grpc/actions/canvases/template_canvas.go
Comment thread pkg/grpc/canvas_service.go
Signed-off-by: Bojan Janjatović <bojan.janjatovic@mamut-studio.com>
Comment thread pkg/grpc/actions/canvases/create_canvas.go
Signed-off-by: Bojan Janjatović <bojan.janjatovic@mamut-studio.com>
@orange-dot orange-dot force-pushed the upstream/fix-template-create-canvas-validation branch from fdb6744 to 3397b3c Compare April 16, 2026 17:12
Comment thread pkg/grpc/actions/canvases/template_canvas.go Outdated
Signed-off-by: Bojan Janjatović <bojan.janjatovic@mamut-studio.com>
@orange-dot orange-dot force-pushed the upstream/fix-template-create-canvas-validation branch from 0a50d54 to 4133d20 Compare April 17, 2026 19:15
Comment thread pkg/grpc/actions/canvases/create_canvas.go Outdated
Signed-off-by: Bojan Janjatović <bojan.janjatovic@mamut-studio.com>
Signed-off-by: Bojan Janjatović <bojan.janjatovic@mamut-studio.com>
Comment thread pkg/grpc/actions/canvases/create_canvas.go
Signed-off-by: Bojan Janjatović <bojan.janjatovic@mamut-studio.com>
(cherry picked from commit 1e1fea623386a541c83fc6b7dbe6953a33e5da44)
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.

Reviewed by Cursor Bugbot for commit 7536544. Configure here.

pbCanvas,
autoLayout,
)
}
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.

Unused parameters silently ignored after refactor

Low Severity

CreateCanvas still accepts encryptor, authService, and webhookBaseURL parameters, but after the refactor these are completely unused — the function simply delegates to CreateCanvasWithAutoLayoutAndUsage without forwarding them. The gRPC service layer (CanvasService.CreateCanvas) continues to pass real service instances for these parameters, giving the false impression they participate in canvas creation. This dead parameter surface is misleading for future maintainers and carries unnecessary import dependencies on crypto and authorization packages solely for the function signature.

Fix in Cursor Fix in Web

Triggered by project rule: SuperPlane — Bugbot (repository-wide)

Reviewed by Cursor Bugbot for commit 7536544. Configure here.

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