-
Notifications
You must be signed in to change notification settings - Fork 330
[function-namer] Go function rename plan: audit_diff.go, audit_diff_render.go #24708
Description
Files Analyzed: pkg/cli/audit_cross_run.go, pkg/cli/audit_cross_run_render.go, pkg/cli/audit_diff.go, pkg/cli/audit_diff_command.go, pkg/cli/audit_diff_render.go
Analysis Date: 2026-04-05
Round-Robin Position: files 30–34 of 657 total
Function Budget: ~39 functions across 5 files
Why This Matters
When AI coding agents search for functions to complete a task, they rely on function
names to understand what code does. Clear, descriptive names increase the likelihood
that an agent will find the right function instead of reimplementing existing logic.
Rename Suggestions
pkg/cli/audit_diff.go
| Current Name | Suggested Name | Reason |
|---|---|---|
domainStatus() |
classifyFirewallDomainStatus() |
domainStatus is vague — doesn't indicate it classifies firewall access (allowed/denied/mixed) based on request counts. An agent looking for "determine if a domain is allowed or blocked" would find classifyFirewallDomainStatus faster. |
All functions in this file (for reference):
computeFirewallDiff()— ✅ Clear, no change neededdomainStatus()—⚠️ Rename suggested (see table above)formatVolumeChange()— ✅ Clear, no change neededformatPercent()— ✅ Clear, no change neededcomputeAuditDiff()— ✅ Clear, no change neededmcpToolKey()— ✅ Clear, no change neededcomputeMCPToolsDiff()— ✅ Clear, no change neededcomputeRunMetricsDiff()— ✅ Clear, no change neededcomputeTokenUsageDiff()— ✅ Clear, no change neededformatPercentagePointChange()— ✅ Clear, no change neededformatCountChange()— ✅ Clear, no change neededloadRunSummaryForDiff()— ✅ Clear, no change needed
pkg/cli/audit_diff_render.go
| Current Name | Suggested Name | Reason |
|---|---|---|
statusEmoji() |
firewallStatusEmoji() |
Completely generic — doesn't indicate what kind of status (firewall domain status: "allowed"/"denied"/"mixed") or that it maps to an emoji for rendering. An agent looking for "get emoji for firewall domain status" would skip this. |
All functions in this file (for reference):
renderAuditDiffJSON()— ✅ Clear, no change neededrenderAuditDiffMarkdown()— ✅ Clear, no change neededrenderAuditDiffPretty()— ✅ Clear, no change neededrenderSingleAuditDiffMarkdown()— ✅ Clear, no change neededrenderSingleAuditDiffPretty()— ✅ Clear, no change neededrenderFirewallDiffMarkdownSection()— ✅ Clear, no change neededrenderMCPToolsDiffMarkdownSection()— ✅ Clear, no change neededrenderRunMetricsDiffMarkdownSection()— ✅ Clear, no change neededrenderTokenUsageDiffMarkdownSection()— ✅ Clear, no change neededrenderFirewallDiffPrettySection()— ✅ Clear, no change neededrenderMCPToolsDiffPrettySection()— ✅ Clear, no change neededrenderRunMetricsDiffPrettySection()— ✅ Clear, no change neededrenderTokenUsageDiffPrettySection()— ✅ Clear, no change neededstatusEmoji()—⚠️ Rename suggested (see table above)isEmptyFirewallDiff()— ✅ Clear, no change neededisEmptyMCPToolsDiff()— ✅ Clear, no change neededisEmptyAuditDiff()— ✅ Clear, no change needed
Other analyzed files
pkg/cli/audit_cross_run.go— ✅ All functions clear (buildCrossRunAuditReport,buildMetricsTrend,buildDrain3InsightsFromCrossRunInputs)pkg/cli/audit_cross_run_render.go— ✅ All functions clear (renderCrossRunReportJSON,renderCrossRunReportMarkdown,renderCrossRunReportPretty,formatRunIDs,safePercent)pkg/cli/audit_diff_command.go— ✅ All functions clear (NewAuditDiffSubcommand,RunAuditDiff)
🤖 Agentic Implementation Plan
Agentic Implementation Plan
This issue is designed to be assigned to a coding agent. The agent should implement
all rename suggestions below in a single pull request.
Prerequisites
- Read each rename suggestion and verify it is accurate by reviewing the function body
- Check for any Go interface constraints that prevent renaming (e.g., must match interface method name)
Implementation Steps
1. Rename domainStatus → classifyFirewallDomainStatus in pkg/cli/audit_diff.go
// Old
func domainStatus(stats DomainRequestStats) string {
// New
func classifyFirewallDomainStatus(stats DomainRequestStats) string {Update all call sites (verified call sites from LSP analysis):
grep -rn "domainStatus" pkg/ --include="*.go"Known callers:
pkg/cli/audit_diff.go—computeFirewallDiff(4 call sites)pkg/cli/audit_cross_run.go—buildCrossRunAuditReport(2 call sites)pkg/cli/audit_diff_test.go—TestDomainStatus(1 call site)
2. Rename statusEmoji → firewallStatusEmoji in pkg/cli/audit_diff_render.go
// Old
func statusEmoji(status string) string {
// New
func firewallStatusEmoji(status string) string {Update all call sites:
grep -rn "statusEmoji" pkg/ --include="*.go"Known callers:
pkg/cli/audit_diff_render.go—renderFirewallDiffMarkdownSection(3 call sites),renderFirewallDiffPrettySection(4 call sites)pkg/cli/audit_cross_run_render.go—renderCrossRunReportMarkdown(1 call site),renderCrossRunReportPretty(1 call site)pkg/cli/audit_diff_test.go—TestStatusEmoji(5 call sites)
3. Verify compilation after each rename
make build4. Run tests after all renames are complete
make test-unit
make lint
```
### Commit Convention
Each rename should be a focused commit:
```
refactor: rename domainStatus to classifyFirewallDomainStatus for clarity
refactor: rename statusEmoji to firewallStatusEmoji for clarityValidation Checklist
- All renames implemented
- All call sites updated (Go files and test files)
-
make buildpasses with no errors -
make test-unitpasses -
make lintpasses - PR description explains the agent-discoverability rationale
Notes for the Agent
- This is a pure rename refactor — behavior must not change, only names
- If a rename causes unexpected complexity (e.g., name conflicts, interface constraints),
skip it and leave a comment in the PR explaining why - Follow existing naming conventions documented in
AGENTS.md - Both functions are unexported (lowercase), so no external API compatibility concerns
Generated by the Daily Go Function Namer workflow
Run: §24000173182
Generated by Daily Go Function Namer · ● 173.8K · ◷
- expires on Apr 12, 2026, 11:08 AM UTC