You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Analysis of commit ac8733a — "Refactor SendRequestWithServerID to use a single inbound response logging path"
Summary
Analysis of the codebase following the recent SendRequestWithServerID refactor (which resolved the duplication that motivated it) reveals 3 remaining significant duplication patterns across internal/guard/wasm.go, internal/server/guard_init.go, and internal/server/tool_registry.go.
Analysis of commit ac8733a — "Refactor SendRequestWithServerID to use a single inbound response logging path"
Summary
Analysis of the codebase following the recent
SendRequestWithServerIDrefactor (which resolved the duplication that motivated it) reveals 3 remaining significant duplication patterns acrossinternal/guard/wasm.go,internal/server/guard_init.go, andinternal/server/tool_registry.go.Detected Patterns
Marshal-for-debug-logging block — Severity: Medium — See [duplicate-code] Duplicate Code Pattern: Marshal-for-debug-logging block in guard/wasm.go and server/guard_init.go #4076
Identical 5-line marshal + conditional log block repeated 3× across two files.
Sys tool handler structural duplication — Severity: Medium — See [duplicate-code] Duplicate Code Pattern: Sys tool handler call-and-log skeleton in tool_registry.go #4077
sysInitHandlerandsysListHandlerinregisterSysTools()copy the same call → error-handle → marshal → log → return skeleton. Adding a third sys tool requires another copy-paste.Missing result sanitization in
sysListHandler— Severity: High — See [duplicate-code] Duplicate Code Pattern: Missing result sanitization in sysListHandler (copy-paste divergence) #4078Direct consequence of Pattern 2:
sysListHandleromitssanitize.SanitizeStringwhen logging the JSON result, diverging fromsysInitHandlerand the backend tool handler and creating a potential secret-leak risk in log output.Overall Impact
internal/guard/wasm.go,internal/server/guard_init.go,internal/server/tool_registry.goNext Steps
sysListHandler(Pattern 3) — low-risk, one-line changelogMarshaledForDebughelper to consolidate Pattern 1Analysis Metadata
internal/guard/wasm.go,internal/server/guard_init.go,internal/server/tool_registry.go(and broad survey of non-test Go sources)ac8733aff67ad6e95c4fef045c8cac6fbcdb9b65