Skip to content

Add comprehensive input validation and error handling#61

Merged
chrislupp merged 2 commits intodevelopfrom
feature/error_handling
Apr 9, 2026
Merged

Add comprehensive input validation and error handling#61
chrislupp merged 2 commits intodevelopfrom
feature/error_handling

Conversation

@chrislupp
Copy link
Copy Markdown
Collaborator

@chrislupp chrislupp commented Apr 9, 2026

Summary

  • Introduces custom exception classes (PhiloteValidationError, PhiloteServerError) with backward-compatible inheritance from ValueError and RuntimeError
  • Adds parameter validation to all discipline base class methods (add_input, add_output, add_option, declare_partials, etc.) checking types, shapes, units, and duplicates
  • Wraps all gRPC server RPC methods with try/except and context.abort() using appropriate status codes (INVALID_ARGUMENT, INTERNAL) so clients get clear error messages instead of opaque UNKNOWN errors
  • Adds client-side input validation and wraps grpc.RpcError into PhiloteServerError for actionable error messages
  • Adds validation to OpenMDAO bindings (OpenMdaoSubProblem, RemoteExplicitComponent, RemoteImplicitComponent), utility functions (get_chunk_indices, get_flattened_view, PairDict), and the declare_options helper
  • Fixes missing space in RemoteImplicitComponent error message ("will notbe" -> "will not be")

Closes #46

Test plan

  • All 240 tests pass (up from ~190, 50 new validation tests added)
  • Coverage at 97.10% (above 95% threshold)
  • All existing tests continue to pass unchanged (backward-compatible exception hierarchy)
  • Verify integration tests pass in CI across Python 3.9-3.12

Introduce custom exception classes (PhiloteValidationError, PhiloteServerError),
parameter validation in discipline base classes, gRPC error propagation via
context.abort() in all server RPC methods, and client-side input validation
with gRPC error wrapping. Fix missing space in RemoteImplicitComponent error
message.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chrislupp chrislupp self-assigned this Apr 9, 2026
@chrislupp chrislupp added the enhancement New feature or request label Apr 9, 2026
@chrislupp chrislupp added this to the Version 0.8.0 milestone Apr 9, 2026
Cover all previously uncovered error handling paths: PhiloteValidationError
and general Exception branches in server RPC methods, gRPC error wrapping
in all client methods, and num_par_fd validation in OpenMDAO components.
@chrislupp chrislupp merged commit ebb03ff into develop Apr 9, 2026
8 checks passed
@chrislupp chrislupp deleted the feature/error_handling branch April 9, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant