Conversation
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…r helper - Modified generateSafeOutputsConfig() to always include default max values in config.json - Added default max values for all safe output types based on parseBaseSafeOutputConfig calls - Created new safe_output_validator.cjs helper with validation functions for: - Title and body validation - Label validation with sanitization - Max count validation with config fallback - Config loading from config.json - Added comprehensive tests for validation helper functions - Registered safe_output_validator.cjs in Go embedded JavaScript sources Default max values set: - create_issue, add_comment, create_discussion, close_discussion, close_issue: 1 - create_agent_task, update_issue, assign_milestone, update_release, noop: 1 - add_labels: 3 - create_pr_review_comment, update_project: 10 - create_code_scanning_alert, missing_tool, upload_asset, push_to_pull_request_branch: 0 (unlimited) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Removed ~25 lines of duplicated label validation logic - Now uses validateLabels() for sanitization and validation - Uses validateMaxCount() to get max from env, config.json, or default - Uses getSafeOutputConfig() to read config.json values - Updated test to expect new log message format - All tests passing (Go unit tests + JavaScript tests) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
✅ Agentic Changeset Generator completed successfully. |
- Added AddReviewer config generation to safe_outputs.go with default max of 3 - Updated validateMaxCount to make hardcoded default optional (for backward compatibility) - Removed hardcoded default parameter from add_labels.cjs validateMaxCount call - Refactored add_reviewer.cjs to use new validation pattern (getSafeOutputConfig + validateMaxCount) - Updated all tests to reflect new validation behavior - All hardcoded defaults now come from config.json in production - Fallback default (3) only used when config unavailable (testing scenarios) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit fe09312. Changes:
The fallback default (3) in the function signature is only used when config.json is unavailable (like in test environments). In production workflows, defaults always come from config.json. |
|
@copilot fallback default should be 1 |
- Updated validateMaxCount fallback default parameter from 3 to 1 - Updated safe_output_validator.test.cjs to expect 1 as fallback default - Updated add_labels.test.cjs tests to set explicit max count of 10 where needed - One test specifically validates the new default of 1 - Updated add_reviewer.test.cjs to set explicit max count where needed - All tests passing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in commit 0263600. Changed the fallback default from 3 to 1 in |
Plan: Refactor Safe Output MCP Server Validation Code
This refactoring reduces duplication in the safe output MCP server JavaScript code by:
1. Add default max values to config.json
generateSafeOutputsConfig()inpkg/workflow/safe_outputs.goGH_AW_LABELS_MAX_COUNT)add_labels.go,update_issue.go)generateSafeOutputsConfig()to include default max for each output type2. Create message validation helper function
safe_output_validator.cjswith comprehensive validation functionsadd_labels.cjsto use the new validation helperadd_reviewer.cjsto use the new validation helper3. Remove hardcoded defaults
4. Testing
make test-jsSummary of Changes
Go Changes:
pkg/workflow/safe_outputs.goto always include default max values in config.jsonJavaScript Changes:
pkg/workflow/js/safe_output_validator.cjs:pkg/workflow/js/add_labels.cjs:pkg/workflow/js/add_reviewer.cjs:Benefits:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.