Skip to content

refactor: consolidate orphaned variable file and single-function strutil files#6867

Merged
lpcox merged 2 commits into
mainfrom
copilot/refactor-semantic-function-clustering
Jun 1, 2026
Merged

refactor: consolidate orphaned variable file and single-function strutil files#6867
lpcox merged 2 commits into
mainfrom
copilot/refactor-semantic-function-clustering

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 1, 2026

Two minor cleanup items surfaced by semantic function clustering analysis: an orphaned single-variable file in internal/config, and two single-function files in internal/strutil that have no thematic reason to live separately.

Changes

  • guard_policy_integrity_levels.go → deleted: Moves allowedGuardPolicyIntegrityLevels into guard_policy_validation.go where all primary usages are. Eliminates a 7-line file with no functions.

  • strutil/map.go + strutil/deep_clone_json.gostrutil/util.go: Merges GetStringFromMap and DeepCloneJSON into a single generic-utilities file. Corresponding test files (map_test.go, deep_clone_json_test.go) merged into util_test.go.

No logic changes.

…iles

- Move allowedGuardPolicyIntegrityLevels into guard_policy_validation.go
  and delete the orphaned guard_policy_integrity_levels.go
- Merge strutil/map.go and strutil/deep_clone_json.go into strutil/util.go
- Merge corresponding test files into strutil/util_test.go
Copilot AI changed the title [WIP] Refactor semantic function clustering analysis refactor: consolidate orphaned variable file and single-function strutil files Jun 1, 2026
Copilot finished work on behalf of lpcox June 1, 2026 22:35
Copilot AI requested a review from lpcox June 1, 2026 22:35
@lpcox lpcox marked this pull request as ready for review June 1, 2026 22:41
Copilot AI review requested due to automatic review settings June 1, 2026 22:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR performs small internal refactors to reduce file fragmentation by consolidating (1) a previously standalone package-level variable in internal/config into the file where it’s primarily used, and (2) two single-function internal/strutil utilities (and their tests) into existing util.go/util_test.go.

Changes:

  • Moved allowedGuardPolicyIntegrityLevels into internal/config/guard_policy_validation.go and removed the now-redundant file that only contained that variable.
  • Merged GetStringFromMap and DeepCloneJSON into internal/strutil/util.go.
  • Merged the corresponding tests into internal/strutil/util_test.go and removed the two single-purpose test files.
Show a summary per file
File Description
internal/strutil/util.go Adds GetStringFromMap alongside DeepCloneJSON to consolidate generic helpers.
internal/strutil/util_test.go Consolidates tests for GetStringFromMap and DeepCloneJSON.
internal/strutil/map.go Deleted after moving GetStringFromMap into util.go.
internal/strutil/map_test.go Deleted after merging tests into util_test.go.
internal/config/guard_policy_validation.go Hosts allowedGuardPolicyIntegrityLevels near its main validation usage.
internal/config/guard_policy_integrity_levels.go Deleted after moving the lone variable into guard_policy_validation.go.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 6/6 changed files
  • Comments generated: 0

@lpcox lpcox merged commit c90766f into main Jun 1, 2026
29 checks passed
@lpcox lpcox deleted the copilot/refactor-semantic-function-clustering branch June 1, 2026 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactor] Semantic function clustering analysis: 2 minor refactoring opportunities

3 participants