Skip to content

Refactor dead helpers and trivial guard wrappers; consolidate session ID utility#7279

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/refactor-semantic-function-analysis
Draft

Refactor dead helpers and trivial guard wrappers; consolidate session ID utility#7279
Copilot wants to merge 3 commits into
mainfrom
copilot/refactor-semantic-function-analysis

Conversation

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Static analysis flagged dead production helpers in logger, no-op wrapper indirection in guard, and a single-function micro-file in server. This PR removes unused code paths and trims indirection without changing runtime behavior.

  • Logger cleanup (dead production code)

    • Removed extractEssentialFields from internal/logger/rpc_helpers.go (unused in prod and tests after refactor).
    • Removed internal/logger/log_cleanup.go and moved its message-normalization helper into test-only scope (internal/logger/log_cleanup_test.go).
    • Updated internal/logger/rpc_helpers_test.go to match test-only helper naming and removed obsolete extractEssentialFields tests.
  • Guard policy validation (wrapper inlining)

    • Removed trivial pass-through wrappers in internal/guard/wasm_validate.go:
      • validateStringArray(...)
      • isValidAllowOnlyRepos(...)
    • Replaced call sites in internal/guard/wasm_payload.go with direct config package calls.
    • Updated guard tests to call canonical config validators directly.
  • Server utility consolidation

    • Moved truncateSessionID into internal/server/session.go.
    • Deleted redundant single-function file internal/server/session_util.go.
// before
if err := validateStringArray("trusted-bots", trustedBotsRaw, true); err != nil { ... }
if !isValidAllowOnlyRepos(reposRaw) { ... }

// after
if err := config.ValidateStringArrayField("trusted-bots", trustedBotsRaw, true); err != nil { ... }
if !config.IsValidAllowOnlyReposValue(reposRaw) { ... }

Copilot AI linked an issue Jun 9, 2026 that may be closed by this pull request
6 tasks
GitHub Advanced Security started work on behalf of lpcox June 9, 2026 15:27 View session
GitHub Advanced Security finished work on behalf of lpcox June 9, 2026 15:28
GitHub Advanced Security started work on behalf of lpcox June 9, 2026 15:42 View session
GitHub Advanced Security finished work on behalf of lpcox June 9, 2026 15:43
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
Copilot finished work on behalf of lpcox June 9, 2026 15:43
Copilot AI requested a review from lpcox June 9, 2026 15:43
GitHub Advanced Security started work on behalf of lpcox June 9, 2026 15:45 View session
GitHub Advanced Security finished work on behalf of lpcox June 9, 2026 15:46
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: Dead Code and Trivial Wrappers

2 participants