Skip to content

Commit f50b735

Browse files
committed
PR feedback
1 parent 7d8bd0d commit f50b735

File tree

11 files changed

+10
-20
lines changed

11 files changed

+10
-20
lines changed

pkg/workflows/internal/v2/sdkimpl/runtime_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ func TestRuntime_CallCapability(t *testing.T) {
6767
})
6868

6969
t.Run("call capability errors", func(t *testing.T) {
70+
// The capability is not registered, so the call will fail.
7071
test := func(rt sdk.DonRuntime, _ *basictrigger.Outputs) (string, error) {
7172
workflowAction1 := &basicaction.BasicAction{}
7273
call := workflowAction1.PerformAction(rt, &basicaction.Inputs{InputThing: true})
@@ -77,7 +78,7 @@ func TestRuntime_CallCapability(t *testing.T) {
7778
assert.Error(t, err)
7879
})
7980

80-
t.Run("capability errors", func(t *testing.T) {
81+
t.Run("capability errors are returned to the caller", func(t *testing.T) {
8182
action, err := basicactionmock.NewBasicActionCapability(t)
8283
require.NoError(t, err)
8384

pkg/workflows/sdk/v2/const.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ package sdk
33
const (
44
IdLen = 36 // IdLen is 36 bytes to match a UUID's string length
55
DefaultMaxResponseSizeBytes = 5 * 1024 * 1024 // 5 MB
6-
ResponseBufferToSmall = "response buffer too small"
6+
ResponseBufferTooSmall = "response buffer too small"
77
)

pkg/workflows/sdk/v2/testutils/runtime.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func createAwaitCapabilities(tb testing.TB) sdkimpl.AwaitCapabilitiesFn {
8383

8484
bytes, _ := proto.Marshal(response)
8585
if len(bytes) > int(maxResponseSize) {
86-
return nil, errors.New(sdk.ResponseBufferToSmall)
86+
return nil, errors.New(sdk.ResponseBufferTooSmall)
8787
}
8888

8989
return response, errors.Join(errs...)

pkg/workflows/sdk/v2/testutils/runtime_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestRuntime_CallCapability(t *testing.T) {
5252

5353
_, _, err = runner.Result()
5454
require.Error(t, err)
55-
assert.True(t, strings.Contains(err.Error(), sdk.ResponseBufferToSmall))
55+
assert.True(t, strings.Contains(err.Error(), sdk.ResponseBufferTooSmall))
5656
})
5757
}
5858

pkg/workflows/wasm/host/module.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ func createAwaitCapsFn(
11101110

11111111
size := wasmWrite(caller, respBytes, responseBuffer, maxResponseLen)
11121112
if size == -1 {
1113-
errStr := sdk.ResponseBufferToSmall
1113+
errStr := sdk.ResponseBufferTooSmall
11141114
logger.Error(errStr)
11151115
return truncateWasmWrite(caller, []byte(errStr), responseBuffer, maxResponseLen)
11161116
}

pkg/workflows/wasm/host/wasip1.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ func newWasiLinker(modCfg *ModuleConfig, engine *wasmtime.Engine) (*wasmtime.Lin
2222
linker.AllowShadowing(true)
2323

2424
err := linker.DefineWasi()
25-
2625
if err != nil {
2726
return nil, err
2827
}

pkg/workflows/wasm/host/wasm_nodag_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func Test_NoDag_Run(t *testing.T) {
4949
require.NoError(t, err)
5050
m.Start()
5151

52-
// When a TriggerEvent occurs, Engine calls Run() with that Event.
52+
// When a TriggerEvent occurs, Engine calls Execute with that Event.
5353
trigger := &basictrigger.Outputs{CoolOutput: "Hi"}
5454
wrapped, err := anypb.New(trigger)
5555
require.NoError(t, err)

pkg/workflows/wasm/pb/wasm.pb.go

Lines changed: 2 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/workflows/wasm/pb/wasm.proto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ message Request {
2424
ComputeRequest computeRequest = 3;
2525
google.protobuf.Empty specRequest = 4;
2626
}
27-
string triggerId = 5;
2827
}
2928

3029
message ComputeResponse { capabilities.CapabilityResponse response = 1; }

pkg/workflows/wasm/v2/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (d *runner[T]) Run(args *sdk.WorkflowArgs[T]) {
5252
versionV2()
5353
for _, handler := range args.Handlers {
5454
// TODO: https://smartcontract-it.atlassian.net/browse/CAPPL-809 multiple of the same trigger registered
55-
// The ID field could be changed to tirger-# and we can use the index or similar.
55+
// The ID field could be changed to trigger-# and we can use the index or similar.
5656
if handler.Id() == d.trigger.Id {
5757
response, err := handler.Callback()(d.runtime, d.trigger.Payload)
5858
execResponse := &pb.ExecutionResult{Id: d.id}

0 commit comments

Comments
 (0)