Skip to content

Conversation

@lukgoph
Copy link
Contributor

@lukgoph lukgoph commented Nov 1, 2025

Summary

  • Scope: Issue API/CLI Error Handling Improvements #90 — API/CLI error handling improvements
  • Impact: Machine-readable errors in CLI and better router observability
  • Risk: Low; additive fields and logs only (no behavior change)

CLI (JSON error output)

  • In JSON mode, the error payload now includes code and suggestion in addition to existing success:false and error fields
  • code: produced via plugin.ErrorCode(err)
  • suggestion: produced via plugin.GetSuggestion(err)
  • Backward compatible: existing fields are preserved; schema is extended

Server/Router (observability)

  • When mounting plugin routes:
    • Correct type → info: "mounting plugin API routes"
    • Wrong type → warn: "PluginService type assertion failed … NOT mounted" + actual_type
    • Nil service → info: "PluginService not provided – skipping plugin API routes"

Tests

  • CLI: Added/updated tests to assert presence and correctness of code and suggestion across representative errors (NotFound, InvalidInput, Unavailable)
  • Router: Added tests for nil/wrong/correct PluginService types; assert route behavior and corresponding log messages

Validation

  • make test && make validate pass locally

Closes

@codecov
Copy link

codecov bot commented Nov 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@lukgoph lukgoph force-pushed the fix/cli-api-error-handling branch from 27b5b7b to 2f30527 Compare November 1, 2025 21:57
Copy link
Contributor

@weissarc weissarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. JSON error output gains code/suggestion (additive, backward-compatible). Router logs for PluginService mount are clear and tested. CI green; ready to merge.

@weissarc weissarc merged commit d981055 into pentora-ai:main Nov 1, 2025
8 checks passed
@lukgoph lukgoph deleted the fix/cli-api-error-handling branch November 1, 2025 22:02
@weissarc weissarc mentioned this pull request Nov 2, 2025
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants