Skip to content

Conversation

@ettec
Copy link
Contributor

@ettec ettec commented Jan 5, 2026

pushing changes done so far to support trigger capability errors

Copilot AI review requested due to automatic review settings January 5, 2026 17:32
@ettec ettec requested a review from a team as a code owner January 5, 2026 17:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the trigger wrapper generator to support capability errors by replacing standard error returns with caperrors.Error in trigger registration and unregistration methods.

Key Changes

  • Updated trigger interface method signatures to return caperrors.Error instead of error
  • Added adapter functions to bridge between the new capability error interface and the existing RegisterTrigger implementation
  • Regenerated code with protoc-gen-go v1.36.10

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
pkg/capabilities/v2/triggers/cron/trigger.pb.go Updated protoc-gen-go version from v1.36.8 to v1.36.10
pkg/capabilities/v2/triggers/cron/server/trigger_server_gen.go Changed trigger method return types to caperrors.Error and added adapter functions for RegisterTrigger calls
pkg/capabilities/v2/protoc/pkg/templates/server.go.tmpl Updated template to generate trigger methods with caperrors.Error return types and adapter function wrappers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

👋 ettec, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link

github-actions bot commented Jan 5, 2026

⚠️ API Diff Results - Breaking changes detected

📦 Module: github-com-smartcontractkit-chainlink-common

🔴 Breaking Changes (15)

pkg/capabilities (1)
  • RegisterTrigger — Type changed:
func(
  context.Context, 
  <-chan struct{}, 
  string, 
  TriggerRegistrationRequest, 
  I, 
  func(context.Context, 
  string, 
  RequestMetadata, 
  I) (<-chan TriggerAndId[O], 
  - error)
  + github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error)
)
(<-chan TriggerResponse, error)
pkg/capabilities/v2/chain-capabilities/evm/server.ClientCapability (2)
  • RegisterLogTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/evm.FilterLogTriggerRequest
)
- (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/evm.Log], error)
+ (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/evm.Log], github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error)
  • UnregisterLogTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/evm.FilterLogTriggerRequest
)
- error
+ github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error
pkg/capabilities/v2/chain-capabilities/solana/server.ClientCapability (2)
  • RegisterLogTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/solana.FilterLogTriggerRequest
)
- (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/solana.Log], error)
+ (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/solana.Log], github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error)
  • UnregisterLogTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/chain-capabilities/solana.FilterLogTriggerRequest
)
- error
+ github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error
pkg/capabilities/v2/protoc/pkg/test_capabilities/actionandtrigger/server.BasicCapability (2)
  • RegisterTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/protoc/pkg/test_capabilities/actionandtrigger.Config
)
- (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/protoc/pkg/test_capabilities/actionandtrigger.TriggerEvent], error)
+ (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/protoc/pkg/test_capabilities/actionandtrigger.TriggerEvent], github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error)
  • UnregisterTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/protoc/pkg/test_capabilities/actionandtrigger.Config
)
- error
+ github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error
pkg/capabilities/v2/protoc/pkg/test_capabilities/basictrigger/server.BasicCapability (2)
  • RegisterTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/protoc/pkg/test_capabilities/basictrigger.Config
)
- (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/protoc/pkg/test_capabilities/basictrigger.Outputs], error)
+ (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/protoc/pkg/test_capabilities/basictrigger.Outputs], github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error)
  • UnregisterTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/protoc/pkg/test_capabilities/basictrigger.Config
)
- error
+ github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error
pkg/capabilities/v2/triggers/cron/server.CronCapability (4)
  • RegisterLegacyTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/triggers/cron.Config
)
- (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/triggers/cron.LegacyPayload], error)
+ (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/triggers/cron.LegacyPayload], github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error)
  • RegisterTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/triggers/cron.Config
)
- (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/triggers/cron.Payload], error)
+ (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/triggers/cron.Payload], github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error)
  • UnregisterLegacyTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/triggers/cron.Config
)
- error
+ github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error
  • UnregisterTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/triggers/cron.Config
)
- error
+ github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error
pkg/capabilities/v2/triggers/http/server.HTTPCapability (2)
  • RegisterTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/triggers/http.Config
)
- (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/triggers/http.Payload], error)
+ (<-chan github.com/smartcontractkit/chainlink-common/pkg/capabilities.TriggerAndId[*github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/triggers/http.Payload], github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error)
  • UnregisterTrigger — Type changed:
