Skip to content

[function-namer] Go function rename plan: codemod_permissions_read.go, codemod_permissions_write.go #22651

@github-actions

Description

@github-actions

Files Analyzed: pkg/cli/codemod_mcp_mode_to_type.go, pkg/cli/codemod_mcp_network.go, pkg/cli/codemod_mcp_scripts.go, pkg/cli/codemod_network_firewall.go, pkg/cli/codemod_permissions_read.go, pkg/cli/codemod_permissions_write.go
Analysis Date: 2026-03-24
Round-Robin Position: files 36–41 of 607 total
Function Budget: 11 functions across 6 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/codemod_permissions_read.go

Current Name Suggested Name Reason
getPermissionsReadCodemod() getExpandPermissionsShorthandCodemod() The function expands BOTH readread-all AND writewrite-all shorthand. The current name implies only the "read" shorthand is handled, which could cause an agent to miss this function when looking for "write-all expansion" or "permissions shorthand normalization".

All functions in this file (for reference):

  • getPermissionsReadCodemod()⚠️ Rename suggested (see table above)

pkg/cli/codemod_permissions_write.go

Current Name Suggested Name Reason
getWritePermissionsCodemod() getMigrateWritePermissionsToReadCodemod() The function downgrades write permissions to read (e.g., write-allread-all, per-scope writeread). The current name describes the subject ("write permissions") but not the action ("migrate to read"). An agent looking for "how to convert write permissions to read" would not reliably find getWritePermissionsCodemod.

All functions in this file (for reference):

  • getWritePermissionsCodemod()⚠️ Rename suggested (see table above)

Other analyzed files (no changes needed)

  • pkg/cli/codemod_mcp_mode_to_type.go: getMCPModeToTypeCodemod(), renameModeToTypeInMCPServers() — ✅ Clear, no change needed
  • pkg/cli/codemod_mcp_network.go: getMCPNetworkMigrationCodemod(), removeFieldFromMCPServer(), addTopLevelNetwork(), updateNetworkAllowed(), addAllowedToNetwork() — ✅ Clear, no change needed
  • pkg/cli/codemod_mcp_scripts.go: getMCPScriptsModeCodemod() — ✅ Clear, no change needed
  • pkg/cli/codemod_network_firewall.go: getNetworkFirewallCodemod() — ✅ Clear, no change needed

🤖 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

Rename 1: getPermissionsReadCodemodgetExpandPermissionsShorthandCodemod

File: pkg/cli/codemod_permissions_read.go

// Old
func getPermissionsReadCodemod() Codemod {

// New
func getExpandPermissionsShorthandCodemod() Codemod {

Update all call sites:

grep -rn "getPermissionsReadCodemod" pkg/ --include="*.go"
grep -rn "getPermissionsReadCodemod" pkg/ --include="*_test.go"

Known call sites:

  • pkg/cli/fix_codemods.go:30getPermissionsReadCodemod()
  • pkg/cli/codemod_permissions_test.go — multiple test functions call this

Rename 2: getWritePermissionsCodemodgetMigrateWritePermissionsToReadCodemod

File: pkg/cli/codemod_permissions_write.go

// Old
func getWritePermissionsCodemod() Codemod {

// New
func getMigrateWritePermissionsToReadCodemod() Codemod {

Update all call sites:

grep -rn "getWritePermissionsCodemod" pkg/ --include="*.go"
grep -rn "getWritePermissionsCodemod" pkg/ --include="*_test.go"

Known call sites:

  • pkg/cli/fix_codemods.go:29getWritePermissionsCodemod()
  • pkg/cli/codemod_permissions_test.go — multiple test functions call this

Verify compilation after each rename

make build

Run tests after all renames are complete

make test-unit
make lint
```

### Commit Convention

Each rename should be a focused commit:

```
refactor: rename getPermissionsReadCodemod to getExpandPermissionsShorthandCodemod for clarity
refactor: rename getWritePermissionsCodemod to getMigrateWritePermissionsToReadCodemod 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
  • Unexported functions used only as closures or immediately-invoked can be skipped

Generated by the Daily Go Function Namer workflow
Run: §23486453866

Generated by Daily Go Function Namer ·

  • expires on Mar 31, 2026, 11:15 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