Refactor util helper placement and improve TLS/API env discoverability - #10246
Conversation
There was a problem hiding this comment.
Pull request overview
Reorganizes utility helpers by responsibility and clarifies TLS and GitHub environment helper boundaries.
Changes:
- Splits catch-all utility helpers into collection, formatting, and JSON files.
- Adds TLS generation cross-referencing.
- Documents GitHub environment helper placement.
Show a summary per file
| File | Description |
|---|---|
internal/util/util.go |
Removes the catch-all utility file. |
internal/util/collections.go |
Adds collection and map helpers. |
internal/util/format.go |
Adds numeric conversion and normalization helpers. |
internal/util/json.go |
Adds JSON deep-cloning. |
internal/httputil/tls.go |
Cross-references self-signed certificate generation. |
internal/envutil/github.go |
Explains GitHub environment helper ownership. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Medium
| // SortedSetKeys returns the keys of a string set (map[string]struct{}) as a sorted slice. | ||
| // Returns an empty (non-nil) slice when the set is empty. | ||
| func SortedSetKeys(set map[string]struct{}) []string { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@copilot address review feedback |
- Move TestSortedSetKeys and TestGetStringFromMap into collections_test.go - Move TestInterfaceToIntString and TestNormalizeStringCI into format_test.go - Create json_test.go with TestDeepCloneJSON - Delete util_test.go (catch-all no longer needed)
Done in commit |
🔒 mcpg Read-Only Stress — gVisorSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS
References: §30382830779
|
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS
References: §30382830711
|
🔒 mcpg Read-Only Stress — docker-sbxSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: PASS
References: §30382831690
|
This addresses semantic clustering findings around low-signal utility scatter and TLS discoverability. The change is intentionally structural: function behavior is preserved while file ownership and intent become clearer.
internal/utildecomposition (remove catch-all)internal/util/util.go.internal/util/collections.go:SortedSetKeysGetStringFromMapinternal/util/format.go:InterfaceToIntStringNormalizeStringCIinternal/util/json.gofor JSON-specific cloning:DeepCloneJSONTLS cross-reference for discoverability
internal/httputil/tls.go(LoadGatewayTLSdocs) pointing tointernal/proxy.GenerateSelfSignedTLSfor self-signed certificate generation.GitHub env helper boundary clarification
internal/envutil/github.goexplaining why GitHub-specific env resolution remains inenvutil(shared env semantics across cmd/server/proxy layers, without HTTP package coupling).