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

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

Build:
Build:
LAST BUILD BRANCH: perf/request-path-and-router
DEFAULT BRANCH: master
Ran 02 Sep 2026 09:49PM 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

02 Sep 2026 09:42PM UTC coverage: 96.938%. Remained the same
33686629872

push

github

ericproulx
Constrain the version capture with a Regexp instead of an Array

`Pattern#extract_capture` hands the declared versions to Mustermann as the
Array of Strings they arrive in:

    requirements.merge(version: map_str(version))

Mustermann uses `capture:` for two things: shaping the regexp, and deriving
*param converters*. The second is the problem. `AST::ParamScanner::Capture`
only knows how to build a converter from a Class or a Symbol, so for an Array
of plain Strings every entry contributes nothing — and it still hands one back:

    entries = capture.map { |item| converter(item) }.compact   # => []
    converter = ->(string) do
      _, c = entries.find { |r, _| r.match?(string) }          # => nil
      c&.call(string) || string                                # => string
    end

An identity function, registered for `version` on every path-versioned route.

Its cost is not the call. A non-empty converter table makes
`AST::Pattern#identity_params?` false forever, and that is the predicate
`RegexpBased#build_params` consults to decide whether it may hand back the
capture Hash as it came:

    if @simple_captures
      params = match.named_captures
      return params if params.empty? || identity_params?(params)
      params.each_with_object({}) { |(k, v), h| h[k] = map_param(k, v) }

So every request on the route rebuilt the Hash through `map_param` and called
the do-nothing lambda on each value — `Route#params_for` runs this on every
matched request. Passing `Regexp.union(map_str(version))` registers no
converter at all, and produces a simpler regexp into the bargain:

    array:   (?<version>(?-mix:(?-mix:(?:v|%76)(?:1|%31))|(?-mix:(?:v|%76)(?:2|%32))))
    regexp:  (?<version>(?-mix:v1|v2))

`Regexp.union` escapes its arguments, so versions carrying regexp
metacharacters (`v1.0`, `v2+beta`) still match literally.

One behavioural difference, visible in those two lines: Mustermann expands an
Array entry the way it expands a path literal, so each cha... (continued)

