Refactor dead helpers and trivial guard wrappers; consolidate session ID utility#7279
Open
Copilot wants to merge 3 commits into
Open
Refactor dead helpers and trivial guard wrappers; consolidate session ID utility#7279Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
6 tasks
Copilot
AI
changed the title
[WIP] Refactor semantic function clustering analysis for dead code and wrappers
Refactor dead helpers and trivial guard wrappers; consolidate session ID utility
Jun 9, 2026
This was referenced Jun 10, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes unused helpers and trims trivial wrapper indirection, keeping behavior the same while reducing dead code and consolidating small utilities across logger, guard, and server.
Changes:
- Consolidated
truncateSessionIDintointernal/server/session.goand removed the redundant single-function file. - Removed dead/unused logger helper code (
extractEssentialFields) and moved log cleanup normalization into test-only scope, updating tests accordingly. - Inlined trivial guard validation wrappers by calling canonical
internal/configvalidators directly, updating call sites and tests.
Show a summary per file
| File | Description |
|---|---|
| internal/server/session.go | Adds truncateSessionID implementation directly to the main session module and imports strutil. |
| internal/server/session_util.go | Removes redundant file that only contained truncateSessionID. |
| internal/logger/rpc_helpers.go | Deletes unused extractEssentialFields and drops now-unneeded encoding/json import. |
| internal/logger/rpc_helpers_test.go | Updates tests/benchmarks to use the test-only error-message extractor and removes obsolete tests. |
| internal/logger/log_cleanup_test.go | Renames the log cleanup helper into explicit test-only naming (testExtractErrorMessage). |
| internal/guard/wasm_validate.go | Removes no-op wrapper functions around config validators. |
| internal/guard/wasm_validate_test.go | Updates tests to call config.ValidateStringArrayField directly. |
| internal/guard/wasm_payload.go | Replaces wrapper calls with direct config validator calls at payload-build time. |
| internal/guard/guard_test.go | Updates repos validation test to call config.IsValidAllowOnlyReposValue directly. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 9/9 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.
Static analysis flagged dead production helpers in
logger, no-op wrapper indirection inguard, and a single-function micro-file inserver. This PR removes unused code paths and trims indirection without changing runtime behavior.Logger cleanup (dead production code)
extractEssentialFieldsfrominternal/logger/rpc_helpers.go(unused in prod and tests after refactor).internal/logger/log_cleanup.goand moved its message-normalization helper into test-only scope (internal/logger/log_cleanup_test.go).internal/logger/rpc_helpers_test.goto match test-only helper naming and removed obsoleteextractEssentialFieldstests.Guard policy validation (wrapper inlining)
internal/guard/wasm_validate.go:validateStringArray(...)isValidAllowOnlyRepos(...)internal/guard/wasm_payload.gowith directconfigpackage calls.configvalidators directly.Server utility consolidation
truncateSessionIDintointernal/server/session.go.internal/server/session_util.go.