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

ruby-grape / grape / 24629943149
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: perf/build-headers-each-header
DEFAULT BRANCH: master
Ran 19 Apr 2026 01:13PM UTC
Jobs 37
Files 153
Run time 1min
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

19 Apr 2026 01:13PM UTC coverage: 96.894% (-0.01%) from 96.907%
24629943149

Pull #2686

github

ericproulx
Precompute middleware content-type caches on the parent instance

Grape::Middleware::Base#call does dup.call!(env) per request, so the
+||=+ memoization on content_types / mime_types / content_types_indifferent_access
lived on the per-request dup — it was computed fresh every request.

This change:

- Adds a protected +precompute_content_types!+ helper on +Middleware::Base+
  that populates the three ivars on the parent instance at initialization
  time. Per-request dups then inherit the cached values via +dup+'s ivar
  copy instead of recomputing +with_indifferent_access+ (~1 µs each).
- Has +Middleware::Error+, +Middleware::Formatter+, and
  +Middleware::Versioner::Base+ call it from their +initialize+ (after
  +super+). Versioner::Base additionally warms +available_media_types+.
- Short-circuits +Middleware::Base#merge_headers+ when no headers were
  set, avoiding both the lazy +Grape::Util::Header.new+ allocation and
  an empty +merge!+ against the response.

No behavior change. Only middlewares that actually read content_types
opt into the warmup — plain +Middleware::Base+ subclasses still pay
nothing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request #2686: Precompute middleware content-type caches on the parent instance

1070 of 1158 branches covered (92.4%)

Branch coverage included in aggregate %.

17 of 18 new or added lines in 4 files covered. (94.44%)

7 existing lines in 3 files now uncovered.

3360 of 3414 relevant lines covered (98.42%)

33337.24 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
93.33
-0.95% lib/grape/middleware/base.rb

Coverage Regressions