1237 of 1332 branches covered (92.87%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

3923 of 3991 relevant lines covered (98.3%)

27441.04 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-3.3-gemfiles/rack_2_2.gemfile - 33686629872.1 02 Sep 2026 09:50PM UTC 168
95.65
GitHub Action Run
2 run-4.0-gemfiles/rack_2_2.gemfile - 33686629872.2 02 Sep 2026 09:53PM UTC 168
95.66
GitHub Action Run
3 run-3.4-gemfiles/rails_7_2.gemfile - 33686629872.3 02 Sep 2026 09:49PM UTC 169
95.7
GitHub Action Run
4 run-4.0-gemfiles/rails_8_0.gemfile - 33686629872.4 02 Sep 2026 09:50PM UTC 169
95.7
GitHub Action Run
5 run-3.4-gemfiles/rails_8_1.gemfile - 33686629872.5 02 Sep 2026 09:49PM UTC 169
95.7
GitHub Action Run
6 run-3.3-gemfiles/rack_3_2.gemfile - 33686629872.6 02 Sep 2026 09:49PM UTC 168
95.69
GitHub Action Run
7 run-4.0-gemfiles/multi_xml_0_8.gemfile - 33686629872.7 02 Sep 2026 09:49PM UTC 168
46.96
GitHub Action Run
8 run-3.3-gemfiles/rails_8_1.gemfile - 33686629872.8 02 Sep 2026 09:51PM UTC 169
95.7
GitHub Action Run
9 run-3.3-gemfiles/rack_3_0.gemfile - 33686629872.9 02 Sep 2026 09:49PM UTC 168
95.69
GitHub Action Run
10 run-4.0-gemfiles/multi_xml.gemfile - 33686629872.10 02 Sep 2026 09:51PM UTC 168
46.92
GitHub Action Run
11 run-4.0-gemfiles/rack_3_0.gemfile - 33686629872.11 02 Sep 2026 09:52PM UTC 168
95.69
GitHub Action Run
12 run-3.3-gemfiles/rails_8_0.gemfile - 33686629872.12 02 Sep 2026 09:49PM UTC 169
95.7
GitHub Action Run
13 run-3.3-gemfiles/rack_3_1.gemfile - 33686629872.13 02 Sep 2026 09:49PM UTC 168
95.69
GitHub Action Run
14 run-4.0-gemfiles/rails_7_2.gemfile - 33686629872.14 02 Sep 2026 09:49PM UTC 169
95.7
GitHub Action Run
15 run-4.0-gemfiles/rack_3_2.gemfile - 33686629872.15 02 Sep 2026 09:49PM UTC 168
95.69
GitHub Action Run
16 run-3.4-gemfiles/rack_2_2.gemfile - 33686629872.16 02 Sep 2026 09:49PM UTC 168
95.66
GitHub Action Run
17 run-3.4-gemfiles/rack_3_2.gemfile - 33686629872.17 02 Sep 2026 09:52PM UTC 168
95.69
GitHub Action Run
18 run-4.0-gemfiles/dry_validation.gemfile - 33686629872.18 02 Sep 2026 09:51PM UTC 168
57.83
GitHub Action Run
19 run-3.4-gemfiles/rack_3_1.gemfile - 33686629872.19 02 Sep 2026 09:50PM UTC 168
95.69
GitHub Action Run
20 run-3.4-gemfiles/rack_3_0.gemfile - 33686629872.20 02 Sep 2026 09:53PM UTC 168
95.69
GitHub Action Run
21 run-4.0-gemfiles/multi_json_1_20.gemfile - 33686629872.21 02 Sep 2026 09:50PM UTC 168
47.45
GitHub Action Run
22 run-4.0-gemfiles/grape_entity.gemfile - 33686629872.22 02 Sep 2026 09:51PM UTC 168
50.33
GitHub Action Run
23 run-4.0-gemfiles/multi_json.gemfile - 33686629872.23 02 Sep 2026 09:49PM UTC 168
47.41
GitHub Action Run
24 run-4.0-Gemfile - 33686629872.24 02 Sep 2026 09:53PM UTC 168
95.69
GitHub Action Run
25 run-4.0-gemfiles/grape_swagger.gemfile - 33686629872.25 02 Sep 2026 09:52PM UTC 168
55.22
GitHub Action Run
26 run-4.0-gemfiles/rack_3_1.gemfile - 33686629872.26 02 Sep 2026 09:51PM UTC 168
95.69
GitHub Action Run
27 run-4.0-gemfiles/hashie.gemfile - 33686629872.27 02 Sep 2026 09:52PM UTC 168
61.8
GitHub Action Run
28 run-4.0-gemfiles/rails_8_1.gemfile - 33686629872.28 02 Sep 2026 09:52PM UTC 169
95.7
GitHub Action Run
29 run-3.3-gemfiles/rails_7_2.gemfile - 33686629872.29 02 Sep 2026 09:52PM UTC 169
95.7
GitHub Action Run
30 run-3.3-Gemfile - 33686629872.30 02 Sep 2026 09:49PM UTC 168
95.69
GitHub Action Run
31 run-3.4-gemfiles/rails_8_0.gemfile - 33686629872.31 02 Sep 2026 09:49PM UTC 169
95.7
GitHub Action Run
32 run-3.4-Gemfile - 33686629872.32 02 Sep 2026 09:53PM UTC 168
95.69
GitHub Action Run
Source Files on build 33686629872
  • 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 #33686629872
  • a5a274a8 on github
  • Prev Build on master (#33611766024)
  • Next Build on perf/version-capture-regexp (#33686809238)
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