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

ruby-grape / grape / 33768866081
97%

Build:
DEFAULT BRANCH: master
Ran 03 Sep 2026 02:47PM 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 02:46PM UTC coverage: 96.953% (+0.005%) from 96.948%
33768866081

push

github

web-flow
Constrain the version capture with a Regexp instead of an Array (#2889)

* 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 a Regexp 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.

The stringify that `map_str` did stays, inlined at the only call site it ever
had, an... (continued)

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%)

3943 of 4012 relevant lines covered (98.28%)

27020.83 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-3.4-gemfiles/rails_8_0.gemfile - 33768866081.1 03 Sep 2026 02:47PM UTC 169
95.72
GitHub Action Run
2 run-3.3-gemfiles/rack_3_2.gemfile - 33768866081.2 03 Sep 2026 02:47PM UTC 168
95.71
GitHub Action Run
3 run-3.4-gemfiles/rack_2_2.gemfile - 33768866081.3 03 Sep 2026 02:47PM UTC 168
95.68
GitHub Action Run
4 run-4.0-gemfiles/dry_validation.gemfile - 33768866081.4 03 Sep 2026 02:47PM UTC 168
57.75
GitHub Action Run
5 run-4.0-gemfiles/rails_8_0.gemfile - 33768866081.5 03 Sep 2026 02:47PM UTC 169
95.72
GitHub Action Run
6 run-3.3-gemfiles/rails_8_1.gemfile - 33768866081.6 03 Sep 2026 02:47PM UTC 169
95.72
GitHub Action Run
7 run-3.4-Gemfile - 33768866081.7 03 Sep 2026 02:47PM UTC 168
95.71
GitHub Action Run
8 run-4.0-gemfiles/multi_xml.gemfile - 33768866081.8 03 Sep 2026 02:48PM UTC 168
46.93
GitHub Action Run
9 run-4.0-gemfiles/grape_swagger.gemfile - 33768866081.9 03 Sep 2026 02:47PM UTC 168
55.2
GitHub Action Run
10 run-4.0-Gemfile - 33768866081.10 03 Sep 2026 02:47PM UTC 168
95.71
GitHub Action Run
11 run-3.4-gemfiles/rails_8_1.gemfile - 33768866081.11 03 Sep 2026 02:47PM UTC 169
95.72
GitHub Action Run
12 run-4.0-gemfiles/hashie.gemfile - 33768866081.12 03 Sep 2026 02:47PM UTC 168
61.75
GitHub Action Run
13 run-3.4-gemfiles/rails_7_2.gemfile - 33768866081.13 03 Sep 2026 02:47PM UTC 169
95.72
GitHub Action Run
14 run-3.4-gemfiles/rack_3_2.gemfile - 33768866081.14 03 Sep 2026 02:47PM UTC 168
95.71
GitHub Action Run
15 run-3.3-Gemfile - 33768866081.15 03 Sep 2026 02:47PM UTC 168
95.71
GitHub Action Run
16 run-4.0-gemfiles/multi_xml_0_8.gemfile - 33768866081.16 03 Sep 2026 02:47PM UTC 168
46.97
GitHub Action Run
17 run-4.0-gemfiles/rails_8_1.gemfile - 33768866081.17 03 Sep 2026 02:47PM UTC 169
95.72
GitHub Action Run
18 run-3.3-gemfiles/rack_3_0.gemfile - 33768866081.18 03 Sep 2026 02:47PM UTC 168
95.71
GitHub Action Run
19 run-3.4-gemfiles/rack_3_1.gemfile - 33768866081.19 03 Sep 2026 02:47PM UTC 168
95.71
GitHub Action Run
20 run-3.3-gemfiles/rack_3_1.gemfile - 33768866081.20 03 Sep 2026 02:47PM UTC 168
95.71
GitHub Action Run
21 run-3.3-gemfiles/rack_2_2.gemfile - 33768866081.21 03 Sep 2026 02:47PM UTC 168
95.68
GitHub Action Run
22 run-4.0-gemfiles/rack_3_2.gemfile - 33768866081.22 03 Sep 2026 02:47PM UTC 168
95.71
GitHub Action Run
23 run-4.0-gemfiles/rack_2_2.gemfile - 33768866081.23 03 Sep 2026 02:47PM UTC 168
95.68
GitHub Action Run
24 run-4.0-gemfiles/rails_7_2.gemfile - 33768866081.24 03 Sep 2026 02:47PM UTC 169
95.72
GitHub Action Run
25 run-4.0-gemfiles/rack_3_0.gemfile - 33768866081.25 03 Sep 2026 02:47PM UTC 168
95.71
GitHub Action Run
26 run-4.0-gemfiles/grape_entity.gemfile - 33768866081.26 03 Sep 2026 02:47PM UTC 168
50.34
GitHub Action Run
27 run-3.3-gemfiles/rails_7_2.gemfile - 33768866081.27 03 Sep 2026 02:47PM UTC 169
95.72
GitHub Action Run
28 run-4.0-gemfiles/rack_3_1.gemfile - 33768866081.28 03 Sep 2026 02:47PM UTC 168
95.71
GitHub Action Run
29 run-4.0-gemfiles/multi_json.gemfile - 33768866081.29 03 Sep 2026 02:47PM UTC 168
47.47
GitHub Action Run
30 run-3.3-gemfiles/rails_8_0.gemfile - 33768866081.30 03 Sep 2026 02:47PM UTC 169
95.72
GitHub Action Run
31 run-4.0-gemfiles/multi_json_1_20.gemfile - 33768866081.31 03 Sep 2026 02:47PM UTC 168
47.51
GitHub Action Run
32 run-3.4-gemfiles/rack_3_0.gemfile - 33768866081.32 03 Sep 2026 02:47PM UTC 168
95.71
GitHub Action Run
Source Files on build 33768866081
  • 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 #33768866081
  • b4d74e97 on github
  • Prev Build on master (#33755485219)
  • Next Build on master (#33769456501)
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