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

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

Build:
Build:
LAST BUILD BRANCH: perf/build-headers-each-header
DEFAULT BRANCH: master
Ran 19 Apr 2026 01:21PM UTC
Jobs 37
Files 154
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:21PM UTC coverage: 96.893% (-0.01%) from 96.907%
24630096760

Pull #2686

github

ericproulx
Add Grape::Middleware::PrecomputedContentTypes and short-circuit merge_headers

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 introduces +Grape::Middleware::PrecomputedContentTypes+, an
opt-in mixin that warms the three caches 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).

Grape::Middleware::Error, Formatter, and Versioner::Base include the
module. Plain Grape::Middleware::Base subclasses continue to compute
content_types lazily on first access — no behavior change for custom
middlewares. The module advertises intent at the class declaration,
making the warmup a named capability rather than an initializer side
effect.

Also short-circuits Grape::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.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request #2686: Add Grape::Middleware::PrecomputedContentTypes and short-circuit merge_headers

1070 of 1158 branches covered (92.4%)

Branch coverage included in aggregate %.

16 of 17 new or added lines in 5 files covered. (94.12%)

3359 of 3413 relevant lines covered (98.42%)

33309.86 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
92.86
-1.43% lib/grape/middleware/base.rb
Jobs
ID Job ID Ran Files Coverage
1 run-4.0-gemfiles/rack_3_2.gemfile - 24630096760.1 19 Apr 2026 01:21PM UTC 153
95.57
GitHub Action Run
2 run-3.2-gemfiles/rails_8_1.gemfile - 24630096760.2 19 Apr 2026 01:22PM UTC 154
95.6
GitHub Action Run
3 run-3.3-Gemfile - 24630096760.3 19 Apr 2026 01:22PM UTC 153
95.55
GitHub Action Run
4 run-3.3-gemfiles/rails_8_0.gemfile - 24630096760.4 19 Apr 2026 01:22PM UTC 154
95.55
GitHub Action Run
5 run-3.2-gemfiles/rack_3_0.gemfile - 24630096760.5 19 Apr 2026 01:21PM UTC 153
95.59
GitHub Action Run
6 run-3.4-gemfiles/rack_3_1.gemfile - 24630096760.6 19 Apr 2026 01:22PM UTC 153
95.57
GitHub Action Run
7 run-4.0-gemfiles/rack_3_0.gemfile - 24630096760.7 19 Apr 2026 01:21PM UTC 153
95.57
GitHub Action Run
8 run-3.4-gemfiles/rails_8_0.gemfile - 24630096760.8 19 Apr 2026 01:22PM UTC 154
95.57
GitHub Action Run
9 run-3.4-gemfiles/rails_8_1.gemfile - 24630096760.9 19 Apr 2026 01:22PM UTC 154
95.57
GitHub Action Run
10 run-4.0-gemfiles/multi_xml.gemfile - 24630096760.10 19 Apr 2026 01:22PM UTC 153
35.94
GitHub Action Run
11 run-3.2-gemfiles/rack_2_2.gemfile - 24630096760.11 19 Apr 2026 01:21PM UTC 153
95.55
GitHub Action Run
12 run-4.0-Gemfile - 24630096760.12 19 Apr 2026 01:21PM UTC 153
95.57
GitHub Action Run
13 run-4.0-gemfiles/rack_2_2.gemfile - 24630096760.13 19 Apr 2026 01:21PM UTC 153
95.53
GitHub Action Run
14 run-3.4-gemfiles/rack_3_2.gemfile - 24630096760.14 19 Apr 2026 01:22PM UTC 153
95.57
GitHub Action Run
15 run-3.4-gemfiles/rails_7_2.gemfile - 24630096760.15 19 Apr 2026 01:22PM UTC 154
95.57
GitHub Action Run
16 run-3.4-gemfiles/rack_3_0.gemfile - 24630096760.16 19 Apr 2026 01:22PM UTC 153
95.57
GitHub Action Run
17 run-3.4-Gemfile - 24630096760.17 19 Apr 2026 01:22PM UTC 153
95.57
GitHub Action Run
18 run-3.3-gemfiles/rack_3_2.gemfile - 24630096760.18 19 Apr 2026 01:22PM UTC 153
95.55
GitHub Action Run
19 run-3.3-gemfiles/rack_3_1.gemfile - 24630096760.19 19 Apr 2026 01:21PM UTC 153
95.55
GitHub Action Run
20 run-4.0-gemfiles/rails_8_1.gemfile - 24630096760.20 19 Apr 2026 01:22PM UTC 154
95.57
GitHub Action Run
21 run-3.2-gemfiles/rails_7_2.gemfile - 24630096760.21 19 Apr 2026 01:22PM UTC 154
95.6
GitHub Action Run
22 run-4.0-gemfiles/hashie.gemfile - 24630096760.22 19 Apr 2026 01:22PM UTC 153
62.35
GitHub Action Run
23 run-3.2-gemfiles/rails_8_0.gemfile - 24630096760.23 19 Apr 2026 01:22PM UTC 154
95.6
GitHub Action Run
24 run-4.0-gemfiles/multi_json.gemfile - 24630096760.24 19 Apr 2026 01:22PM UTC 153
35.94
GitHub Action Run
25 run-3.2-Gemfile - 24630096760.25 19 Apr 2026 01:22PM UTC 153
95.59
GitHub Action Run
26 run-4.0-gemfiles/rack_3_1.gemfile - 24630096760.26 19 Apr 2026 01:21PM UTC 153
95.57
GitHub Action Run
27 run-3.3-gemfiles/rails_7_2.gemfile - 24630096760.27 19 Apr 2026 01:22PM UTC 154
95.55
GitHub Action Run
28 run-3.4-gemfiles/rack_2_2.gemfile - 24630096760.28 19 Apr 2026 01:22PM UTC 153
95.53
GitHub Action Run
29 run-4.0-gemfiles/dry_validation.gemfile - 24630096760.29 19 Apr 2026 01:22PM UTC 153
57.61
GitHub Action Run
30 run-3.3-gemfiles/rails_8_1.gemfile - 24630096760.30 19 Apr 2026 01:22PM UTC 154
95.55
GitHub Action Run
31 run-3.3-gemfiles/rack_3_0.gemfile - 24630096760.31 19 Apr 2026 01:21PM UTC 153
95.55
GitHub Action Run
32 run-4.0-gemfiles/grape_entity.gemfile - 24630096760.32 19 Apr 2026 01:22PM UTC 153
49.41
GitHub Action Run
33 run-3.2-gemfiles/rack_3_2.gemfile - 24630096760.33 19 Apr 2026 01:22PM UTC 153
95.59
GitHub Action Run
34 run-4.0-gemfiles/rails_7_2.gemfile - 24630096760.34 19 Apr 2026 01:21PM UTC 154
95.57
GitHub Action Run
35 run-3.2-gemfiles/rack_3_1.gemfile - 24630096760.35 19 Apr 2026 01:21PM UTC 153
95.59
GitHub Action Run
36 run-4.0-gemfiles/rails_8_0.gemfile - 24630096760.36 19 Apr 2026 01:22PM UTC 154
95.57
GitHub Action Run
37 run-3.3-gemfiles/rack_2_2.gemfile - 24630096760.37 19 Apr 2026 01:22PM UTC 153
95.5
GitHub Action Run
Source Files on build 24630096760
  • Tree
  • List 154
  • 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 #24630096760
  • 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