refactor: replace raw engine strings with typed constants.*Engine#35559
Merged
pelikhan merged 4 commits intoMay 28, 2026
Conversation
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
Contributor
There was a problem hiding this comment.
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 usestring(constants.*Engine). - Engine comparisons in
firewall.go(enableFirewallByDefaultForCopilot,enableFirewallByDefaultForClaude) updated similarly. strict_mode_permissions_validation.goupdated, adding theconstantsimport.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Switch statements and inline comparisons over
engineIDincompiler_yaml_lookups.go,firewall.go, andstrict_mode_permissions_validation.goused raw string literals ("copilot","claude","codex", etc.) despite typed constants already existing inpkg/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 inenableFirewallByDefaultForCopilotandenableFirewallByDefaultForClaudestrict_mode_permissions_validation.go— Replace raw string comparison invalidateStrictFirewall; addconstantsimportengineIDremainsstringthroughout — no signature changes. Thestring(constants.*Engine)cast is the lowest-risk approach and requires no refactoring outside these three files.