{{ message }}
refactor: fix package placement and consolidate micro-files per semantic clustering analysis#7483
Merged
Merged
Conversation
…idation - Move internal/logger/sanitize → internal/sanitize (cross-cutting security utility) - Merge internal/config/rules into internal/config package (exclusive sub-package) - Merge tracing/holder.go into tracing/provider.go (micro-file) - Merge proxy/metadata.go into proxy/handler.go (micro-file) Closes #7445
Copilot
AI
changed the title
[WIP] Refactor semantic function clustering analysis for package placement
refactor: fix package placement and consolidate micro-files per semantic clustering analysis
Jun 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors internal package structure to better reflect actual usage: promoting shared sanitization utilities to a top-level helper package, inlining config validation “rules” into internal/config, and merging two micro-files into their primary implementation files to reduce navigation overhead.
Changes:
- Move
internal/logger/sanitizetointernal/sanitizeand update import sites across the codebase. - Inline
internal/config/rulesintointernal/configby moving validation types/helpers intovalidation_rules.goand updating call sites. - Merge
tracing/holder.gointotracing/provider.goandproxy/metadata.gointoproxy/handler.go.
Show a summary per file
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 31/33 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.

Three structural issues identified by semantic function clustering analysis: a cross-cutting security utility buried under the wrong parent, a sub-package with no consumers outside its parent, and two navigation-overhead micro-files.
Changes
internal/logger/sanitize→internal/sanitize: The sanitize package (secret redaction, token truncation, URL sanitization) is consumed by 14+ files acrossauth,envutil,launcher,mcp, andserver— not bylogger. Promotes it to a first-class top-level utility package; updates all 18 import sites.internal/config/rules→ inlined intointernal/config: Therulessub-package had zero consumers outsideconfig. Moves all validation types (ValidationError,PortRange,TimeoutPositive, etc.) intoconfig/validation_rules.go; removes the now-redundanttype ValidationError = rules.ValidationErroralias.Merge
tracing/holder.go(14 lines) intotracing/provider.go:CachedTracerand its method now live next toGetCachedOrGlobalwhich they delegate to.Merge
proxy/metadata.go(13 lines) intoproxy/handler.go:metadataPassthroughmap and helper co-located with their sole call site.