Skip to content

[Code Quality] Add missing unit test file for compiler_yaml_prompt.go prompt-chunking logic #49927

Description

@github-actions

Description

The Daily Compiler Code Quality Check (2026-08-03) flagged pkg/workflow/compiler_yaml_prompt.go (336 lines, 11 functions) as having no dedicated test file — the most significant maintainability gap identified in that run. The file handles non-trivial prompt-chunking and import-interleaving logic (compile-time inlining vs. runtime-import fallback, expression mapping merges) that currently relies entirely on indirect/integration coverage elsewhere.

Suggested Changes

  • Create pkg/workflow/compiler_yaml_prompt_test.go
  • Add focused unit tests for:
    • splitContentIntoChunks
    • processOrderedPromptImports
    • processLegacyPromptImports
    • enrichExpressionMappings
    • buildMainWorkflowPromptChunks
  • Cover edge cases: empty prompt, single chunk, mixed ordered/legacy imports, expression-mapping merge conflicts

Files Affected

  • pkg/workflow/compiler_yaml_prompt.go (source, no changes expected)
  • pkg/workflow/compiler_yaml_prompt_test.go (new)

Success Criteria

  • New test file exists with coverage for the functions listed above
  • go test ./pkg/workflow/... -run TestCompilerYamlPrompt (or similar) passes
  • No regressions in existing compiler tests

Source

Extracted from Daily Compiler Code Quality Report - 2026-08-03

Priority

Medium - improves test coverage for non-trivial logic but not blocking.

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · auto · 47.3 AIC · ⌖ 4.61 AIC · ⊞ 10.3K ·

  • expires on Aug 4, 2026, 12:04 AM UTC-08:00

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions