Add validation helpers and refactor constraint validations#7567
Merged
Add validation helpers and refactor constraint validations#7567
Conversation
- Create pkg/workflow/validation_helpers.go with reusable validateIntRange function - Create comprehensive tests in validation_helpers_test.go (12 basic + 16 real-world test cases) - Refactor port validation in gateway.go to use helper - Refactor max-file-size validation in repo_memory.go to use helper (2 locations) - Refactor max-file-count validation in repo_memory.go to use helper (2 locations) - Refactor retention-days validation in cache.go to use helper (2 locations) - Update error messages in repo_memory_test.go to match new format - All refactored validations maintain same behavior with cleaner code Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Create validation helpers and boundary tests
Add validation helpers and refactor constraint validations
Dec 24, 2025
pelikhan
approved these changes
Dec 24, 2025
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.
Eliminates duplicated validation code across port, max-file-size, max-file-count, and retention-days constraints by introducing a reusable helper.
Changes
New validation helper (
pkg/workflow/validation_helpers.go)validateIntRange(value, min, max int, fieldName string) error- Single source of truth for range validationRefactored validations
Before:
After:
Test coverage
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.