Skip to content

Refactor WASM guard detection placement and inline config validation log wrappers#5774

Merged
lpcox merged 2 commits into
mainfrom
copilot/refactor-semantic-function-clustering
May 15, 2026
Merged

Refactor WASM guard detection placement and inline config validation log wrappers#5774
lpcox merged 2 commits into
mainfrom
copilot/refactor-semantic-function-clustering

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

Semantic clustering surfaced two low-risk refactors: WASM guard auto-detection lived in cmd/proxy.go instead of the WASM cache module, and config/validation.go used one-line private logging wrappers that obscured validation flow. This PR tightens cohesion in internal/cmd and simplifies config validation control flow without behavior changes.

  • WASM setup cohesion (internal/cmd)

    • Moved containerGuardWasmPath and detectGuardWasm() from internal/cmd/proxy.go to internal/cmd/wasm_cache.go.
    • Kept newProxyCmd() behavior unchanged (defaultGuard := detectGuardWasm()), but colocated guard-path detection with other WASM cache/bootstrap logic.
  • Validation flow simplification (internal/config)

    • Removed private wrappers:
      • logValidateServerStart
      • logValidateServerPassed
      • logValidateServerFailed
    • Inlined equivalent logValidation.Printf(...) calls at usage sites in server/auth/containerization validation paths to make control flow directly readable.
  • Illustrative change

    // before
    logValidateServerFailed(name, server.Type, "HTTP server missing url field")
    
    // after
    logValidation.Printf("Validation failed: %s, name=%s, type=%s",
        "HTTP server missing url field", name, server.Type)

Copilot AI changed the title [WIP] Refactor semantic function clustering analysis with targeted improvements Refactor WASM guard detection placement and inline config validation log wrappers May 15, 2026
Copilot finished work on behalf of lpcox May 15, 2026 22:54
Copilot AI requested a review from lpcox May 15, 2026 22:54
@lpcox lpcox marked this pull request as ready for review May 15, 2026 23:13
Copilot AI review requested due to automatic review settings May 15, 2026 23:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR performs low-risk refactoring to improve cohesion around WASM guard detection and simplify config validation logging without changing validation behavior.

Changes:

  • Moved baked-in WASM guard path detection from proxy command code into the WASM cache module.
  • Removed private validation log wrapper helpers and inlined equivalent logValidation.Printf calls.
  • Kept proxy command guard defaulting behavior intact via detectGuardWasm().
Show a summary per file
File Description
internal/cmd/wasm_cache.go Adds colocated baked-in guard path constant and detection helper.
internal/cmd/proxy.go Removes guard detection helper now provided by the WASM cache module.
internal/config/validation.go Inlines validation logging calls and removes wrapper helpers.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0

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 — 3 Targeted Refactoring Opportunities

3 participants