Files
archie/internal/domain/workflow/output_collision_test.go
T
sam e0eb1dfdb7
deploy / plan (push) Successful in 7s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / gate (push) Canceled after 1m25s
fix(workflow): refuse an output named result beside an agent.run result capture at save time (#1384)
2026-11-09 09:04:17 +11:00

65 lines
1.4 KiB
Go

package workflow
import "testing"
func TestParseDefinitionResultOutputCollision(t *testing.T) {
registry := StepRegistry{AgentRunStepName: newAgentRunStage}
tests := []struct {
name string
yaml string
wantErr bool
}{
{"top-level agent.run", `id: w
repository: none
outputs: {result: {type: string}}
steps:
- id: classify
type: agent.run
settings:
mission: m
result: {type: object, properties: {verdict: {type: string}}}
`, true},
{"switch case", `id: w
repository: none
inputs: {kind: {type: string}}
outputs: {result: {type: string}}
steps:
- switch:
on: inputs.kind
cases:
review:
- id: classify
type: agent.run
settings:
mission: m
result: {type: object, properties: {verdict: {type: string}}}
`, true},
{"no step result schema", `id: w
repository: none
outputs: {result: {type: string}}
steps:
- id: classify
type: agent.run
settings: {mission: m}
`, false},
{"output under another name", `id: w
repository: none
outputs: {verdict: {type: string}}
steps:
- id: classify
type: agent.run
settings:
mission: m
result: {type: object, properties: {verdict: {type: string}}}
`, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := ParseDefinition(tt.yaml, registry)
if (err != nil) != tt.wantErr {
t.Fatalf("ParseDefinition err = %v, wantErr %t", err, tt.wantErr)
}
})
}
}