diff --git a/internal/audit/models.go b/internal/audit/models.go index 5c7f014..a404810 100644 --- a/internal/audit/models.go +++ b/internal/audit/models.go @@ -214,7 +214,7 @@ func sanitizeMap(m map[string]any, depth int) any { } func sanitizeList(values []any, depth int) any { - out := make([]any, 0, minInt(len(values), MaxJSONItems)) + out := make([]any, 0, min(len(values), MaxJSONItems)) for i, item := range values { if i >= MaxJSONItems { out = append(out, TruncatedValue) @@ -225,13 +225,6 @@ func sanitizeList(values []any, depth int) any { return out } -func minInt(a, b int) int { - if a < b { - return a - } - return b -} - func truncateText(text string, maxChars int) string { if maxChars <= 0 { return "" diff --git a/internal/proxy/server.go b/internal/proxy/server.go index e84757b..edb3093 100644 --- a/internal/proxy/server.go +++ b/internal/proxy/server.go @@ -224,7 +224,6 @@ func (g *gateway) makeToolHandler(toolName string) mcp.ToolHandler { return func(ctx context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error) { started := time.Now() statusCode := int64(500) - upstreamCalled := false decision := defaultDecisionPayload() var responseJSON any = safeErrorPayload(int(statusCode), internalErrorMessage) @@ -292,7 +291,6 @@ func (g *gateway) makeToolHandler(toolName string) mcp.ToolHandler { decision["rate"] = rateDecision // Forward to upstream - upstreamCalled = true args := map[string]any{} if req.Params != nil && len(req.Params.Arguments) > 0 { _ = json.Unmarshal(req.Params.Arguments, &args) @@ -301,10 +299,7 @@ func (g *gateway) makeToolHandler(toolName string) mcp.ToolHandler { if err != nil { statusCode = 502 responseJSON = safeExceptionPayload(int(statusCode), err) - if upstreamCalled { - return nil, &jsonrpc.Error{Code: statusCode, Message: upstreamFailureMessage} - } - return nil, &jsonrpc.Error{Code: 500, Message: internalErrorMessage} + return nil, &jsonrpc.Error{Code: statusCode, Message: upstreamFailureMessage} } statusCode = 200 diff --git a/internal/ui/dashboard.go b/internal/ui/dashboard.go index 13b996a..4bb6189 100644 --- a/internal/ui/dashboard.go +++ b/internal/ui/dashboard.go @@ -302,8 +302,6 @@ func renderDashboardHTML(authCtx DashboardAuthContext, filters dashboardFilters, rows := "" for i, e := range events { decisionJSON, _ := json.Marshal(e.Decision) - requestJSON, _ := json.Marshal(e.Request) - responseJSON, _ := json.Marshal(e.Response) // Build detail object for row expansion detail := map[string]any{ @@ -329,9 +327,6 @@ func renderDashboardHTML(authCtx DashboardAuthContext, filters dashboardFilters, rowClass = "row-err" } - _ = requestJSON - _ = responseJSON - rows += fmt.Sprintf( `