Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions internal/audit/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 ""
Expand Down
7 changes: 1 addition & 6 deletions internal/proxy/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
19 changes: 6 additions & 13 deletions internal/ui/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -329,9 +327,6 @@ func renderDashboardHTML(authCtx DashboardAuthContext, filters dashboardFilters,
rowClass = "row-err"
}

_ = requestJSON
_ = responseJSON

rows += fmt.Sprintf(
`<tr class="%s" data-idx="%d" data-ts="%s" data-status="%d" data-latency="%d" data-key="%s" data-role="%s" data-method="%s" data-tool="%s">`+
`<td class="ts">%s</td>`+
Expand Down Expand Up @@ -402,14 +397,12 @@ func deref(v *string) string {

// displayRole formats internal role names for human display.
func displayRole(role string) string {
switch strings.ToLower(strings.TrimSpace(role)) {
case "readonly":
cleaned := strings.ToLower(strings.TrimSpace(role))
if cleaned == "" {
return ""
}
if cleaned == "readonly" {
return "Read-only"
default:
if role == "" {
return ""
}
// Capitalize first letter
return strings.ToUpper(role[:1]) + role[1:]
}
return strings.ToUpper(cleaned[:1]) + cleaned[1:]
}
Loading