Skip to content

Run Grape behind Falcon in CI - #3053

Open
ericproulx wants to merge 1 commit into
masterfrom
falcon_integration
Open

ericproulx wants to merge 1 commit into
masterfrom
falcon_integration

Conversation

@ericproulx

Copy link
Copy Markdown
Contributor

Summary

First step toward official Falcon support: a CI job that fails if Grape stops working behind a fiber server. A README section on running Grape under Falcon comes in a separate PR.

  • gemfiles/falcon.gemfile plus spec/integration/falcon, run on Ruby 3.3, 3.4 and 4.0. The file skips itself without Falcon (if: defined?(Falcon)), so the other jobs and edge.yml don't load it.
  • The specs start a real Falcon::Server in-process on a free port and send it requests with async-http's client:
    • Concurrency: 30 concurrent requests, which pause in a before filter, an after filter, a custom validator inside array elements and the route block. Each keeps its own params, endpoint instance variables and validation error index.
    • error! in a child task: inside an Async task the route waits on, error! responds with its status, with and without rescue_from :all (Raise from error! instead of throwing :error #3023).
    • Streaming: stream sends each chunk of an Enumerator before the endpoint produces the next. The producer waits for the client to have each chunk, so a buffered body gets no acknowledgements, and a timeout makes that a failure instead of a hang.

Mutation check

Break Failing spec
ParamScopeTracker on Thread#thread_variable_* instead of Fiber[] concurrency
One endpoint shared by every request (no @prototype.dup) concurrency
error! throwing :error instead of raising Halt both error! specs
Halt < Exception both error! specs
stream body read into an Array streaming

Not covered: cancellation

A client disconnect or a server stop doesn't cancel a running endpoint. async-http 0.105's HTTP/1 and HTTP/2 servers both run the app under defer_stop, so the endpoint runs to completion (verified over HTTP/1 for both cases). There's no cancellation to spec.

Test plan

  • bundle exec rake (RuboCop and the full suite) passes locally.
  • BUNDLE_GEMFILE=gemfiles/falcon.gemfile bundle exec rspec spec/integration/falcon passes on Ruby 3.3.12, 3.4.9 and 4.0.9, including with --enable=frozen-string-literal, and passed 12 runs in a row on 4.0.9.
  • CI green.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Danger Report

No issues found.

View run

@dblock

dblock commented Nov 3, 2026

Copy link
Copy Markdown
Member

Rather than putting this here, I think you should build something like grape-on-falcon, similar to https://github.com/ruby-grape/grape-on-rack, https://github.com/ruby-grape/grape-on-goliath and https://github.com/ruby-grape/grape-on-rails. We could have integration tests in grape proper, too, but then I'd add the entire spectrum of servers.

Add gemfiles/falcon.gemfile and spec/integration/falcon, run on Ruby
3.3, 3.4 and 4.0. The specs start a real Falcon server in-process on a
free port and send it requests with async-http's client:

- 30 concurrent requests, which pause in a before filter, an after
  filter, a custom validator inside array elements and the route block,
  each keep their own params, endpoint instance variables and
  validation error index.
- error! inside an Async task the route waits on responds with its
  status, with and without rescue_from :all (#3023).
- stream sends each chunk of an Enumerator before the endpoint produces
  the next.

Each spec fails under a matching break: a per-thread
ParamScopeTracker, one endpoint shared by every request, error!
throwing instead of raising, Halt as an Exception rather than a
StandardError, and a stream body read into an Array.

A client disconnect or a server stop doesn't cancel a running endpoint:
async-http's servers run the app under defer_stop, so there is no
cancellation to spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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