feat: Add waza gate command for CI regression gates (#364)#377
Closed
spboyer wants to merge 1 commit into
Closed
Conversation
Adds a new `waza gate` subcommand that compares a baseline results.json
against the current run and returns stable exit codes so CI systems can
branch on the exact failure class:
0 pass
1 aggregate regression past --max-regression-pct, or task-set
policy fired with 'fail'
2 a task with 'golden: true' failed (dominates over regression)
3 configuration error (bad flags, missing/unreadable files)
Flags:
--baseline, --current result files to compare
--max-regression-pct N pp drop allowance on aggregate pass rate
--golden-must-pass hard-fail on golden task failure (default on)
--on-new-tasks p allow|warn|fail for new tasks (default allow)
--on-removed-tasks p allow|warn|fail for removed tasks (default warn)
--format f human|json|markdown|github-actions
--summary-file path markdown summary path (auto-set for github-actions)
The github-actions format writes ::error:: / ::warning:: workflow commands
to stderr and appends a markdown report to $GITHUB_STEP_SUMMARY.
Other changes:
- Add `Golden bool` field to TestCase (YAML `golden: true`) and propagate
it through TestOutcome so gate can read it from result files.
- Wire `*gateExitError` into main.go's error→exit handler.
- Docs: new 'waza gate' section in reference/cli.mdx, regression-gate
recipes for GitHub Actions / Azure DevOps / GitLab in guides/ci-cd.mdx,
document the `golden` task field in guides/eval-yaml.mdx, and add a
`waza gate` entry to README.md commands.
- Tests: 15 new tests in cmd_gate_test.go covering all 4 exit codes,
all 4 format renderers, golden-priority semantics, task-set policies,
and YAML round-trip for the new golden field.
Closes #364
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new waza gate subcommand to support CI regression gating by comparing a baseline results.json to a current run and returning stable, machine-branchable exit codes. It also introduces a golden: true task attribute that propagates into result JSON so golden failures can hard-fail the gate, and updates docs to describe the new command and YAML field.
Changes:
- Add
waza gatecommand with multiple output renderers and stable gate-specific exit codes. - Add
goldensupport to the eval task model (TestCase) and propagate it intoTestOutcomeresults. - Document
waza gateusage andgoldenin README and thesite/docs.
Show a summary per file
| File | Description |
|---|---|
| site/src/content/docs/reference/cli.mdx | Adds CLI reference docs for waza gate including flags and gate-specific exit codes. |
| site/src/content/docs/guides/eval-yaml.mdx | Documents the new golden task field and its effect on waza gate exit codes. |
| site/src/content/docs/guides/ci-cd.mdx | Adds CI examples (GitHub Actions/Azure DevOps/GitLab) showing how to run waza gate. |
| README.md | Adds a top-level README section describing waza gate, flags, exit codes, and YAML example. |
| internal/orchestration/runner.go | Propagates TestCase.Golden into TestOutcome creation paths. |
| internal/models/testcase.go | Adds Golden bool with YAML/JSON tags for task definitions. |
| internal/models/outcome.go | Adds Golden bool to TestOutcome JSON so results carry the golden marker. |
| cmd/waza/root.go | Registers the new gate command with the root CLI. |
| cmd/waza/main.go | Adds gate-specific exit code mapping via gateExitError. |
| cmd/waza/cmd_gate.go | Implements waza gate logic, report building, renderers, and exit code contract. |
| cmd/waza/cmd_gate_test.go | Adds tests covering gate exit codes, policies, formats, and YAML round-trip for golden. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 3
- Review effort level: Low
Comment on lines
+359
to
+363
| switch { | ||
| case row.Golden && c.Status != models.StatusPassed: | ||
| row.Classification = "golden-fail" | ||
| row.Note = "golden task did not pass" | ||
| case row.PassRateDelta < 0: |
Comment on lines
+264
to
+273
| func gateExitMessage(r *gateReport) string { | ||
| switch r.Outcome { | ||
| case "golden-fail": | ||
| return fmt.Sprintf("gate failed: %d golden task(s) failed: %s", len(r.GoldenFailures), strings.Join(r.GoldenFailures, ", ")) | ||
| case "regression": | ||
| return fmt.Sprintf("gate failed: pass-rate regression %.2fpp exceeds threshold %.2fpp", -r.PassRateDelta, r.MaxRegressionPct) | ||
| default: | ||
| return "gate failed" | ||
| } | ||
| } |
Comment on lines
+231
to
+243
| gate: | ||
| stage: test | ||
| script: | ||
| - waza gate | ||
| --baseline baseline/results.json | ||
| --current results.json | ||
| --max-regression-pct 2 | ||
| --golden-must-pass | ||
| --format json | ||
| > gate.json | ||
| artifacts: | ||
| when: always | ||
| paths: [gate.json] |
This was referenced Jun 27, 2026
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #364
Summary
Adds a new
waza gatesubcommand that compares a baselineresults.jsonagainst the current run and returns stable exit codes so CI systems can branch on the exact failure class.Exit code contract
01--max-regression-pct, or a task-set policy fired withfail2golden: truefailed (takes priority over1)3Flags
--baseline <path>--current <path>--max-regression-pct <N>0--golden-must-passtrue--on-new-tasks <p>allow/warn/failfor tasks in current but not baselineallow--on-removed-tasks <p>allow/warn/failfor tasks in baseline but not currentwarn--format <fmt>human/json/markdown/github-actionshuman--summary-file <path>$GITHUB_STEP_SUMMARYwithgithub-actions)Golden tasks
New
golden: truefield onTestCase, propagated throughTestOutcome. Skill authors mark tasks the build must never regress:GitHub Actions integration
The
github-actionsformat:::error::/::warning::workflow commands on stderr (so they still surface when stdout is captured),$GITHUB_STEP_SUMMARY,Files changed
cmd/waza/cmd_gate.go— command, four renderers, exit-code error typecmd/waza/cmd_gate_test.go— 15 tests covering all exit codes, all renderers, golden priority, task-set policies, YAML round-tripinternal/models/testcase.go,internal/models/outcome.go— addGolden boolfieldinternal/orchestration/runner.go— propagateGoldeninto threeTestOutcomeconstruction sitescmd/waza/main.go,cmd/waza/root.go— wiregateExitErrorand register the commandREADME.md,site/src/content/docs/reference/cli.mdx,site/src/content/docs/guides/ci-cd.mdx,site/src/content/docs/guides/eval-yaml.mdxVerification
go build ./...— ✅go test ./...— ✅ (all packages, 15 new gate tests pass)make lint— ✅ (no new issues; the 6 remainingSA5011warnings ininternal/mcp/coverage_test.goare pre-existing onmainand unrelated to this PR)go run ./cmd/waza gate --help— ✅ renders correctly