feat: Enhance suggest case generation#379
Closed
spboyer wants to merge 1 commit into
Closed
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6 tasks
Contributor
There was a problem hiding this comment.
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-taskconfidenceandrationale. - Validates generated eval/task YAML against built-in schemas and makes
--applymerge-safe by preserving existingeval.yamltask 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) |
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). |
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 #357
Summary
waza suggest --count,--focus, and--forcewhile preserving existing--dry-run/--applybehavior.confidenceandrationale, and validates generated eval/task YAML with built-in schemas before writing.eval.yamltask references, rejecting unsafe paths/symlinks, and preventing task file or task ID overwrites unless--forceis used.Validation
go test ./...cd site && npm run build -- --silent