Description
PolicyRule is defined in two unrelated packages with the same name:
pkg/cli/firewall_policy.go:36 — a firewall ACL rule (fields: ID, Order, Action, ACLName, Protocol, Domains, ...)
pkg/intent/policy.go:46 — an intent execution-policy rule (fields: ID, Scope, When, Set)
These are unrelated concepts sharing only an ID field and are not merge candidates. The name collision causes confusion in cross-package code reviews and text searches.
Suggested Changes
Rename PolicyRule in pkg/cli/firewall_policy.go to FirewallPolicyRule to make the distinction explicit. Update all references in the same package.
Files Affected
pkg/cli/firewall_policy.go — rename struct PolicyRule → FirewallPolicyRule
- Any files in
pkg/cli/ that reference PolicyRule (check with grep -r "PolicyRule" pkg/cli/)
Success Criteria
FirewallPolicyRule used consistently in pkg/cli/
pkg/intent/policy.go unchanged
make build passes; all tests pass
- No ambiguous
PolicyRule references in cross-package searches
Source
Extracted from Typist Go Type Consistency Analysis discussion #46823
Priority
Low — reduces cross-package confusion; effort < 1 hour
🔍 Task mining by Discussion Task Miner - Code Quality Improvement Agent · 46.7 AIC · ⌖ 7.94 AIC · ⊞ 7K · ◷
Description
PolicyRuleis defined in two unrelated packages with the same name:pkg/cli/firewall_policy.go:36— a firewall ACL rule (fields:ID,Order,Action,ACLName,Protocol,Domains, ...)pkg/intent/policy.go:46— an intent execution-policy rule (fields:ID,Scope,When,Set)These are unrelated concepts sharing only an
IDfield and are not merge candidates. The name collision causes confusion in cross-package code reviews and text searches.Suggested Changes
Rename
PolicyRuleinpkg/cli/firewall_policy.gotoFirewallPolicyRuleto make the distinction explicit. Update all references in the same package.Files Affected
pkg/cli/firewall_policy.go— rename structPolicyRule→FirewallPolicyRulepkg/cli/that referencePolicyRule(check withgrep -r "PolicyRule" pkg/cli/)Success Criteria
FirewallPolicyRuleused consistently inpkg/cli/pkg/intent/policy.gounchangedmake buildpasses; all tests passPolicyRulereferences in cross-package searchesSource
Extracted from Typist Go Type Consistency Analysis discussion #46823
Priority
Low — reduces cross-package confusion; effort < 1 hour