Skip to content

feat: Enhance suggest case generation#379

Closed
spboyer wants to merge 1 commit into
mainfrom
spboyer-issue-357-synthetic-test-generation
Closed

feat: Enhance suggest case generation#379
spboyer wants to merge 1 commit into
mainfrom
spboyer-issue-357-synthetic-test-generation

Conversation

@spboyer

@spboyer spboyer commented Jun 27, 2026

Copy link
Copy Markdown
Member

Closes #357

Summary

  • Adds waza suggest --count, --focus, and --force while preserving existing --dry-run/--apply behavior.
  • Requires generated task cases to include confidence and rationale, and validates generated eval/task YAML with built-in schemas before writing.
  • Makes apply merge-safe by preserving existing eval.yaml task references, rejecting unsafe paths/symlinks, and preventing task file or task ID overwrites unless --force is used.
  • Updates README and site CLI docs with focused-generation examples.

⚠️ This task was flagged as "needs review" — please have a squad member review before merging.

Validation

  • go test ./...
  • cd site && npm run build -- --silent

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 27, 2026 13:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the waza suggest workflow to generate a variable number of targeted synthetic task cases, include per-case triage metadata, and apply suggestions more safely by validating schemas and avoiding unsafe overwrites.

Changes:

  • Adds waza suggest --count, --focus, and --force, and updates the suggest prompts/output to include per-task confidence and rationale.
  • Validates generated eval/task YAML against built-in schemas and makes --apply merge-safe by preserving existing eval.yaml task references and preventing overwrites unless --force.
  • Updates README and site CLI reference docs with focused-generation examples and apply/force behavior.
Show a summary per file
File Description
site/src/content/docs/reference/cli.mdx Documents new flags, focused examples, and confidence/rationale output.
README.md Updates waza suggest docs/examples for count/focus/force and apply behavior.
internal/suggest/suggest.go Implements count/focus parsing, schema validation, safe apply/merge, and overwrite safeguards.
internal/suggest/suggest_test.go Adds/updates unit tests for metadata requirements, merge behavior, overwrite safety, and schema validation.
internal/suggest/resolve_test.go Updates prompt-data tests for the new count/focus prompt inputs.
internal/suggest/prompt.go Extends prompt schema/instructions to request exactly N cases plus confidence/rationale and focus guidance.
internal/suggest/prompt_test.go Updates prompt assertions to match the new “exactly N cases” + metadata requirements.
cmd/waza/cmd_suggest.go Wires CLI flags (--count, --focus, --force) into suggest generation/apply.
cmd/waza/cmd_suggest_test.go Adds CLI tests asserting count/focus is reflected in the prompt and metadata is emitted.

Review details

  • Files reviewed: 9/9 changed files
  • Comments generated: 3
  • Review effort level: Low

Comment on lines +97 to +102
if opts.Count < 0 {
return nil, fmt.Errorf("count must be at least 1, got %d", opts.Count)
}
if opts.Count == 0 {
opts.Count = DefaultCaseCount
}
Comment on lines +166 to +168
if opts.Count > 0 && len(suggestion.Tasks) > opts.Count {
suggestion.Tasks = suggestion.Tasks[:opts.Count]
}
Comment on lines +946 to +956
func ensureSafeGeneratedTarget(outputDir, target string) error {
rel, err := filepath.Rel(outputDir, target)
if err != nil {
return fmt.Errorf("checking generated path %s: %w", target, err)
}
if rel == "." || strings.HasPrefix(rel, ".."+string(filepath.Separator)) || rel == ".." || filepath.IsAbs(rel) {
return fmt.Errorf("generated path escapes output directory: %s", target)
}

current := outputDir
dir := filepath.Dir(rel)
@spboyer

spboyer commented Jun 28, 2026

Copy link
Copy Markdown
Member Author

Superseded by #380, which lands a clean enhanced with focused generation and merge-safe --apply. Closing as duplicate (and CI is failing here).

@spboyer spboyer closed this Jun 28, 2026
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.

feat: Synthetic test case generation from skill spec

3 participants