Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the integrations response helpers to separate “what status code to return” from “how to render the response”, enabling integrations to override response status codes more easily (supports the “Cloudflare Blocking Improvements” goal by making status behavior more configurable per integration).
Changes:
- Add
adapter_response_*_codemethods to the baseIntegrationand haveadapter_response_*delegate to them. - Update
Form::V3to use*_codemethods when rendering structured JSON error responses. - Update
ElastAlert::V3to override only*_codemethods (returning:ok) while inheriting the basehead(...)responders.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/models/pager_tree/integrations/integration.rb | Introduces adapter_response_*_code hooks and delegates base response helpers to them. |
| app/models/pager_tree/integrations/form/v3.rb | Switches JSON-rendered responses to use the new *_code helpers for status + numeric code. |
| app/models/pager_tree/integrations/elast_alert/v3.rb | Converts responder overrides into status-code-only overrides (all :ok) to avoid ElastAlert retries. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def adapter_response_rate_limit | ||
| adapter_controller&.head(:too_many_requests) | ||
| adapter_controller&.head(adapter_response_rate_limit_code) | ||
| end | ||
|
|
||
| def adapter_response_rate_limit_code | ||
| :too_many_requests | ||
| end |
There was a problem hiding this comment.
New public interface methods adapter_response_*_code are introduced/relied on by the base response helpers, but the existing integration interface tests only assert the presence of adapter_response_* methods. Please add/update tests to cover these new *_code methods (at least respond_to? assertions in the shared Integrateable interface test), so future integrations/changes don’t accidentally drop or rename them.
No description provided.