Skip to content

[plan] Split expression_validation.go into three focused files #21479

@github-actions

Description

@github-actions

Objective

Split pkg/workflow/expression_validation.go (715 lines — 2.4× the 300-line hard limit) into three focused files with clear responsibilities.

Context

From discussion #21398 (Repository Quality Improvement Report - Validator File Size Compliance). This file mixes expression safety orchestration, dangerous-property detection, runtime import path handling, and expression syntax/quote/brace validation.

Approach

Step 1: Create pkg/workflow/expression_syntax_validation.go containing only the syntax-level helper functions:

  • validateBalancedBraces
  • validateExpressionSyntax
  • validateExpressionContent
  • validateBalancedQuotes

Step 2: Create pkg/workflow/runtime_import_validation.go containing:

  • extractRuntimeImportPaths
  • validateRuntimeImportFiles

Step 3: Rename/reduce expression_validation.go to expression_safety_validation.go (or keep the name) and remove functions moved to new files. Rename the remaining file to contain:

  • validateExpressionSafety
  • validateExpressionForDangerousProps
  • validateSingleExpression
  • containsExpression
  • containsLogicalOperators

Step 4: Fix all imports in each new file (add/remove as needed).

Step 5: Run make fmt && make lint && make test-unit — all must pass.

⚠️ Do NOT change any function logic. This is a pure code reorganization refactor.

Files to Modify

  • Split: pkg/workflow/expression_validation.go
  • Create: pkg/workflow/expression_syntax_validation.go
  • Create: pkg/workflow/runtime_import_validation.go
  • Rename/update: pkg/workflow/expression_safety_validation.go (or keep original name reduced)

Acceptance Criteria

  • expression_safety_validation.go contains orchestration and allowlist safety checks
  • expression_syntax_validation.go contains syntax-level helpers
  • runtime_import_validation.go contains import path logic
  • All three files are under 300 lines
  • make test-unit passes after the split
  • make fmt && make lint pass

Generated by Plan Command for issue #discussion #21398 ·

  • expires on Mar 19, 2026, 11:46 PM UTC

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions