Objective
Rename conflicting ValidatePermissions functions to clarify their distinct purposes and prevent confusion.
Context
Two different ValidatePermissions functions exist with different signatures:
pkg/workflow/imports.go:347 - Part of Compiler, validates permissions from included files
pkg/workflow/permissions_validator.go:92 - Standalone function using PermissionsValidator
This creates confusion when calling validation functions and makes the codebase harder to navigate.
Part of issue #3435.
Approach
1. Analyze function purposes
Review both functions to understand their specific responsibilities:
imports.go version: Validates permissions when merging included files
permissions_validator.go version: General permission validation
2. Rename for clarity
Rename the imports.go function to ValidateIncludedPermissions to reflect its specific purpose of validating permissions from included files.
Keep the permissions_validator.go function as ValidatePermissions since it's the general-purpose validator.
3. Update all callers
- Find all references to the renamed function
- Update function calls to use the new name
- Update any related documentation or comments
4. Add documentation
Add clear comments explaining:
- When to use
ValidatePermissions (general validation)
- When to use
ValidateIncludedPermissions (when merging includes)
Files to Modify
pkg/workflow/imports.go - Rename function from ValidatePermissions to ValidateIncludedPermissions
- All files that call
imports.go's ValidatePermissions function
- Add documentation comments to both functions
Acceptance Criteria
AI generated by Plan Command for #3435
Objective
Rename conflicting
ValidatePermissionsfunctions to clarify their distinct purposes and prevent confusion.Context
Two different
ValidatePermissionsfunctions exist with different signatures:pkg/workflow/imports.go:347- Part of Compiler, validates permissions from included filespkg/workflow/permissions_validator.go:92- Standalone function using PermissionsValidatorThis creates confusion when calling validation functions and makes the codebase harder to navigate.
Part of issue #3435.
Approach
1. Analyze function purposes
Review both functions to understand their specific responsibilities:
imports.goversion: Validates permissions when merging included filespermissions_validator.goversion: General permission validation2. Rename for clarity
Rename the
imports.gofunction toValidateIncludedPermissionsto reflect its specific purpose of validating permissions from included files.Keep the
permissions_validator.gofunction asValidatePermissionssince it's the general-purpose validator.3. Update all callers
4. Add documentation
Add clear comments explaining:
ValidatePermissions(general validation)ValidateIncludedPermissions(when merging includes)Files to Modify
pkg/workflow/imports.go- Rename function fromValidatePermissionstoValidateIncludedPermissionsimports.go's ValidatePermissions functionAcceptance Criteria
imports.gorenamed toValidateIncludedPermissionsmake test-unit)Related to [refactor] 🔧 Semantic Function Clustering Analysis - Code Organization Opportunities #3435