Lines Coverage ∆ File
4
93.27
0.2% lib/grape/middleware/error.rb
2
93.33
-0.95% lib/grape/middleware/base.rb
1
97.48
0.07% lib/grape/middleware/formatter.rb
Jobs
ID Job ID Ran Files Coverage
1 run-3.2-gemfiles/rails_7_2.gemfile - 24629943149.1 19 Apr 2026 01:13PM UTC 153
95.6
GitHub Action Run
2 run-3.3-gemfiles/rack_3_2.gemfile - 24629943149.2 19 Apr 2026 01:13PM UTC 152
95.55
GitHub Action Run
3 run-3.4-gemfiles/rack_3_1.gemfile - 24629943149.3 19 Apr 2026 01:14PM UTC 152
95.57
GitHub Action Run
4 run-3.4-Gemfile - 24629943149.4 19 Apr 2026 01:13PM UTC 152
95.57
GitHub Action Run
5 run-3.4-gemfiles/rack_3_0.gemfile - 24629943149.5 19 Apr 2026 01:14PM UTC 152
95.57
GitHub Action Run
6 run-3.2-gemfiles/rack_3_1.gemfile - 24629943149.6 19 Apr 2026 01:13PM UTC 152
95.6
GitHub Action Run
7 run-4.0-gemfiles/rack_3_1.gemfile - 24629943149.7 19 Apr 2026 01:14PM UTC 152
95.57
GitHub Action Run
8 run-3.4-gemfiles/rails_8_0.gemfile - 24629943149.8 19 Apr 2026 01:14PM UTC 153
95.58
GitHub Action Run
9 run-3.2-gemfiles/rack_3_0.gemfile - 24629943149.9 19 Apr 2026 01:13PM UTC 152
95.6
GitHub Action Run
10 run-3.3-gemfiles/rack_3_1.gemfile - 24629943149.10 19 Apr 2026 01:13PM UTC 152
95.55
GitHub Action Run
11 run-3.2-gemfiles/rack_3_2.gemfile - 24629943149.11 19 Apr 2026 01:13PM UTC 152
95.6
GitHub Action Run
12 run-3.2-Gemfile - 24629943149.12 19 Apr 2026 01:13PM UTC 152
95.6
GitHub Action Run
13 run-4.0-gemfiles/rack_3_0.gemfile - 24629943149.13 19 Apr 2026 01:13PM UTC 152
95.57
GitHub Action Run
14 run-4.0-gemfiles/hashie.gemfile - 24629943149.14 19 Apr 2026 01:13PM UTC 152
62.33
GitHub Action Run
15 run-4.0-gemfiles/rails_8_0.gemfile - 24629943149.15 19 Apr 2026 01:14PM UTC 153
95.58
GitHub Action Run
16 run-4.0-gemfiles/rails_7_2.gemfile - 24629943149.16 19 Apr 2026 01:14PM UTC 153
95.58
GitHub Action Run
17 run-3.2-gemfiles/rails_8_1.gemfile - 24629943149.17 19 Apr 2026 01:13PM UTC 153
95.6
GitHub Action Run
18 run-4.0-gemfiles/rails_8_1.gemfile - 24629943149.18 19 Apr 2026 01:13PM UTC 153
95.58
GitHub Action Run
19 run-3.3-gemfiles/rails_8_0.gemfile - 24629943149.19 19 Apr 2026 01:14PM UTC 153
95.55
GitHub Action Run
20 run-3.2-gemfiles/rails_8_0.gemfile - 24629943149.20 19 Apr 2026 01:13PM UTC 153
95.6
GitHub Action Run
21 run-3.3-gemfiles/rails_7_2.gemfile - 24629943149.21 19 Apr 2026 01:14PM UTC 153
95.55
GitHub Action Run
22 run-3.2-gemfiles/rack_2_2.gemfile - 24629943149.22 19 Apr 2026 01:14PM UTC 152
95.55
GitHub Action Run
23 run-3.3-gemfiles/rails_8_1.gemfile - 24629943149.23 19 Apr 2026 01:14PM UTC 153
95.55
GitHub Action Run
24 run-3.4-gemfiles/rails_8_1.gemfile - 24629943149.24 19 Apr 2026 01:14PM UTC 153
95.58
GitHub Action Run
25 run-4.0-gemfiles/rack_2_2.gemfile - 24629943149.25 19 Apr 2026 01:14PM UTC 152
95.53
GitHub Action Run
26 run-4.0-gemfiles/dry_validation.gemfile - 24629943149.26 19 Apr 2026 01:13PM UTC 152
57.6
GitHub Action Run
27 run-3.3-gemfiles/rack_3_0.gemfile - 24629943149.27 19 Apr 2026 01:13PM UTC 152
95.55
GitHub Action Run
28 run-4.0-Gemfile - 24629943149.28 19 Apr 2026 01:14PM UTC 152
95.57
GitHub Action Run
29 run-4.0-gemfiles/multi_xml.gemfile - 24629943149.29 19 Apr 2026 01:14PM UTC 152
35.87
GitHub Action Run
30 run-4.0-gemfiles/multi_json.gemfile - 24629943149.30 19 Apr 2026 01:13PM UTC 152
35.87
GitHub Action Run
31 run-3.4-gemfiles/rails_7_2.gemfile - 24629943149.31 19 Apr 2026 01:13PM UTC 153
95.58
GitHub Action Run
32 run-3.3-gemfiles/rack_2_2.gemfile - 24629943149.32 19 Apr 2026 01:13PM UTC 152
95.51
GitHub Action Run
33 run-4.0-gemfiles/grape_entity.gemfile - 24629943149.33 19 Apr 2026 01:13PM UTC 152
49.4
GitHub Action Run
34 run-3.3-Gemfile - 24629943149.34 19 Apr 2026 01:13PM UTC 152
95.55
GitHub Action Run
35 run-4.0-gemfiles/rack_3_2.gemfile - 24629943149.35 19 Apr 2026 01:14PM UTC 152
95.57
GitHub Action Run
36 run-3.4-gemfiles/rack_3_2.gemfile - 24629943149.36 19 Apr 2026 01:13PM UTC 152
95.57
GitHub Action Run
37 run-3.4-gemfiles/rack_2_2.gemfile - 24629943149.37 19 Apr 2026 01:14PM UTC 152
95.53
GitHub Action Run
Source Files on build 24629943149
  • Tree
  • List 153
  • Changed 5
  • Source Changed 4
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #24629943149
  • Pull Request #2686
  • PR Base - master (#24617960772)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc