Skip to content

fix: surface swallowed errors across storage and MCP layers#18

Merged
josephgoksu merged 1 commit intomainfrom
fix/surface-silent-errors
Feb 25, 2026
Merged

fix: surface swallowed errors across storage and MCP layers#18
josephgoksu merged 1 commit intomainfrom
fix/surface-silent-errors

Conversation

@josephgoksu
Copy link
Owner

Summary

  • task_store.go: Log corrupt JSON fields during scan instead of silently returning zero values. Covers 7 task fields, 3 clarify session fields, and 4 draft_state unmarshal sites.
  • sqlite.go: Replace _, _ = db.Exec(ALTER TABLE ...) migration pattern with proper column-existence checks via pragma_table_info. Real DDL errors now get logged.
  • policy/audit.go: Log corrupt input_json in both scanDecision and scanDecisionRows instead of silently dropping it.
  • mcp/handlers.go: Log GetProjectRoot failures in explain and simplify handlers instead of silently using an empty base path.

Test plan

  • go build ./... compiles
  • make test-quick passes
  • Verify via --verbose that corrupt JSON in DB now produces warning logs

- task_store: log corrupt JSON instead of silently discarding (7 scan
  fields + 3 clarify session fields + 4 draft_state unmarshal sites)
- sqlite: replace blind _, _ migration pattern with column-existence
  checks so real ALTER TABLE errors get logged
- policy/audit: log corrupt input JSON in both scan methods
- mcp/handlers: log GetProjectRoot failures in explain and simplify
  handlers instead of silently using empty base path
@greptile-apps
Copy link

greptile-apps bot commented Feb 25, 2026

Greptile Summary

Replaced silent error swallowing with proper error logging across storage and MCP layers. Previously, JSON unmarshal failures, DDL migration errors, and GetProjectRoot failures were silently ignored, making debugging difficult.

Key improvements:

  • task_store.go: 14 JSON unmarshal sites now log warnings instead of silently returning zero values
  • sqlite.go: Migration logic now checks column existence via pragma_table_info before executing DDL, logging real errors
  • policy/audit.go: Corrupt input_json fields now logged in both scan functions
  • mcp/handlers.go: GetProjectRoot failures now logged in explain and simplify handlers

All changes follow Go error handling best practices by logging at appropriate levels (slog.Warn for data corruption, slog.Debug for expected failures) while preserving backward compatibility.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Changes are purely additive (error logging only), don't alter control flow or return values, follow Go conventions with appropriate log levels, and improve observability without breaking existing behavior
  • No files require special attention

Important Files Changed

Filename Overview
internal/mcp/handlers.go Logs GetProjectRoot errors instead of silently ignoring them in explain and simplify handlers
internal/memory/sqlite.go Replaced blind migration pattern with proper column-existence checks via pragma_table_info
internal/memory/task_store.go Added error logging for 14 JSON unmarshal sites across tasks, plans, and clarify sessions
internal/policy/audit.go Logs corrupt input_json in both scan functions instead of silently dropping it

Last reviewed commit: 010280b

@josephgoksu josephgoksu merged commit 3aa1197 into main Feb 25, 2026
9 checks passed
@josephgoksu josephgoksu deleted the fix/surface-silent-errors branch February 25, 2026 08:44
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.

1 participant