feat: refactor payload and headers into pure JSON#44
Merged
Conversation
Co-authored-by: GrantBirki <23362539+GrantBirki@users.noreply.github.com>
Co-authored-by: GrantBirki <23362539+GrantBirki@users.noreply.github.com>
Co-authored-by: GrantBirki <23362539+GrantBirki@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] feat: refactor
feat: refactor Jun 13, 2025
payload and headers into pure JSONpayload and headers into pure JSON
Contributor
There was a problem hiding this comment.
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_payloadandsymbolize_headersoptions 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/configfrom version control.
BUNDLE_PATH: "/home/runner/work/hooks/hooks/vendor/bundle"
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.
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_payloadandsymbolize_headersconfiguration options from default confignormalize_headersoption for consistent header formatting (lowercasing and trimming)API Processing Updates
Helper Method Updates
parse_payloadmethod to default tosymbolize: falseDocumentation Updates
docs/handler_plugins.mdto show string key examples instead of symbol keysconfigparameter 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.