Skip to content

[dead-code] chore: remove dead functions — 5 functions removed - #59483

Merged
pelikhan merged 2 commits into
mainfrom
chore/remove-dead-code-1788878973-efce74c6ceb416d4
Sep 8, 2026
Merged

pelikhan merged 2 commits into
mainfrom
chore/remove-dead-code-1788878973-efce74c6ceb416d4

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Functions Removed

Function File
GetEngineDefaultDomainSets pkg/workflow/domains.go
extractRuntimeImportPaths pkg/workflow/runtime_import_validation.go
extractFrontmatterPlugins pkg/workflow/workflow_builder_frontmatter_extract.go
ReplaceSecretsWithEnvVars pkg/workflow/secret_extraction.go
runShellcheckOnLockFiles pkg/cli/shellcheck.go

Tests Removed

  • TestGetEngineDefaultDomainSets (pkg/workflow/domains_test.go)
  • TestExtractRuntimeImportPaths (pkg/workflow/runtime_import_validation_test.go)
  • TestExtractFrontmatterPlugins (pkg/workflow/workflow_builder_test.go)
  • TestReplaceSecretsWithEnvVars (pkg/workflow/mcp_http_headers_test.go)
  • TestSharedReplaceSecretsWithEnvVars, TestReplaceSecretsWithEnvVars_FallbackExpressionDeterminism (pkg/workflow/secret_extraction_test.go)

Remaining test callers of runShellcheckOnLockFiles were updated to call runShellcheckOnLockFilesAndResources(ctx, lockFiles, nil, verbose, strict) directly instead.

Verification

  • go build ./...
  • go vet ./...
  • go vet -tags=integration ./...
  • make fmt

https://github.com/github/gh-aw/actions/runs/34237897239

Generated by 🧹 Dead Code Removal Agent · copilot · auto · 158.6 AIC · ⌖ 14.5 AIC · ⊞ 9.9K · ◷

  • expires on Sep 11, 2026, 6:55 AM UTC-08:00

Removed unreachable functions identified by the deadcode static analyzer:
- GetEngineDefaultDomainSets (pkg/workflow/domains.go)
- extractRuntimeImportPaths (pkg/workflow/runtime_import_validation.go)
- extractFrontmatterPlugins (pkg/workflow/workflow_builder_frontmatter_extract.go)
- ReplaceSecretsWithEnvVars (pkg/workflow/secret_extraction.go)
- runShellcheckOnLockFiles (pkg/cli/shellcheck.go)

Also removed exclusive tests that only exercised these functions, and
updated remaining test callers of runShellcheckOnLockFiles to call
runShellcheckOnLockFilesAndResources directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review September 8, 2026 15:35
Copilot AI balanced review requested due to automatic review settings September 8, 2026 15:35
@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Ponytail Reviewer completed successfully!

Lean already. Ship.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • ab.chatgpt.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"

See Network Configuration for more information.

Generated by Ponytail Reviewer for #59483

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

No ADR enforcement needed: PR does not have the implementation label and has <=100 new lines of code in business logic directories.

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel skipped because pre-fetch PR data was unavailable: unable to fetch test file diff

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

🔎 PR Code Quality Reviewer is reviewing code quality for this pull request...

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /codebase-design to this dead-code removal PR — approving with minor doc-cleanup suggestions.

📋 Key Themes & Highlights

Key Themes

  • Stale doc cross-references: 3 file-header/inline comments still name functions that were just deleted (runShellcheckOnLockFiles, extractRuntimeImportPaths, ReplaceSecretsWithEnvVars). These are harmless today but will confuse the next reader trying to navigate the module by its doc comment.

Verification

  • Confirmed via grep that no remaining production (non-comment, non-test) call sites reference the five removed functions — all callers were correctly updated (e.g. shellcheck_test.go now calls runShellcheckOnLockFilesAndResources directly).
  • Test removals match 1:1 with the removed functions; no orphaned test scaffolding left behind.

Positive Highlights

  • ✅ Clean, surgical removal — each deleted function has zero remaining callers.
  • ✅ Test suite correctly trimmed alongside production code, including the domains_test.go switch to the unexported engineDefaultDomainSets map where a public accessor was no longer needed.
  • ✅ PR description clearly documents what was removed and why.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · 25.9 AIC · ⌖ 14.9 AIC · ⊞ 10.3K
Comment /matt to run again

Comments that could not be inline-anchored

pkg/cli/shellcheck.go:8

[/codebase-design] Stale doc reference — the file-header comment still lists runShellcheckOnLockFiles() as a key function, but it was just deleted from this file.

<details>
<summary>💡 Suggested fix</summary>

Update the header comment (around line 8) to reference runShellcheckOnLockFilesAndResources() instead, so the module doc stays navigable for future readers.

</details>

@copilot please address this.

pkg/cli/shellcheck.go:409

[/codebase-design] The doc comment above runShellcheckOnLockFilesAndResources still starts with the removed function's name, not the remaining one.

<details>
<summary>💡 Suggested fix</summary>

Rename the leading identifier in the comment to runShellcheckOnLockFilesAndResources to match the actual function signature (godoc convention expects the comment to start with the function name).

</details>

@copilot please address this.

pkg/workflow/runtime_import_validation.go:11

[/codebase-design] Stale doc reference — the file-header # Validation Functions list still mentions extractRuntimeImportPaths(), which this PR removes.

