-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Corrupt JSON in codebases.commands silently returns empty object #967
Copy link
Copy link
Closed
Labels
P2Medium priority - Backlog, when time permitsMedium priority - Backlog, when time permitsarea: databaseDatabase operationsDatabase operationsarea: serverHTTP server (packages/server) - API routes, SSE, adaptersHTTP server (packages/server) - API routes, SSE, adaptersbugSomething is brokenSomething is brokeneffort/lowSingle file or function, one responsibility, isolated changeSingle file or function, one responsibility, isolated change
Metadata
Metadata
Assignees
Labels
P2Medium priority - Backlog, when time permitsMedium priority - Backlog, when time permitsarea: databaseDatabase operationsDatabase operationsarea: serverHTTP server (packages/server) - API routes, SSE, adaptersHTTP server (packages/server) - API routes, SSE, adaptersbugSomething is brokenSomething is brokeneffort/lowSingle file or function, one responsibility, isolated changeSingle file or function, one responsibility, isolated change
Context
Identified in backend architecture review.
Problem
When the
codebases.commandsJSON column contains corrupt data, it is silently returned as{}. The error is logged but never surfaced to the client, violating fail-fast principles.A client receiving
{}has no way to distinguish "no commands configured" from "commands exist but are unreadable."Location
packages/core/src/db/codebases.ts— JSON parse fallbackpackages/server/src/routes/api.ts— returns the silently-coerced resultSuggested approach
Surface the corruption to the caller — either throw an error or include a warning field in the API response indicating the stored commands could not be parsed.