Skip to content

chore: remove dead domain helper functions (batch 7)#18815

Merged
dsyme merged 5 commits intomainfrom
dead7
Feb 28, 2026
Merged

chore: remove dead domain helper functions (batch 7)#18815
dsyme merged 5 commits intomainfrom
dead7

Conversation

@dsyme
Copy link
Contributor

@dsyme dsyme commented Feb 28, 2026

Removes 10 dead functions from domains.go and updates callers in other test files.

Deleted functions (all were thin wrappers around the live GetAllowedDomainsForEngine):

  • mergeDomainsWithNetwork, mergeDomainsWithNetworkAndTools
  • GetCopilotAllowedDomains, GetCopilotAllowedDomainsWithSafeInputs, GetCopilotAllowedDomainsWithTools
  • GetCodexAllowedDomains, GetCodexAllowedDomainsWithTools
  • GetClaudeAllowedDomains, GetClaudeAllowedDomainsWithSafeInputs, GetClaudeAllowedDomainsWithTools

Test updates — references in other test files replaced with GetAllowedDomainsForEngine calls:

  • domains_protocol_test.go, domains_sort_test.go, http_mcp_domains_test.go, safe_inputs_firewall_test.go

Also removes 2 exclusive test functions from domains_test.go.

All kept tests pass. Part of the ongoing dead code removal series.

Copilot AI review requested due to automatic review settings February 28, 2026 11:12
Copy link
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

Removes unused domain helper wrappers and updates tests to use the shared GetAllowedDomainsForEngine API, while also deleting additional unused workflow helper functions.

Changes:

  • Deleted engine-specific allowed-domain wrapper functions in domains.go and updated test callers to use GetAllowedDomainsForEngine.
  • Removed several unused validation/map/engine helper functions and their associated tests.
  • Updated tests to import/use pkg/constants engine identifiers where needed.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/workflow/domains.go Removes dead domain wrapper helpers; keeps engine-based API as the primary entry point.
pkg/workflow/domains_protocol_test.go Updates protocol-domain tests to call GetAllowedDomainsForEngine and adds constants import.
pkg/workflow/domains_sort_test.go Updates sorting tests to call GetAllowedDomainsForEngine and adds constants import.
pkg/workflow/domains_test.go Removes tests that targeted deleted wrapper functions.
pkg/workflow/http_mcp_domains_test.go Updates HTTP MCP domain tests to use GetAllowedDomainsForEngine.
pkg/workflow/safe_inputs_firewall_test.go Updates tests to use GetAllowedDomainsForEngine and imports constants.
pkg/workflow/validation_helpers.go Removes unused exported validation helpers and related imports/docs.
pkg/workflow/validation_helpers_test.go Removes tests for deleted validation/map helper functions.
pkg/workflow/map_helpers.go Removes unused map helper utilities and updates file header/docs accordingly.
pkg/workflow/engine_helpers.go Removes unused exported engine helper utilities.
pkg/workflow/engine_helpers_test.go Removes tests for deleted engine helper utilities.
Comments suppressed due to low confidence (2)

pkg/workflow/engine_helpers.go:275

  • The docstring for GetNpmBinPathSetup references GetHostedToolcachePathSetup(), but that helper was removed in this PR. Please update the comment to reference the current/remaining PATH setup behavior (or remove the comparison) so the documentation doesn’t point to a non-existent function.
// GetNpmBinPathSetup returns a simple shell command that adds hostedtoolcache bin directories
// to PATH. This is specifically for npm-installed CLIs (like Claude and Codex) that need
// to find their binaries installed via `npm install -g`.
//
// Unlike GetHostedToolcachePathSetup(), this does NOT use GH_AW_TOOL_BINS because AWF's
// native chroot mode already handles tool-specific paths (GOROOT, JAVA_HOME, etc.) via
// AWF_HOST_PATH and the entrypoint.sh script. This function only adds the generic
// hostedtoolcache bin directories for npm packages.

pkg/workflow/engine_helpers.go:113

  • PR title/description indicate this change is limited to removing dead domain helper functions, but this PR also removes other exported helpers (e.g. ExtractAgentIdentifier and several PATH/toolcache helpers). Please update the PR title/description (or split the changes) so the scope is accurately communicated for reviewers and release notes.
// ResolveAgentFilePath returns the properly quoted agent file path with GITHUB_WORKSPACE prefix.
// This helper extracts the common pattern shared by Copilot, Codex, and Claude engines.
//
// The agent file path is relative to the repository root, so we prefix it with ${GITHUB_WORKSPACE}

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

Comment on lines 61 to 67
Allowed: []string{"github.com"},
}

result := GetCopilotAllowedDomainsWithSafeInputs(network, true)
result := GetAllowedDomainsForEngine(constants.CopilotEngine, network, nil, nil)

if !strings.Contains(result, "host.docker.internal") {
t.Errorf("Expected result to contain 'host.docker.internal', got: %s", result)
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

These subtests are now calling GetAllowedDomainsForEngine directly, but the surrounding test/subtest names and comments still refer to “WithSafeInputs” / “backward compatibility with GetCopilotAllowedDomains”. Please rename/reword the test cases to match the new API and what’s actually being validated (e.g., Copilot defaults include host.docker.internal).

Copilot uses AI. Check for mistakes.
@dsyme dsyme merged commit 3963c97 into main Feb 28, 2026
88 checks passed
@dsyme dsyme deleted the dead7 branch February 28, 2026 11: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.

2 participants