<details>
<summary>💡 Suggested fix</summary>

Remove this bullet (or replace it with the still-present extractRuntimeImportReferences() helper) so the module doc doesn't point readers to a function that no longer exists.

</details>

@copilot please address this.

pkg/workflow/secret_extraction.go:395

[/codebase-design] Dangling cross-reference — this comment says "see ReplaceSecretsWithEnvVars for rationale", but that function was deleted in this PR, leaving a broken pointer for future readers.

<details>
<summary>💡 Suggested fix</summary>

Either inline the rationale here or point to ReplaceSecretsWithShellEnvVars / replaceSecretsWithPrefixedEnvVars, whichever now documents the sorted-key determinism reasoning.

</details>

@copilot please address this.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Removing documented exported APIs introduces source-breaking changes for downstream consumers.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Removes five presumed-unused workflow and shellcheck helpers and associated tests.

Changes:

  • Deletes workflow extraction, secret replacement, and domain-access helpers.
  • Removes related tests.
  • Updates shellcheck tests to use the generalized implementation.
File summaries
File Review
pkg/workflow/workflow_builder_test.go Removes plugin extraction tests.
pkg/workflow/workflow_builder_frontmatter_extract.go Removes the plugin extraction wrapper.
pkg/workflow/secret_extraction.go Critical (2 votes): Restore or formally deprecate the exported ReplaceSecretsWithEnvVars API before removal.
pkg/workflow/secret_extraction_test.go Removes replacement and determinism tests.
pkg/workflow/runtime_import_validation.go Nit (2 votes): Update the file-level function list referencing the deleted helper.
pkg/workflow/runtime_import_validation_test.go Removes wrapper tests.
pkg/workflow/mcp_http_headers_test.go Removes secret replacement tests.
pkg/workflow/domains.go Critical (1 vote): Restore the documented exported accessor or handle its removal as a breaking change.
pkg/workflow/domains_test.go Critical (1 vote): Restore the accessor tests or document the breaking release and migration.
pkg/cli/shellcheck.go Nit (2 votes): Update documentation references to the generalized function.
pkg/cli/shellcheck_test.go Calls the generalized shellcheck function directly.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 5
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/workflow/domains.go
Comment on lines 102 to 104
func copyEngineDefaultDomainSet(domains []string) []string {
return append([]string(nil), domains...)
}
Comment thread pkg/workflow/domains_test.go Outdated

func TestThreatDetectionDomains(t *testing.T) {
detectionDomains := GetEngineDefaultDomainSets()["threat-detection"]
detectionDomains := engineDefaultDomainSets["threat-detection"]
return replaceSecretsWithPrefixedEnvVars(value, secrets, "\\${")
}

// ReplaceSecretsWithShellEnvVars replaces secret expressions in a value with plain shell
Comment thread pkg/cli/shellcheck.go
return runShellcheckOnLockFilesAndResources(ctx, lockFiles, nil, verbose, strict)
}

func runShellcheckOnLockFilesAndResources(ctx context.Context, lockFiles []string, resources []workflow.ShellScriptResource, verbose bool, strict bool) error {
return paths
}

type runtimeImportReference struct {

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed via Impeccable distill/extract lenses (refactor/cleanup change: 5 dead function removals + their tests).

  • Verified no remaining callers of any removed function outside the diff (GetEngineDefaultDomainSets, extractRuntimeImportPaths, extractFrontmatterPlugins, ReplaceSecretsWithEnvVars, runShellcheckOnLockFiles).
  • go build ./pkg/... succeeds.
  • Test updates correctly switch callers to runShellcheckOnLockFilesAndResources / unexported engineDefaultDomainSets map.

No actionable issues found — clean removal with no leftover references or broken tests.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · copilot · sonnet50 · 25.8 AIC · ⌖ 13.3 AIC · ⊞ 8.3K

@gh-aw-bot

Copy link
Copy Markdown
Collaborator
pr-sous-chef

@copilot Please take the next forward-progress pass on PR #59483.

  • Review any remaining feedback on the current HEAD and address what is actionable.
  • Refresh the branch if GitHub allows it, then run the pr-finisher skill.
  • Provide a concise maintainer-facing handoff with any remaining actionable blocker.

Generated by PR Sous Chef: https://github.com/github/gh-aw/actions/runs/34250871362

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 19.9 AIC · ⌖ 8.72 AIC · ⊞ 8.7K · ◷
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Sep 8, 2026

Copy link
Copy Markdown
Contributor
pr-sous-chef
```...

Completed the forward-progress pass in 383de5f. Restored the two documented exported compatibility APIs and their tests, corrected stale helper references, and completed local validation. The branch is current with origin/main; CI on this agent-pushed HEAD remains unverified until a maintainer re-triggers it.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

✅ Looks great! This dead code removal is focused and well-documented. All 5 unused functions and their tests have been cleanly removed, with proper updates to remaining test callers. The verification checklist shows all checks passed (go build, go vet, make fmt). This is ready for review and merge!

Generated by ✅ Contribution Check · copilot · auto · 53.3 AIC · ⌖ 7.59 AIC · ⊞ 9.3K · ◷

@pelikhan
pelikhan merged commit 3897607 into main Sep 8, 2026
1 check passed
@pelikhan
pelikhan deleted the chore/remove-dead-code-1788878973-efce74c6ceb416d4 branch September 8, 2026 17:28
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v0.88.8

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants