Skip to content

fix: validate canvas edge output channels on API writes#4362

Merged
forestileao merged 4 commits into
mainfrom
fix/validate-output-channels
Apr 24, 2026
Merged

fix: validate canvas edge output channels on API writes#4362
forestileao merged 4 commits into
mainfrom
fix/validate-output-channels

Conversation

@forestileao

@forestileao forestileao commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

Closes: #4318

Summary

Reject canvas edges that reference an output channel the source node does not expose.

This prevents silent workflow stalls caused by invalid channel names in CLI/API canvas definitions, and returns a 400 InvalidArgument instead.

Changes

  • Add shared canvas output-channel validation for source nodes
  • Validate edge channels during full canvas parsing on create/update
  • Validate edge channels during canvas changeset application
  • Support validation for:
    • components
    • triggers (default)
    • blueprints
  • Add a transaction-safe blueprint lookup helper for validation paths
  • Add tests covering invalid channel rejection in:
    • canvas create
    • canvas version update
    • canvas patcher changesets

Behavior

Before:

  • Invalid edge channels could be persisted
  • Downstream nodes would silently never execute

After:

  • The API rejects invalid edge channels with 400
  • Error message includes the source node and requested channel

Testing

  • Ran make format.go
  • Ran make lint
  • Ran make check.build.app
  • Ran go test -run '^$' ./pkg/grpc/actions/canvases/... ./pkg/models/...

Note: DB-backed tests in this environment could not run because the test database connection was not configured (lookup port=: no such host).

Signed-off-by: Pedro F. Leao <pedroforestileao@gmail.com>

@cursor cursor Bot 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.

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 a9c31e9. Configure here.

Comment thread pkg/grpc/actions/canvases/serialization.go
Signed-off-by: Pedro F. Leao <pedroforestileao@gmail.com>
@forestileao forestileao force-pushed the fix/validate-output-channels branch from 1c3aab6 to 8cb46e6 Compare April 24, 2026 03:14
Signed-off-by: Pedro F. Leao <pedroforestileao@gmail.com>
@forestileao

Copy link
Copy Markdown
Collaborator Author

👍

Comment thread pkg/grpc/actions/canvases/serialization.go Outdated
Comment thread pkg/grpc/actions/canvases/changesets/output_channels.go Outdated
Signed-off-by: Pedro F. Leao <pedroforestileao@gmail.com>
@forestileao forestileao merged commit baaa22f into main Apr 24, 2026
5 checks passed
@forestileao forestileao deleted the fix/validate-output-channels branch April 24, 2026 13:10
@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)

WashingtonKK pushed a commit to WashingtonKK/superplane that referenced this pull request Apr 27, 2026
…#4362)

Closes: superplanehq#4318

## Summary

Reject canvas edges that reference an output channel the source node
does not expose.

This prevents silent workflow stalls caused by invalid channel names in
CLI/API canvas definitions, and returns a `400 InvalidArgument` instead.

## Changes

- Add shared canvas output-channel validation for source nodes
- Validate edge channels during full canvas parsing on create/update
- Validate edge channels during canvas changeset application
- Support validation for:
  - components
  - triggers (`default`)
  - blueprints
- Add a transaction-safe blueprint lookup helper for validation paths
- Add tests covering invalid channel rejection in:
  - canvas create
  - canvas version update
  - canvas patcher changesets

## Behavior

Before:
- Invalid edge channels could be persisted
- Downstream nodes would silently never execute

After:
- The API rejects invalid edge channels with `400`
- Error message includes the source node and requested channel

## Testing

- Ran `make format.go`
- Ran `make lint`
- Ran `make check.build.app`
- Ran `go test -run '^$' ./pkg/grpc/actions/canvases/...
./pkg/models/...`

Note: DB-backed tests in this environment could not run because the test
database connection was not configured (`lookup port=: no such host`).

---------

Signed-off-by: Pedro F. Leao <pedroforestileao@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
re-pixel pushed a commit to re-pixel/superplane that referenced this pull request May 4, 2026
…#4362)

Closes: superplanehq#4318

## Summary

Reject canvas edges that reference an output channel the source node
does not expose.

This prevents silent workflow stalls caused by invalid channel names in
CLI/API canvas definitions, and returns a `400 InvalidArgument` instead.

## Changes

- Add shared canvas output-channel validation for source nodes
- Validate edge channels during full canvas parsing on create/update
- Validate edge channels during canvas changeset application
- Support validation for:
  - components
  - triggers (`default`)
  - blueprints
- Add a transaction-safe blueprint lookup helper for validation paths
- Add tests covering invalid channel rejection in:
  - canvas create
  - canvas version update
  - canvas patcher changesets

## Behavior

Before:
- Invalid edge channels could be persisted
- Downstream nodes would silently never execute

After:
- The API rejects invalid edge channels with `400`
- Error message includes the source node and requested channel

## Testing

- Ran `make format.go`
- Ran `make lint`
- Ran `make check.build.app`
- Ran `go test -run '^$' ./pkg/grpc/actions/canvases/...
./pkg/models/...`

Note: DB-backed tests in this environment could not run because the test
database connection was not configured (`lookup port=: no such host`).

---------

Signed-off-by: Pedro F. Leao <pedroforestileao@gmail.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.

CLI: silently broken flows when using wrong output channel (e.g., default instead of success for HTTP)

1 participant