Skip to content

[dead-code] chore: remove dead functions — 6 functions removed#48201

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
chore/remove-dead-policy-functions-f91ac44877678ed1
Draft

[dead-code] chore: remove dead functions — 6 functions removed#48201
github-actions[bot] wants to merge 1 commit into
mainfrom
chore/remove-dead-policy-functions-f91ac44877678ed1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Functions Removed

Function File
PolicyCompiler.Compile pkg/intent/policy.go
safestDefaultPolicy pkg/intent/policy.go
PolicyRule.matches pkg/intent/policy.go
deepCopyPolicy pkg/intent/policy.go
mergePolicy pkg/intent/policy.go
intersectAllowedTools pkg/intent/policy.go

All six functions were flagged by deadcode with no callers in non-test production code. They are internally self-referencing (helpers called by PolicyCompiler.Compile which itself has only test callers).

Tests Removed

  • TestFormal_SafestPolicyFields
  • TestFormal_FailClosedForIndeterminate
  • TestFormal_PolicyDeterminism
  • TestFormal_StricterWinsForAutonomyAndWriteScope
  • TestFormal_AllowedToolsIntersection

Also removed unused require import from intent_formal_test.go.

Verification

  • go build ./...
  • go vet ./...
  • go vet -tags=integration ./...
  • make fmt
  • go test ./pkg/intent/... — all pass

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

Generated by 🧹 Dead Code Removal Agent · ⌖ 11 AIC ·

  • expires on Jul 29, 2026, 7:00 AM UTC-08:00

Remove 6 unreachable functions from pkg/intent/policy.go that had no
callers in non-test production code:
- PolicyCompiler.Compile
- safestDefaultPolicy
- PolicyRule.matches
- deepCopyPolicy
- mergePolicy
- intersectAllowedTools

Also remove their exclusive test functions from intent_formal_test.go
(TestFormal_SafestPolicyFields, TestFormal_FailClosedForIndeterminate,
TestFormal_PolicyDeterminism, TestFormal_StricterWinsForAutonomyAndWriteScope,
TestFormal_AllowedToolsIntersection) and the now-unused require import.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor Author

Excellent work, Dead Code Removal Agent! 🤖 This PR looks great:

Focused — Removes 6 unused policy functions with no side effects
Well-documented — Clear explanation of which functions were removed and why
Verified — All remaining tests in pkg/intent/... pass; build and lint checks complete
On-topic — Maintenance work that keeps the codebase clean and maintainable

The dead-code analysis is correct: PolicyCompiler.Compile and its helpers have no production callers. This is a clean removal ready for merge. Great follow-up to the formal policy analysis work!

Generated by ✅ Contribution Check · sonnet46 · 61.8 AIC · ⌖ 10.5 AIC · ⊞ 6.2K ·

@pelikhan

Copy link
Copy Markdown
Collaborator

/scout do a summary of all the mentions of intent in the source code. Is it a feature that can be plugged to logs or audit

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

🏕️ Lost in the wilderness! Scout failed. Sending search party...

@github-actions github-actions Bot mentioned this pull request Jul 26, 2026
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.

1 participant