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

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

Build:
Build:
LAST BUILD BRANCH: perf/default-status-single-read
DEFAULT BRANCH: master
Ran 03 Sep 2026 12:30PM UTC
Jobs 32
Files 169
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

03 Sep 2026 12:29PM UTC coverage: 96.954% (+0.006%) from 96.948%
33755546064

Pull #2889

github

ericproulx
Read the path version off the route the router already matched (#2890)

Under path versioning the version is a named capture in every route pattern —
`Pattern::Path#build_parts` inserts `:version` ahead of the namespace — and it
is constrained to the declared versions. So by the time a request reaches the
endpoint's middleware stack, the router has already sliced the segment out of
the path, validated it, and left it in `env['grape.routing_args'][:version]`.

`Versioner::Path#before` derived it a second time, from scratch:

    path_info = Grape::Util::PathNormalizer.call(env[Rack::PATH_INFO])
    return if path_info == '/'
    @prefixes.each { |prefix| path_info = path_info.delete_prefix(prefix) if ... }
    slash_position = path_info.index('/', 1)
    return version_from_first_segment(path_info, slash_position) if slash_position

— a normalize, a prefix strip and a slice, for an answer already in the env.

Read it from there instead. The path parse stays, and answers three cases the
routing args cannot:

* no routing args at all, when the middleware runs outside a Grape router;
* the greedy routes behind auto-OPTIONS and 405, which capture nothing;
* a route that declares a `:version` segment of its own on top of the
  versioning one, where Mustermann reports the capture as every position it
  matched rather than the single segment recorded here — hence the
  `is_a?(String)` guard.

`Router#call` now also publishes the path it routed on as
`env['grape.normalized_path']`, so that fallback does not normalize `PATH_INFO`
a second time either. It is the same string the router matched against, which
is what the versioner wants to agree with.

This leans on the version capture being strict, so it comes after
"Constrain the version capture with a Regexp instead of an Array" — before it,
a percent-encoded segment matched the route and Mustermann decoded it, and the
versioner would have accepted what it used to reject.

Median of 5 interleaved runs against m... (continued)
Pull Request #2889: Constrain the version capture with a Regexp instead of an Array

1244 of 1338 branches covered (92.97%)

Branch coverage included in aggregate %.

9 of 9 new or added lines in 4 files covered. (100.0%)

3945 of 4014 relevant lines covered (98.28%)

27001.72 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-4.0-gemfiles/rack_2_2.gemfile - 33755546064.1 03 Sep 2026 12:30PM UTC 168
95.68
GitHub Action Run
2 run-4.0-gemfiles/multi_json.gemfile - 33755546064.2 03 Sep 2026 12:30PM UTC 168
47.47
GitHub Action Run
3 run-3.3-gemfiles/rack_3_0.gemfile - 33755546064.3 03 Sep 2026 12:30PM UTC 168
95.72
GitHub Action Run
4 run-3.3-gemfiles/rails_8_0.gemfile - 33755546064.4 03 Sep 2026 12:30PM UTC 169
95.72
GitHub Action Run
5 run-3.4-Gemfile - 33755546064.5 03 Sep 2026 12:30PM UTC 168
95.72
GitHub Action Run
6 run-3.4-gemfiles/rails_7_2.gemfile - 33755546064.6 03 Sep 2026 12:30PM UTC 169
95.72
GitHub Action Run
7 run-3.3-gemfiles/rack_2_2.gemfile - 33755546064.7 03 Sep 2026 12:30PM UTC 168
95.68
GitHub Action Run
8 run-3.3-Gemfile - 33755546064.8 03 Sep 2026 12:31PM UTC 168
95.72
GitHub Action Run
9 run-3.4-gemfiles/rails_8_1.gemfile - 33755546064.9 03 Sep 2026 12:30PM UTC 169
95.72
GitHub Action Run
10 run-3.3-gemfiles/rails_7_2.gemfile - 33755546064.10 03 Sep 2026 12:30PM UTC 169
95.72
GitHub Action Run
11 run-3.3-gemfiles/rack_3_2.gemfile - 33755546064.11 03 Sep 2026 12:30PM UTC 168
95.72
GitHub Action Run
12 run-4.0-gemfiles/multi_xml.gemfile - 33755546064.12 03 Sep 2026 12:31PM UTC 168
46.93
GitHub Action Run
13 run-4.0-gemfiles/multi_json_1_20.gemfile - 33755546064.13 03 Sep 2026 12:30PM UTC 168
47.51
GitHub Action Run
14 run-4.0-gemfiles/hashie.gemfile - 33755546064.14 03 Sep 2026 12:30PM UTC 168
61.75
GitHub Action Run
15 run-4.0-gemfiles/rack_3_2.gemfile - 33755546064.15 03 Sep 2026 12:30PM UTC 168
95.72
GitHub Action Run
16 run-3.3-gemfiles/rack_3_1.gemfile - 33755546064.16 03 Sep 2026 12:30PM UTC 168
95.72
GitHub Action Run
17 run-4.0-gemfiles/rails_8_1.gemfile - 33755546064.17 03 Sep 2026 12:31PM UTC 169
95.72
GitHub Action Run
18 run-4.0-gemfiles/dry_validation.gemfile - 33755546064.18 03 Sep 2026 12:30PM UTC 168
57.74
GitHub Action Run
19 run-3.3-gemfiles/rails_8_1.gemfile - 33755546064.19 03 Sep 2026 12:31PM UTC 169
95.72
GitHub Action Run
20 run-3.4-gemfiles/rack_3_1.gemfile - 33755546064.20 03 Sep 2026 12:30PM UTC 168
95.72
GitHub Action Run
21 run-4.0-gemfiles/rack_3_0.gemfile - 33755546064.21 03 Sep 2026 12:30PM UTC 168
95.72
GitHub Action Run
22 run-4.0-gemfiles/rails_7_2.gemfile - 33755546064.22 03 Sep 2026 12:30PM UTC 169
95.72
GitHub Action Run
23 run-4.0-gemfiles/grape_entity.gemfile - 33755546064.23 03 Sep 2026 12:30PM UTC 168
50.34
GitHub Action Run
24 run-3.4-gemfiles/rails_8_0.gemfile - 33755546064.24 03 Sep 2026 12:30PM UTC 169
95.72
GitHub Action Run
25 run-3.4-gemfiles/rack_3_2.gemfile - 33755546064.25 03 Sep 2026 12:30PM UTC 168
95.72
GitHub Action Run
26 run-3.4-gemfiles/rack_3_0.gemfile - 33755546064.26 03 Sep 2026 12:30PM UTC 168
95.72
GitHub Action Run
27 run-3.4-gemfiles/rack_2_2.gemfile - 33755546064.27 03 Sep 2026 12:30PM UTC 168
95.68
GitHub Action Run
28 run-4.0-gemfiles/multi_xml_0_8.gemfile - 33755546064.28 03 Sep 2026 12:30PM UTC 168
46.97
GitHub Action Run
29 run-4.0-gemfiles/grape_swagger.gemfile - 33755546064.29 03 Sep 2026 12:30PM UTC 168
55.2
GitHub Action Run
30 run-4.0-gemfiles/rack_3_1.gemfile - 33755546064.30 03 Sep 2026 12:30PM UTC 168
95.72
GitHub Action Run
31 run-4.0-Gemfile - 33755546064.31 03 Sep 2026 12:30PM UTC 168
95.72
GitHub Action Run
32 run-4.0-gemfiles/rails_8_0.gemfile - 33755546064.32 03 Sep 2026 12:30PM UTC 169
95.72
GitHub Action Run
Source Files on build 33755546064
  • Tree
  • List 169
  • Changed 4
  • Source Changed 4
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #33755546064
  • Pull Request #2889
  • PR Base - master (#33755485219)
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