Skip to content

Consistent Error Responses #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 16, 2025
Merged

Consistent Error Responses #48

merged 13 commits into from
Jun 16, 2025

Conversation

GrantBirki
Copy link
Member

No description provided.

@Copilot Copilot AI review requested due to automatic review settings June 16, 2025 18:18
Copilot

This comment was marked as outdated.

@GrantBirki GrantBirki requested a review from Copilot June 16, 2025 22:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

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::RackEnvBuilder and 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

@GrantBirki GrantBirki merged commit 334877f into main Jun 16, 2025
22 checks passed
@GrantBirki GrantBirki deleted the error-responses branch June 16, 2025 22:39
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