Skip to content

refactor: replace raw engine strings with typed constants.*Engine#35559

Merged
pelikhan merged 4 commits into
mainfrom
copilot/deep-report-quick-win-replace-engine-strings
May 28, 2026
Merged

refactor: replace raw engine strings with typed constants.*Engine#35559
pelikhan merged 4 commits into
mainfrom
copilot/deep-report-quick-win-replace-engine-strings

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

Switch statements and inline comparisons over engineID in compiler_yaml_lookups.go, firewall.go, and strict_mode_permissions_validation.go used raw string literals ("copilot", "claude", "codex", etc.) despite typed constants already existing in pkg/constants. Typos silently misroute behavior with no compiler or IDE feedback.

Changes

  • compiler_yaml_lookups.go — Replace raw string cases in all 4 switches (getVersionForSetup, getInstallationVersion, getDefaultAgentModel, getDefaultModelOverrideVar)
  • firewall.go — Replace raw string comparisons in enableFirewallByDefaultForCopilot and enableFirewallByDefaultForClaude
  • strict_mode_permissions_validation.go — Replace raw string comparison in validateStrictFirewall; add constants import
// Before
switch engineID {
case "copilot":
    return string(constants.DefaultCopilotVersion)
case "claude":
    return string(constants.DefaultClaudeCodeVersion)
}

if engineID != "copilot" && engineID != "codex" { ... }

// After
switch engineID {
case string(constants.CopilotEngine):
    return string(constants.DefaultCopilotVersion)
case string(constants.ClaudeEngine):
    return string(constants.DefaultClaudeCodeVersion)
}

if engineID != string(constants.CopilotEngine) && engineID != string(constants.CodexEngine) { ... }

engineID remains string throughout — no signature changes. The string(constants.*Engine) cast is the lowest-risk approach and requires no refactoring outside these three files.

Copilot AI and others added 2 commits May 28, 2026 19:36
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Replace raw engine string literals ("copilot", "claude", "codex", etc.)
with typed constant expressions (string(constants.CopilotEngine), etc.)
in three files:

- compiler_yaml_lookups.go: 4 switch statements
- firewall.go: 2 inline comparisons
- strict_mode_permissions_validation.go: 1 inline comparison + add constants import

No signature changes; engineID remains string throughout.

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace raw engine strings in compiler_yaml_lookups.go with typed constants refactor: replace raw engine strings with typed constants.*Engine May 28, 2026
Copilot AI requested a review from gh-aw-bot May 28, 2026 19:42
@pelikhan pelikhan marked this pull request as ready for review May 28, 2026 20:21
Copilot AI review requested due to automatic review settings May 28, 2026 20:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces raw engine string literals ("copilot", "claude", "codex", "opencode", "crush", "pi", "gemini") with the typed constants.*Engine values (cast to string) in three workflow files, eliminating typo risk and aligning with constants already defined in pkg/constants/engine_constants.go.

Changes:

  • Switch cases in compiler_yaml_lookups.go (4 functions) updated to use string(constants.*Engine).
  • Engine comparisons in firewall.go (enableFirewallByDefaultForCopilot, enableFirewallByDefaultForClaude) updated similarly.
  • strict_mode_permissions_validation.go updated, adding the constants import.
Show a summary per file
File Description
pkg/workflow/compiler_yaml_lookups.go Replaces raw strings with typed engine constants in version/model lookup switches.
pkg/workflow/firewall.go Uses typed constants for engine comparisons in default-firewall helpers.
pkg/workflow/strict_mode_permissions_validation.go Uses typed constants for engine check; adds constants import.
.github/workflows/outcome-collector.lock.yml Regenerated lock file with version/image bumps; unrelated to refactor purpose.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 4/4 changed files
  • Comments generated: 0

@pelikhan pelikhan merged commit 02d6706 into main May 28, 2026
26 checks passed
@pelikhan pelikhan deleted the copilot/deep-report-quick-win-replace-engine-strings branch May 28, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[deep-report] [quick-win] Replace raw engine strings in compiler_yaml_lookups.go with typed constants.*Engine

4 participants