Skip to content

[dead-code] chore: remove dead functions — 1 function removed#34674

Merged
pelikhan merged 1 commit into
mainfrom
dead-code-removal-26407377960-f066ee86dc44c5ac
May 25, 2026
Merged

[dead-code] chore: remove dead functions — 1 function removed#34674
pelikhan merged 1 commit into
mainfrom
dead-code-removal-26407377960-f066ee86dc44c5ac

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented May 25, 2026

[dead-code] chore: remove dead functions — 1 function removed

Summary

Removes the unused hasBashWildcardInTools helper function from pkg/workflow/claude_tools.go and its corresponding test suite from pkg/workflow/claude_engine_tools_test.go. No call sites remain; this is a pure dead-code cleanup with no behaviour change.


Changes by file

File Change type Impact Breaking
pkg/workflow/claude_tools.go modified high false
pkg/workflow/claude_engine_tools_test.go modified medium false

Detailed file changes

pkg/workflow/claude_tools.godeleted function

  • Removed hasBashWildcardInTools(tools map[string]any) bool.
  • The function inspected the neutral tools map for unrestricted bash access via three patterns: bash: true, bash: nil, and bash: ["*"] / bash: [":*"].
  • Classified as high impact because the function touched security-adjacent logic (detecting unrestricted bash in tool definitions), even though no caller existed.

pkg/workflow/claude_engine_tools_test.godeleted tests

  • Removed TestHasBashWildcardInTools and all its table-driven sub-cases that exercised the deleted helper.
  • Classified as medium impact (test-only surface, but the removed coverage was non-trivial).

Risk assessment

  • Behaviour change: None. Function had no callers.
  • Security surface: The deleted function was detection logic (read-only analysis), not enforcement; removing it does not weaken any access control path.
  • Test coverage: Only the tests for the deleted function are removed; no other test coverage is affected.
  • Rollback: Trivial — revert the two file edits.

Agentic analysis hints

  • dead_code_label: hasBashWildcardInTools
  • affected_packages: pkg/workflow
  • deleted_symbols: hasBashWildcardInTools
  • deleted_tests: TestHasBashWildcardInTools
  • commit: b136dc47a
  • pr_category: dead-code / chore
  • requires_migration: false
  • requires_config_change: false
  • touches_security_logic: true (detection only, not enforcement)

Generated by PR Description Updater for issue #34674 · sonnet46 778.9K ·

Remove hasBashWildcardInTools which is unreachable from any production
binary entry point as identified by the deadcode static analyzer.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review May 25, 2026 15:32
Copilot AI review requested due to automatic review settings May 25, 2026 15:32
@pelikhan pelikhan merged commit 24f5df0 into main May 25, 2026
18 of 20 checks passed
@pelikhan pelikhan deleted the dead-code-removal-26407377960-f066ee86dc44c5ac branch May 25, 2026 15:32
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 25, 2026

🧪 Test Quality Sentinel completed test quality analysis.

No test files were added or modified in this PR. Test Quality Sentinel skipped. PR #34674 is a dead-code removal that only deletes the TestHasBashWildcardInTools test function (along with its corresponding production function hasBashWildcardInTools). No new or changed tests to analyze.

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 25, 2026

PR Code Quality Reviewer completed the code quality review.

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 25, 2026

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #34674 does not have the 'implementation' label and has 0 new lines in default business logic directories (threshold: 100).

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented May 25, 2026

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

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

Removes a Go helper and its associated unit test that were identified as unreachable by the deadcode static analyzer, reducing maintenance surface in the workflow tooling layer.

Changes:

  • Deleted hasBashWildcardInTools from pkg/workflow/claude_tools.go.
  • Removed TestHasBashWildcardInTools from pkg/workflow/claude_engine_tools_test.go.
  • Confirmed there are no remaining references to hasBashWildcardInTools in the Go codebase.
Show a summary per file
File Description
pkg/workflow/claude_tools.go Removes the unused hasBashWildcardInTools helper.
pkg/workflow/claude_engine_tools_test.go Removes the unit test that only covered the deleted helper.

Copilot's findings

Tip

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

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

@github-actions github-actions Bot mentioned this pull request May 25, 2026
Copy link
Copy Markdown
Contributor Author

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Dead code removal is correct — one documentation gap remains

The removal is valid: hasBashWildcardInTools was already decoupled from the permission-mode selection path in a prior commit (the claude_engine_test.go test names — "bash wildcard * no longer forces bypassPermissions" etc. — make this explicit). Deleting both the function and its test is the right cleanup.

Documentation gap (not blocking — already merged): AGENTS.md line 721 still reads:

hasBashWildcardInTools() in claude_tools.go determines which mode is selected — changes here affect the security boundary

This is now stale. A follow-up commit should update that section to describe the actual current mechanism (engine.permission-mode override field + stripClaudePermissionModeArgs) so future contributors do not search for a function that no longer exists.

🔎 Code quality review by PR Code Quality Reviewer · sonnet46 818.3K

Copy link
Copy Markdown
Contributor Author

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /zoom-out — clean dead-code removal; one documentation note.

📋 Key Themes & Highlights

Key Themes

  • AGENTS.md is now stale: The security-model section ("Claude Engine Tool Enforcement Security Model") still references hasBashWildcardInTools() as the function that determines which permission mode is selected, and describes bypassPermissions as being auto-selected for bash: "*" workflows — but neither of those things is true anymore. The current claude_engine.go defaults to acceptEdits and only switches to auto via isEditToolExplicitlyDisabled, never to bypassPermissions automatically. AGENTS.md lines 715, 721 should be updated to reflect the current behavior.
  • The removal itself is correct: deadcode confirmed no live call site existed; go build and go vet pass; the 9-case test suite is appropriately retired alongside the function it covered.

Positive Highlights

  • ✅ Pure deletion — zero additions, no risk of introducing new bugs
  • ✅ Build and vet verified before opening the PR
  • ✅ Well-documented PR description explaining before/after dead-function count

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 1.2M

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.

2 participants