func(
  context.Context, 
  string, 
  github.com/smartcontractkit/chainlink-common/pkg/capabilities.RequestMetadata, 
  *github.com/smartcontractkit/chainlink-common/pkg/capabilities/v2/triggers/http.Config
)
- error
+ github.com/smartcontractkit/chainlink-common/pkg/capabilities/errors.Error

📄 View full apidiff report

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 110438b Previous: 19be6d3 Ratio
BenchmarkKeystore_Sign/nop/in-process 791.5 ns/op 376.7 ns/op 2.10

This comment was automatically generated by workflow using github-action-benchmark.

@ettec ettec marked this pull request as ready for review January 5, 2026 18:07
@ettec ettec requested review from a team as code owners January 5, 2026 18:07
case {{- if (MapToUntypedAPI .) }} "" {{- else}} "{{.GoName}}" {{- end }}:
input := &{{ImportAlias .Input.GoIdent.GoImportPath}}.{{.Input.GoIdent.GoName}}{}
return capabilities.RegisterTrigger(ctx, c.stopCh, {{$fullCapabilityId}}, request, input, c.{{$service.GoName}}Capability.Register{{.GoName}})
return capabilities.RegisterTrigger(ctx, c.stopCh, {{$fullCapabilityId}}, request, input, func(ctx context.Context, triggerID string, metadata capabilities.RequestMetadata, input *{{ImportAlias .Input.GoIdent.GoImportPath}}.{{.Input.GoIdent.GoName}}) (<-chan capabilities.TriggerAndId[*{{ImportAlias .Output.GoIdent.GoImportPath}}.{{.Output.GoIdent.GoName}}], error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you making this change? It looks like you are adding a function that just makes the underlying call and nothing else. Is it some problem with error subtypes..? Please explain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a simpler way to do this - I've updated utils.go instead.

@ettec ettec force-pushed the trigger-capability-errors branch from 1a0c00b to 0f8f29e Compare January 6, 2026 14:39
Register{{.GoName}}(ctx context.Context, triggerID string, metadata capabilities.RequestMetadata, input *{{ImportAlias .Input.GoIdent.GoImportPath}}.{{.Input.GoIdent.GoName}}) (<- chan capabilities.TriggerAndId[*{{ImportAlias .Output.GoIdent.GoImportPath}}.{{.Output.GoIdent.GoName}}], error)
Unregister{{.GoName}}(ctx context.Context, triggerID string, metadata capabilities.RequestMetadata, input *{{ImportAlias .Input.GoIdent.GoImportPath}}.{{.Input.GoIdent.GoName}}) error
Register{{.GoName}}(ctx context.Context, triggerID string, metadata capabilities.RequestMetadata, input *{{ImportAlias .Input.GoIdent.GoImportPath}}.{{.Input.GoIdent.GoName}}) (<- chan capabilities.TriggerAndId[*{{ImportAlias .Output.GoIdent.GoImportPath}}.{{.Output.GoIdent.GoName}}], caperrors.Error)
Unregister{{.GoName}}(ctx context.Context, triggerID string, metadata capabilities.RequestMetadata, input *{{ImportAlias .Input.GoIdent.GoImportPath}}.{{.Input.GoIdent.GoName}}) caperrors.Error
Copy link
Contributor

Choose a reason for hiding this comment

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

despite I like bubbling up errors to the user, even when doing an unregistration, I'm failing to see how this will actually work in our current UX.
The unregistration event could happen either bc a customer pauses or deletes a WF, where are the errors going to show up if it pauses it? and if it's deleted are we planning in showing them the errors too?

Having said that, from EVM log trigger perspective: there's no way an unregistration is caused by user error, as if it was registered then it means all inputs are green, therefore any further error is just internal. So I'd rather leave this as error or even forcing it to be SystemError (which I believe is not possible currently, right?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree, I can't see any use case for the user/system origin and visibility attributes of caperrors on unregistration errors right now, but for consistency with all other capability APIs and to allow for some future unforeseen case it seems to make sense to also migrate it - but I could be persuaded otherwise.

@ettec ettec enabled auto-merge January 6, 2026 15:13
@ettec ettec added this pull request to the merge queue Jan 6, 2026
Merged via the queue into main with commit f3ee1f2 Jan 6, 2026
36 checks passed
@ettec ettec deleted the trigger-capability-errors branch January 6, 2026 15:22
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.

4 participants