Context
From discussion #26431 (Repository Quality Improvement Report — Validator Complexity Compliance).
pkg/workflow/template_injection_validation.go is 384 lines (28% over the 300-line hard limit in AGENTS.md). It contains 8 functions with 3 distinct responsibilities: detection, extraction utilities, and error formatting.
Objective
Extract utility and formatting helpers into a separate file, keeping core validation logic in the original file.
Steps
- Create
pkg/workflow/template_injection_utils.go (same workflow package) with these utility/helper functions:
extractRunBlocks
removeHeredocContent
extractRunSnippet
detectExpressionContext
formatTemplateInjectionError
- Keep core validation entry points in
template_injection_validation.go:
hasUnsafeExpressionInRunContent
validateNoTemplateInjection
validateNoTemplateInjectionFromParsed
- Verify
template_injection_validation.go is under 250 lines
- Run
make fmt && make lint && go test -run ".*TemplateInjection.*|.*templateInjection.*" ./pkg/workflow/
Acceptance Criteria
Generated by Plan Command for issue #discussion #26431 · ● 150.7K · ◷
Context
From discussion #26431 (Repository Quality Improvement Report — Validator Complexity Compliance).
pkg/workflow/template_injection_validation.gois 384 lines (28% over the 300-line hard limit in AGENTS.md). It contains 8 functions with 3 distinct responsibilities: detection, extraction utilities, and error formatting.Objective
Extract utility and formatting helpers into a separate file, keeping core validation logic in the original file.
Steps
pkg/workflow/template_injection_utils.go(sameworkflowpackage) with these utility/helper functions:extractRunBlocksremoveHeredocContentextractRunSnippetdetectExpressionContextformatTemplateInjectionErrortemplate_injection_validation.go:hasUnsafeExpressionInRunContentvalidateNoTemplateInjectionvalidateNoTemplateInjectionFromParsedtemplate_injection_validation.gois under 250 linesmake fmt && make lint && go test -run ".*TemplateInjection.*|.*templateInjection.*" ./pkg/workflow/Acceptance Criteria
pkg/workflow/template_injection_validation.goretains the 3 core validation functions, under 250 linespkg/workflow/template_injection_utils.gocreated with the 5 utility functions listed aboveworkflowpackagemake fmtandmake lintpassmake test-unit)