Consistent Error Responses#48
Merged
Merged
Conversation
…Bubble up error messages
…hooks and handlers
…kEnvBuilder for building Rack environment and improve error response structure.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR ensures the env parameter is passed into all handler #call methods, introduces a RackEnvBuilder to centralize environment construction, and standardizes JSON error responses throughout the request lifecycle.
- Expanded handler signatures and updated all specs accordingly
- Added
Hooks::App::RackEnvBuilderand replaced inline env construction - Unified error response format with structured JSON bodies
Reviewed Changes
Copilot reviewed 62 out of 33 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| spec/unit/lib/hooks/handlers/default_spec.rb | Updated #call to include env and added env fixture |
| spec/unit/lib/hooks/handlers/base_spec.rb | Expanded #call signature in base handler tests |
| spec/unit/lib/hooks/core/plugin_loader_spec.rb | Added env arg to plugin loader handler invocations |
| spec/unit/lib/hooks/app/helpers_spec.rb | Added JSON parsing of error bodies and env arg |
| spec/unit/lib/hooks/app/helpers_security_spec.rb | Adjusted error message regex and env param |
| spec/unit/lib/hooks/app/auth/auth_security_spec.rb | Included request_context and env in auth tests |
| spec/unit/app/rack_env_builder_spec.rb | New spec for RackEnvBuilder |
| spec/integration/hooks_integration_spec.rb | Updated integration handler signature |
| spec/integration/global_lifecycle_hooks_spec.rb | Updated lifecycle handler signature |
| spec/acceptance/plugins/handlers/test_handler.rb | Added env to acceptance handler plugin |
| spec/acceptance/plugins/handlers/team1_handler.rb | Added env to team1 handler plugin |
| spec/acceptance/plugins/handlers/slack_handler.rb | Added env to Slack handler plugin |
| spec/acceptance/plugins/handlers/okta_setup_handler.rb | Logged env and added env arg |
| spec/acceptance/plugins/handlers/okta_handler.rb | Added env to Okta handler plugin |
| spec/acceptance/plugins/handlers/hello.rb | Added env to Hello handler plugin |
| spec/acceptance/plugins/handlers/github_handler.rb | Added env to GitHub handler plugin |
| spec/acceptance/plugins/handlers/boomtown.rb | Added env to Boomtown handler plugin |
| spec/acceptance/config/endpoints/does_not_exist.yml | New endpoint fixture for nonexistent handler |
| spec/acceptance/acceptance_tests.rb | Enhanced acceptance tests to validate JSON error bodies |
| lib/hooks/plugins/handlers/default.rb | Updated default handler signature and docs |
| lib/hooks/plugins/handlers/base.rb | Changed base #call signature |
| lib/hooks/app/rack_env_builder.rb | New builder class for Rack environment |
| lib/hooks/app/helpers.rb | Expanded enforce_request_limits and load_handler |
| lib/hooks/app/endpoints/catchall.rb | Switched to builder and standardized error format |
| lib/hooks/app/auth/auth.rb | Enhanced validate_auth! with structured errors |
| lib/hooks/app/api.rb | Replaced inline env build with RackEnvBuilder and unified error handling |
| docs/instrument_plugins.md | Updated handler signature example |
| docs/handler_plugins.md | Documented env parameter and usage |
| docs/design.md | Reflected new #call signature in design docs |
| README.md | Updated usage examples with env parameter |
| Gemfile | Added ostruct dependency for specs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.