• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ruby-grape / grape / 33755485219
97%

Build:
DEFAULT BRANCH: master
Ran 03 Sep 2026 12:29PM UTC
Jobs 32
Files 169
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Sep 2026 12:29PM UTC coverage: 96.948% (-0.02%) from 96.965%
33755485219

push

github

web-flow
Resolve an API instance's cascade setting once instead of per request (#2888)

`Grape::API::Instance#call` asks whether the API cascades on the way out of
every request:

    def call(env)
      status, headers, response = @router.call(env)
      unless cascade?
        ...

and `cascade?` answers it by walking the settings:

    def cascade?
      setting = self.class.inheritable_setting
      return setting.cascade if setting.cascade_defined?
      return setting.version_options.cascade if setting.version_options

      true
    end

`cascade_defined?` and `version_options` each resolve through
`InheritableSetting`, which walks the scope chain until a scope has the key —
so a request pays for two full walks of it, and the deeper the API nests the
more they cost.

The answer cannot change while the instance is alive. It is read off the same
`inheritable_setting` the routes were built from, and `#initialize` has already
compiled and frozen the router against it; a settings change has to go through
`change!`, which drops the instance so the next request compiles a new one.
So resolve it in the constructor, next to the router it is consistent with.

On an API with a prefix, path versioning and three nested namespaces:

    resolve per request  323.5 ns  ->  memoized reader  41.0 ns   7.90x

End to end, a minimal versioned GET (`Benchmark.ips`, median of 5 interleaved
runs against master, Ruby 4.0.5): **+4.0%** bare, **+8.4%** with params and
validations.

`cascade?` keeps its name and its meaning — it is public and grape-swagger
reads it — it just reports what was resolved rather than resolving again.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

1238 of 1332 branches covered (92.94%)

Branch coverage included in aggregate %.

7 of 8 new or added lines in 1 file covered. (87.5%)

3939 of 4008 relevant lines covered (98.28%)

27052.37 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
99.05
-0.95% lib/grape/api/instance.rb
Jobs
ID Job ID Ran Files Coverage
1 run-4.0-gemfiles/rails_7_2.gemfile - 33755485219.1 03 Sep 2026 12:30PM UTC 169
95.71
GitHub Action Run
2 run-4.0-gemfiles/rack_3_2.gemfile - 33755485219.2 03 Sep 2026 12:29PM UTC 168
95.71
GitHub Action Run
3 run-4.0-gemfiles/multi_xml_0_8.gemfile - 33755485219.3 03 Sep 2026 12:29PM UTC 168
47.04
GitHub Action Run
4 run-4.0-gemfiles/rack_2_2.gemfile - 33755485219.4 03 Sep 2026 12:29PM UTC 168
95.67
GitHub Action Run
5 run-3.4-gemfiles/rails_8_1.gemfile - 33755485219.5 03 Sep 2026 12:29PM UTC 169
95.71
GitHub Action Run
6 run-4.0-gemfiles/hashie.gemfile - 33755485219.6 03 Sep 2026 12:29PM UTC 168
61.85
GitHub Action Run
7 run-3.4-gemfiles/rack_3_2.gemfile - 33755485219.7 03 Sep 2026 12:29PM UTC 168
95.71
GitHub Action Run
8 run-3.3-Gemfile - 33755485219.8 03 Sep 2026 12:29PM UTC 168
95.71
GitHub Action Run
9 run-3.4-gemfiles/rack_3_1.gemfile - 33755485219.9 03 Sep 2026 12:29PM UTC 168
95.71
GitHub Action Run
10 run-4.0-gemfiles/rails_8_0.gemfile - 33755485219.10 03 Sep 2026 12:29PM UTC 169
95.71
GitHub Action Run
11 run-3.4-gemfiles/rack_2_2.gemfile - 33755485219.11 03 Sep 2026 12:30PM UTC 168
95.67
GitHub Action Run
12 run-4.0-Gemfile - 33755485219.12 03 Sep 2026 12:29PM UTC 168
95.71
GitHub Action Run
13 run-3.3-gemfiles/rails_8_0.gemfile - 33755485219.13 03 Sep 2026 12:29PM UTC 169
95.71
GitHub Action Run
14 run-3.4-gemfiles/rails_8_0.gemfile - 33755485219.14 03 Sep 2026 12:29PM UTC 169
95.71
GitHub Action Run
15 run-4.0-gemfiles/multi_xml.gemfile - 33755485219.15 03 Sep 2026 12:29PM UTC 168
47.0
GitHub Action Run
16 run-4.0-gemfiles/dry_validation.gemfile - 33755485219.16 03 Sep 2026 12:29PM UTC 168
57.84
GitHub Action Run
17 run-4.0-gemfiles/grape_entity.gemfile - 33755485219.17 03 Sep 2026 12:29PM UTC 168
50.41
GitHub Action Run
18 run-3.3-gemfiles/rack_3_2.gemfile - 33755485219.18 03 Sep 2026 12:29PM UTC 168
95.71
GitHub Action Run
19 run-4.0-gemfiles/rails_8_1.gemfile - 33755485219.19 03 Sep 2026 12:29PM UTC 169
95.71
GitHub Action Run
20 run-3.3-gemfiles/rails_7_2.gemfile - 33755485219.20 03 Sep 2026 12:29PM UTC 169
95.71
GitHub Action Run
21 run-3.3-gemfiles/rails_8_1.gemfile - 33755485219.21 03 Sep 2026 12:29PM UTC 169
95.71
GitHub Action Run
22 run-3.4-gemfiles/rails_7_2.gemfile - 33755485219.22 03 Sep 2026 12:29PM UTC 169
95.71
GitHub Action Run
23 run-3.4-gemfiles/rack_3_0.gemfile - 33755485219.23 03 Sep 2026 12:29PM UTC 168
95.71
GitHub Action Run
24 run-3.3-gemfiles/rack_2_2.gemfile - 33755485219.24 03 Sep 2026 12:29PM UTC 168
95.67
GitHub Action Run
25 run-3.3-gemfiles/rack_3_1.gemfile - 33755485219.25 03 Sep 2026 12:30PM UTC 168
95.71
GitHub Action Run
26 run-4.0-gemfiles/rack_3_1.gemfile - 33755485219.26 03 Sep 2026 12:29PM UTC 168
95.71
GitHub Action Run
27 run-4.0-gemfiles/grape_swagger.gemfile - 33755485219.27 03 Sep 2026 12:29PM UTC 168
55.29
GitHub Action Run
28 run-3.4-Gemfile - 33755485219.28 03 Sep 2026 12:29PM UTC 168
95.71
GitHub Action Run
29 run-4.0-gemfiles/multi_json_1_20.gemfile - 33755485219.29 03 Sep 2026 12:29PM UTC 168
47.58
GitHub Action Run
30 run-3.3-gemfiles/rack_3_0.gemfile - 33755485219.30 03 Sep 2026 12:29PM UTC 168
95.71
GitHub Action Run
31 run-4.0-gemfiles/multi_json.gemfile - 33755485219.31 03 Sep 2026 12:29PM UTC 168
47.54
GitHub Action Run
32 run-4.0-gemfiles/rack_3_0.gemfile - 33755485219.32 03 Sep 2026 12:29PM UTC 168
95.71
GitHub Action Run
Source Files on build 33755485219
  • Tree
  • List 169
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #33755485219
  • 3ff48628 on github
  • Prev Build on master (#33728651997)
  • Next Build on master (#33768866081)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc