-
Notifications
You must be signed in to change notification settings - Fork 0
feat: refactor payload
and headers
into pure JSON
#44
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
Conversation
Co-authored-by: GrantBirki <[email protected]>
Co-authored-by: GrantBirki <[email protected]>
Co-authored-by: GrantBirki <[email protected]>
payload
and headers
into pure JSONpayload
and headers
into pure JSON
There was a problem hiding this 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 refactors payload and headers handling to use pure JSON with string keys, removing symbolization options and simplifying normalization.
- Removed
symbolize_payload
andsymbolize_headers
options from configuration and validation - Updated parsing logic and API to default to string-key hashes for payloads and headers
- Revised tests and documentation to align with the new JSON-centric approach
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
spec/unit/lib/hooks/core/config_validator_spec.rb | Removed tests related to symbolization options |
spec/unit/lib/hooks/core/config_loader_spec.rb | Updated loader specs to focus on normalize_headers only |
spec/unit/lib/hooks/app/helpers_spec.rb | Changed expectations to string-key hashes |
spec/integration/header_symbolization_spec.rb | Adjusted integration tests for header normalization |
spec/acceptance/plugins/handlers/team1_handler.rb | Updated handler example to use string-key access |
lib/hooks/core/config_validator.rb | Removed symbolization schema entries |
lib/hooks/core/config_loader.rb | Removed default symbolization configs |
lib/hooks/app/helpers.rb | Updated parse_payload signature and docs |
lib/hooks/app/api.rb | Passed symbolize: false and adjusted header logic |
docs/handler_plugins.md | Revised docs to show string-key JSON examples |
.bundle/config | Updated Bundler paths and deployment settings |
Comments suppressed due to low confidence (3)
spec/unit/lib/hooks/core/config_loader_spec.rb:370
- [nitpick] The test description is vague; consider renaming it to "allows disabling normalize_headers via environment variable" for clarity.
it "allows environment variable setup" do
spec/integration/header_symbolization_spec.rb:1
- [nitpick] The file name still references symbolization but tests normalization only. Consider renaming it to header_normalization_spec.rb to match its content.
spec/integration/header_symbolization_spec.rb
.bundle/config:3
- Committing environment-specific absolute paths can cause unwanted diffs; revert to a relative project path or exclude
.bundle/config
from version control.
BUNDLE_PATH: "/home/runner/work/hooks/hooks/vendor/bundle"
This PR refactors the webhook payload and headers handling to use pure JSON structures with string keys, removing the symbolization options that were causing complexity and inconsistency.
Changes Made
Configuration Changes
symbolize_payload
andsymbolize_headers
configuration options from default confignormalize_headers
option for consistent header formatting (lowercasing and trimming)API Processing Updates
Helper Method Updates
parse_payload
method to default tosymbolize: false
Documentation Updates
docs/handler_plugins.md
to show string key examples instead of symbol keysconfig
parameter remains symbolized as it's controlled by the frameworkTest Updates
Examples
Before (symbolized):
After (pure JSON):
Benefits
All tests pass including unit, integration, and acceptance tests. The changes maintain backward compatibility while providing a cleaner, more predictable API.
Fixes #43.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.