Skip to content

[function-namer] Go function rename plan: audit_diff.go, audit_diff_render.go #24708

@github-actions

Description

@github-actions

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 needed
  • domainStatus()⚠️ Rename suggested (see table above)
  • formatVolumeChange() — ✅ Clear, no change needed
  • formatPercent() — ✅ Clear, no change needed
  • computeAuditDiff() — ✅ Clear, no change needed
  • mcpToolKey() — ✅ Clear, no change needed
  • computeMCPToolsDiff() — ✅ Clear, no change needed
  • computeRunMetricsDiff() — ✅ Clear, no change needed
  • computeTokenUsageDiff() — ✅ Clear, no change needed
  • formatPercentagePointChange() — ✅ Clear, no change needed
  • formatCountChange() — ✅ Clear, no change needed
  • loadRunSummaryForDiff() — ✅ 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 needed
  • renderAuditDiffMarkdown() — ✅ Clear, no change needed
  • renderAuditDiffPretty() — ✅ Clear, no change needed
  • renderSingleAuditDiffMarkdown() — ✅ Clear, no change needed
  • renderSingleAuditDiffPretty() — ✅ Clear, no change needed
  • renderFirewallDiffMarkdownSection() — ✅ Clear, no change needed
  • renderMCPToolsDiffMarkdownSection() — ✅ Clear, no change needed
  • renderRunMetricsDiffMarkdownSection() — ✅ Clear, no change needed
  • renderTokenUsageDiffMarkdownSection() — ✅ Clear, no change needed
  • renderFirewallDiffPrettySection() — ✅ Clear, no change needed
  • renderMCPToolsDiffPrettySection() — ✅ Clear, no change needed
  • renderRunMetricsDiffPrettySection() — ✅ Clear, no change needed
  • renderTokenUsageDiffPrettySection() — ✅ Clear, no change needed
  • statusEmoji()⚠️ Rename suggested (see table above)
  • isEmptyFirewallDiff() — ✅ Clear, no change needed
  • isEmptyMCPToolsDiff() — ✅ Clear, no change needed
  • isEmptyAuditDiff() — ✅ 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 domainStatusclassifyFirewallDomainStatus 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.gocomputeFirewallDiff (4 call sites)
  • pkg/cli/audit_cross_run.gobuildCrossRunAuditReport (2 call sites)
  • pkg/cli/audit_diff_test.goTestDomainStatus (1 call site)

2. Rename statusEmojifirewallStatusEmoji 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.gorenderFirewallDiffMarkdownSection (3 call sites), renderFirewallDiffPrettySection (4 call sites)
  • pkg/cli/audit_cross_run_render.gorenderCrossRunReportMarkdown (1 call site), renderCrossRunReportPretty (1 call site)
  • pkg/cli/audit_diff_test.goTestStatusEmoji (5 call sites)

3. Verify compilation after each rename

make build

4. 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 clarity

Validation Checklist

  • All renames implemented
  • All call sites updated (Go files and test files)
  • make build passes with no errors
  • make test-unit passes
  • make lint passes
  • 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

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions