Skip to content

[Code Quality] Add named enum types for SecretStrategy, ProviderEnvMode, MergeStrategy in engine_definition.go #51028

Description

@github-actions

Description

pkg/workflow/engine_definition.go declares SecretStrategy, ProviderEnvMode, and MergeStrategy as plain string fields (lines ~189, ~204, ~231). Using raw strings for these config knobs allows invalid/typo values to pass compile-time checks and only fail (or silently misbehave) at runtime.

Suggested Changes

  • Define named types (e.g. type SecretStrategy string, type ProviderEnvMode string, type MergeStrategy string) with exported constants for each valid value.
  • Update the struct fields in engine_definition.go to use the new named types instead of bare string.
  • Add validation (or a IsValid() method) for each enum type, used during frontmatter/schema validation.
  • Update call sites that compare these fields against string literals to use the new constants.

Files Affected

  • pkg/workflow/engine_definition.go (lines ~189, ~204, ~231)

Success Criteria

  • SecretStrategy, ProviderEnvMode, MergeStrategy are named types with defined constants
  • Invalid values are caught via validation with clear error messages
  • Existing tests pass; new tests cover invalid-value rejection

Source

Extracted from Typist - Go Type Consistency Analysis #50840

Priority

Low-Medium - small, low-risk typing improvement

🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · auto · 47.5 AIC · ⌖ 3.92 AIC · ⊞ 10.2K · ◷

  • expires on Aug 7, 2026, 11:12 PM UTC-08:00

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions