From 53657d74317f83b8fbc2340c7716762cb72c6d60 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 16:18:14 +0000 Subject: [PATCH 1/4] Initial plan From 3fce86ffa6a15907e469dd7e430882e835f9c8d4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 16:26:23 +0000 Subject: [PATCH 2/4] wftest: add PUT, PATCH, DELETE, HEAD HTTP trigger types to YAML runner Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/2ff5f0e6-134e-4abf-aedc-d28b626fb97a --- wftest/yaml_runner.go | 38 +++++++++ wftest/yaml_runner_test.go | 164 +++++++++++++++++++++++++++++++++++++ 2 files changed, 202 insertions(+) diff --git a/wftest/yaml_runner.go b/wftest/yaml_runner.go index 216abaee..ff12d0ca 100644 --- a/wftest/yaml_runner.go +++ b/wftest/yaml_runner.go @@ -199,6 +199,44 @@ func fireTrigger(t *testing.T, h *Harness, tc *TestCase) *Result { } return h.POST(tc.Trigger.Path, body, reqOpts...) + case "http.put", "put": + body := "" + if tc.Trigger.Data != nil { + b, _ := json.Marshal(tc.Trigger.Data) + body = string(b) + } + var reqOpts []RequestOption + for k, v := range tc.Trigger.Headers { + reqOpts = append(reqOpts, Header(k, v)) + } + return h.PUT(tc.Trigger.Path, body, reqOpts...) + + case "http.patch", "patch": + body := "" + if tc.Trigger.Data != nil { + b, _ := json.Marshal(tc.Trigger.Data) + body = string(b) + } + var reqOpts []RequestOption + for k, v := range tc.Trigger.Headers { + reqOpts = append(reqOpts, Header(k, v)) + } + return h.PATCH(tc.Trigger.Path, body, reqOpts...) + + case "http.delete", "delete": + var reqOpts []RequestOption + for k, v := range tc.Trigger.Headers { + reqOpts = append(reqOpts, Header(k, v)) + } + return h.DELETE(tc.Trigger.Path, reqOpts...) + + case "http.head", "head": + var reqOpts []RequestOption + for k, v := range tc.Trigger.Headers { + reqOpts = append(reqOpts, Header(k, v)) + } + return h.HEAD(tc.Trigger.Path, reqOpts...) + default: t.Fatalf("RunYAMLTests: unsupported trigger type %q", tc.Trigger.Type) return nil diff --git a/wftest/yaml_runner_test.go b/wftest/yaml_runner_test.go index 408214ea..a7eaf654 100644 --- a/wftest/yaml_runner_test.go +++ b/wftest/yaml_runner_test.go @@ -221,6 +221,170 @@ func TestYAMLRunner_StatefulTestData(t *testing.T) { wftest.RunYAMLTests(t, "testdata/stateful_test.yaml") } +func TestYAMLRunner_HTTPPutTrigger(t *testing.T) { + tmpDir := t.TempDir() + writeFile(t, tmpDir+"/put_test.yaml", ` +yaml: | + modules: + - name: router + type: http.router + pipelines: + update-resource: + trigger: + type: http + config: + path: /v1/resource/{id} + method: PUT + steps: + - name: respond + type: step.json_response + config: + status: 200 + body: + updated: true +tests: + update-resource: + trigger: + type: http.put + path: /v1/resource/123 + data: + name: updated + assertions: + - response: + status: 200 + body: '"updated":true' + update-resource-short: + trigger: + type: put + path: /v1/resource/123 + assertions: + - response: + status: 200 +`) + wftest.RunYAMLTests(t, tmpDir+"/put_test.yaml") +} + +func TestYAMLRunner_HTTPPatchTrigger(t *testing.T) { + tmpDir := t.TempDir() + writeFile(t, tmpDir+"/patch_test.yaml", ` +yaml: | + modules: + - name: router + type: http.router + pipelines: + patch-resource: + trigger: + type: http + config: + path: /v1/resource/{id} + method: PATCH + steps: + - name: respond + type: step.json_response + config: + status: 200 + body: + patched: true +tests: + patch-resource: + trigger: + type: http.patch + path: /v1/resource/123 + data: + field: value + assertions: + - response: + status: 200 + body: '"patched":true' + patch-resource-short: + trigger: + type: patch + path: /v1/resource/123 + assertions: + - response: + status: 200 +`) + wftest.RunYAMLTests(t, tmpDir+"/patch_test.yaml") +} + +func TestYAMLRunner_HTTPDeleteTrigger(t *testing.T) { + tmpDir := t.TempDir() + writeFile(t, tmpDir+"/delete_test.yaml", ` +yaml: | + modules: + - name: router + type: http.router + pipelines: + delete-resource: + trigger: + type: http + config: + path: /v1/resource/{id} + method: DELETE + steps: + - name: respond + type: step.json_response + config: + status: 204 +tests: + delete-resource: + trigger: + type: http.delete + path: /v1/resource/123 + assertions: + - response: + status: 204 + delete-resource-short: + trigger: + type: delete + path: /v1/resource/123 + assertions: + - response: + status: 204 +`) + wftest.RunYAMLTests(t, tmpDir+"/delete_test.yaml") +} + +func TestYAMLRunner_HTTPHeadTrigger(t *testing.T) { + tmpDir := t.TempDir() + writeFile(t, tmpDir+"/head_test.yaml", ` +yaml: | + modules: + - name: router + type: http.router + pipelines: + head-resource: + trigger: + type: http + config: + path: /v1/resource/{id} + method: HEAD + steps: + - name: respond + type: step.json_response + config: + status: 200 + body: + exists: true +tests: + head-resource: + trigger: + type: http.head + path: /v1/resource/123 + assertions: + - response: + status: 200 + head-resource-short: + trigger: + type: head + path: /v1/resource/123 + assertions: + - response: + status: 200 +`) + wftest.RunYAMLTests(t, tmpDir+"/head_test.yaml") +} + func writeFile(t *testing.T, path, content string) { t.Helper() if err := os.WriteFile(path, []byte(content), 0o644); err != nil { From 86a50224d555ae166a9719a508a2d4428edc0120 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:46:21 +0000 Subject: [PATCH 3/4] wftest: add path validation and marshal error handling for POST/PUT/PATCH/DELETE/HEAD triggers Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/00318fe7-5a64-450d-9dff-ee0a9dde72b6 --- wftest/yaml_runner.go | 45 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/wftest/yaml_runner.go b/wftest/yaml_runner.go index 4e82f7ee..cf6d10f9 100644 --- a/wftest/yaml_runner.go +++ b/wftest/yaml_runner.go @@ -189,54 +189,83 @@ func fireTrigger(t *testing.T, h *Harness, tc *TestCase) *Result { return h.GET(path, reqOpts...) case "http.post", "post": + path := tc.Trigger.Path + if path == "" { + t.Fatal("RunYAMLTests: trigger.path is required for http triggers") + } body := "" if tc.Trigger.Data != nil { - b, _ := json.Marshal(tc.Trigger.Data) + b, err := json.Marshal(tc.Trigger.Data) + if err != nil { + t.Fatalf("RunYAMLTests: failed to marshal trigger.data: %v", err) + } body = string(b) } var reqOpts []RequestOption for k, v := range tc.Trigger.Headers { reqOpts = append(reqOpts, Header(k, v)) } - return h.POST(tc.Trigger.Path, body, reqOpts...) + return h.POST(path, body, reqOpts...) case "http.put", "put": + path := tc.Trigger.Path + if path == "" { + t.Fatal("RunYAMLTests: trigger.path is required for http triggers") + } body := "" if tc.Trigger.Data != nil { - b, _ := json.Marshal(tc.Trigger.Data) + b, err := json.Marshal(tc.Trigger.Data) + if err != nil { + t.Fatalf("RunYAMLTests: failed to marshal trigger.data: %v", err) + } body = string(b) } var reqOpts []RequestOption for k, v := range tc.Trigger.Headers { reqOpts = append(reqOpts, Header(k, v)) } - return h.PUT(tc.Trigger.Path, body, reqOpts...) + return h.PUT(path, body, reqOpts...) case "http.patch", "patch": + path := tc.Trigger.Path + if path == "" { + t.Fatal("RunYAMLTests: trigger.path is required for http triggers") + } body := "" if tc.Trigger.Data != nil { - b, _ := json.Marshal(tc.Trigger.Data) + b, err := json.Marshal(tc.Trigger.Data) + if err != nil { + t.Fatalf("RunYAMLTests: failed to marshal trigger.data: %v", err) + } body = string(b) } var reqOpts []RequestOption for k, v := range tc.Trigger.Headers { reqOpts = append(reqOpts, Header(k, v)) } - return h.PATCH(tc.Trigger.Path, body, reqOpts...) + return h.PATCH(path, body, reqOpts...) case "http.delete", "delete": + path := tc.Trigger.Path + if path == "" { + t.Fatal("RunYAMLTests: trigger.path is required for http triggers") + } var reqOpts []RequestOption for k, v := range tc.Trigger.Headers { reqOpts = append(reqOpts, Header(k, v)) } - return h.DELETE(tc.Trigger.Path, reqOpts...) + return h.DELETE(path, reqOpts...) case "http.head", "head": + path := tc.Trigger.Path + if path == "" { + t.Fatal("RunYAMLTests: trigger.path is required for http triggers") + } var reqOpts []RequestOption for k, v := range tc.Trigger.Headers { reqOpts = append(reqOpts, Header(k, v)) } - return h.HEAD(tc.Trigger.Path, reqOpts...) + return h.HEAD(path, reqOpts...) default: t.Fatalf("RunYAMLTests: unsupported trigger type %q", tc.Trigger.Type) From 9e5a229e25fc8c54240b47b9cf108a5d3d9800a3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 21:39:28 +0000 Subject: [PATCH 4/4] wftest: fix malformed YAML in TestYAMLRunner_HTTPPutTrigger test Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/22b0d028-ed30-4d60-9b90-6ce6f8ed9fe9 --- wftest/yaml_runner_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wftest/yaml_runner_test.go b/wftest/yaml_runner_test.go index 11bd0912..363bd361 100644 --- a/wftest/yaml_runner_test.go +++ b/wftest/yaml_runner_test.go @@ -224,12 +224,23 @@ func TestYAMLRunner_StatefulTestData(t *testing.T) { func TestYAMLRunner_HTTPPutTrigger(t *testing.T) { tmpDir := t.TempDir() writeFile(t, tmpDir+"/put_test.yaml", ` +yaml: | + modules: + - name: router + type: http.router + pipelines: update-resource: trigger: type: http config: path: /v1/resource/{id} method: PUT + steps: + - name: respond + type: step.json_response + config: + status: 200 + body: updated: true tests: update-resource: