refactor: consolidate orphaned variable file and single-function strutil files#6867
Merged
Merged
Conversation
…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
Contributor
There was a problem hiding this comment.
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
allowedGuardPolicyIntegrityLevelsintointernal/config/guard_policy_validation.goand removed the now-redundant file that only contained that variable. - Merged
GetStringFromMapandDeepCloneJSONintointernal/strutil/util.go. - Merged the corresponding tests into
internal/strutil/util_test.goand 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two minor cleanup items surfaced by semantic function clustering analysis: an orphaned single-variable file in
internal/config, and two single-function files ininternal/strutilthat have no thematic reason to live separately.Changes
guard_policy_integrity_levels.go→ deleted: MovesallowedGuardPolicyIntegrityLevelsintoguard_policy_validation.gowhere all primary usages are. Eliminates a 7-line file with no functions.strutil/map.go+strutil/deep_clone_json.go→strutil/util.go: MergesGetStringFromMapandDeepCloneJSONinto a single generic-utilities file. Corresponding test files (map_test.go,deep_clone_json_test.go) merged intoutil_test.go.No logic changes.