Skip to content

Cloudflare Blocking Improvements#152

Merged
armiiller merged 1 commit intomainfrom
feat-cf-blocking
Apr 7, 2026
Merged

Cloudflare Blocking Improvements#152
armiiller merged 1 commit intomainfrom
feat-cf-blocking

Conversation

@armiiller
Copy link
Copy Markdown
Collaborator

No description provided.

@armiiller armiiller requested a review from Copilot April 3, 2026 17:19
Copy link
Copy Markdown

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

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_*_code methods to the base Integration and have adapter_response_* delegate to them.
  • Update Form::V3 to use *_code methods when rendering structured JSON error responses.
  • Update ElastAlert::V3 to override only *_code methods (returning :ok) while inheriting the base head(...) 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.

Comment on lines 119 to 125
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
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@armiiller armiiller merged commit 6bf4d15 into main Apr 7, 2026
6 checks passed
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.

2 participants