-
Notifications
You must be signed in to change notification settings - Fork 46
Closed
Labels
Description
Objective
Consolidate scattered generic validation functions from multiple files into the central pkg/workflow/validation.go file, while keeping domain-specific validation in their respective files.
Context
Part of issue #2273. Validation logic is scattered across 12 files with 35+ validation functions. Generic validation functions should be centralized in validation.go, while domain-specific validation (e.g., Docker, npm, pip, expression safety) should remain in domain files.
Functions to Move to validation.go
From compiler.go (4 validation functions):
- Move generic validation functions (identify during implementation)
From cache.go:
validateNoDuplicateCacheIDs
From redact_secrets.go:
validateSecretReferences
Functions to KEEP in Domain Files
These should NOT be moved (domain-specific validation):
expression_safety.go:validateExpressionSafety,validateSingleExpressiondocker.go:validateDockerImagenpm.go:validateNpxPackagespip.go:validatePipPackages,validateUvPackages, etc.strict_mode.go:validateStrictMode,validateStrictPermissions
Approach
- Review all validation functions in
compiler.goto identify generic ones - Move generic validation functions to
validation.go - Move
validateNoDuplicateCacheIDsfromcache.go - Move
validateSecretReferencesfromredact_secrets.go - Keep domain-specific validation in their respective files
- Update imports and references
Files to Modify
- Update:
pkg/workflow/validation.go(add moved functions) - Update:
pkg/workflow/compiler.go(remove generic validation) - Update:
pkg/workflow/cache.go(removevalidateNoDuplicateCacheIDs) - Update:
pkg/workflow/redact_secrets.go(removevalidateSecretReferences)
Acceptance Criteria
- Generic validation functions moved to
validation.go - Domain-specific validation remains in domain files
- All tests pass:
make test-unit - Code compiles successfully:
make build - Clear separation between generic and domain-specific validation
- No import errors or broken references
Related to [refactor] 🔧 Semantic Function Clustering Analysis - Refactoring Opportunities #2273
AI generated by Plan Command for #2273