Typed error taxonomy for supervise RPC dispatch #275

Merged
didericis merged 1 commits from typed-rpc-error-taxonomy into main 2026-06-25 04:12:26 -04:00
Collaborator

Closes #253.

Summary

  • Introduces _RpcClientError and _RpcInternalError as typed subclasses of _RpcError, giving the dispatcher a formal vocabulary for bad-request vs server-fault conditions
  • All existing raise _RpcError(...) call sites in parse_jsonrpc, validate_proposed_file, handle_tools_call, and _dispatch converted to _RpcClientError
  • write_proposal and archive_proposal IO calls wrapped to catch OSError and re-raise as _RpcInternalError with the cause attached
  • do_POST dispatch error handling split into three explicit branches: client errors (returned verbatim, no logging), internal errors (logged at ERROR with cause, returns ERR_INTERNAL), and bare exceptions (logged as unexpected, returns ERR_INTERNAL)
  • 7 new tests covering the taxonomy hierarchy, cause preservation, IO-failure → _RpcInternalError escalation, and the HTTP-level ERR_INTERNAL response

Changed files: bot_bottle/supervise_server.py, tests/unit/test_supervise_server.py

Closes #253. ## Summary - Introduces `_RpcClientError` and `_RpcInternalError` as typed subclasses of `_RpcError`, giving the dispatcher a formal vocabulary for bad-request vs server-fault conditions - All existing `raise _RpcError(...)` call sites in `parse_jsonrpc`, `validate_proposed_file`, `handle_tools_call`, and `_dispatch` converted to `_RpcClientError` - `write_proposal` and `archive_proposal` IO calls wrapped to catch `OSError` and re-raise as `_RpcInternalError` with the cause attached - `do_POST` dispatch error handling split into three explicit branches: client errors (returned verbatim, no logging), internal errors (logged at ERROR with cause, returns `ERR_INTERNAL`), and bare exceptions (logged as unexpected, returns `ERR_INTERNAL`) - 7 new tests covering the taxonomy hierarchy, cause preservation, IO-failure → `_RpcInternalError` escalation, and the HTTP-level `ERR_INTERNAL` response Changed files: [`bot_bottle/supervise_server.py`](https://gitea.dideric.is/didericis/bot-bottle/src/commit/10fd5c961e9d9d148cfad1d9d2d7e72f7744add5/bot_bottle/supervise_server.py), [`tests/unit/test_supervise_server.py`](https://gitea.dideric.is/didericis/bot-bottle/src/commit/10fd5c961e9d9d148cfad1d9d2d7e72f7744add5/tests/unit/test_supervise_server.py)
didericis added 1 commit 2026-06-25 04:02:41 -04:00
feat(supervise): typed RPC error taxonomy for dispatch
test / unit (pull_request) Successful in 31s
test / integration (pull_request) Successful in 17s
lint / lint (push) Successful in 1m48s
test / unit (push) Successful in 32s
test / integration (push) Successful in 18s
Update Quality Badges / update-badges (push) Successful in 1m20s
d99dba037c
Introduce _RpcClientError and _RpcInternalError as distinct subclasses
of _RpcError so the dispatcher can handle bad requests and server-side
faults differently — returning client errors verbatim and logging
internal faults with their cause before replying ERR_INTERNAL.

Wrap write_proposal and archive_proposal IO with _RpcInternalError
so OS failures surface through the typed path instead of the bare
Exception fallback. All existing raise _RpcError(...) call sites
converted to _RpcClientError.

Closes #253
didericis force-pushed typed-rpc-error-taxonomy from 10fd5c961e to d99dba037c 2026-06-25 04:02:41 -04:00 Compare
didericis merged commit d99dba037c into main 2026-06-25 04:12:26 -04:00
didericis deleted branch typed-rpc-error-taxonomy 2026-06-25 04:12:26 -04:00
Sign in to join this conversation.