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

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

Build:
Build:
LAST BUILD BRANCH: perf/version-capture-regexp
DEFAULT BRANCH: master
Ran 01 Sep 2026 10:42AM 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

01 Sep 2026 10:42AM UTC coverage: 96.948%. Remained the same
33498797105

Pull #2880

github

ericproulx
Default the versioner's pattern to nil instead of a regexp matching anything

`Versioner::Path#version_from_first_segment` runs on every request of a
path-versioned API and tested the candidate segment against `pattern`:

    return unless potential_version.match?(pattern)

`pattern` defaulted to `/.*/i`, which matches any segment including the empty
one. Unless an API supplied its own, that regexp ran on every request to answer
a question it could not answer with no.

Default it to nil, which is what the middleware is actually asking: whether a
pattern was supplied at all. "No constraint" is what `/.*/i` was standing in
for, and nil says it directly — the check becomes a nil test, and an API that
explicitly passes `pattern: /.*/i` keeps it, where inferring the answer from
the value would have discarded it as indistinguishable from the default.

`version 'v1', using: :path` cannot set this option: `Endpoint#build_stack`
does not pass one, and `DSL::Routing#version` does not accept the keyword. A
pattern reaches the middleware when an API inserts the versioner itself —

    use Grape::Middleware::Versioner::Path, versions: %w[v1], pattern: /v.+/

— which is undocumented but reachable and spec-pinned, and is unchanged: under
`/v.+/` a `/x1/...` segment is still not taken as a version, where the default
takes it.

What it saves is one regexp per request on a path-versioned API, measured in
one process at 57 ns for `seg.match?(/.*/i)` against 18 ns for the nil test.
That is roughly 0.7% of a minimal request, below what the version_throughput
harness can resolve, so no end-to-end figure is claimed. Allocation counts are
unchanged: `match?` builds no MatchData.

`Versioner::Base::DEFAULT_OPTIONS[:pattern]` and `Versioner::Base#pattern`
answer nil rather than `/.*/i` as a result. See UPGRADING.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Pull Request #2880: Skip the version pattern test when it is the one that matches anything

1236 of 1330 branches covered (92.93%)

Branch coverage included in aggregate %.

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

3910 of 3978 relevant lines covered (98.29%)

27261.36 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-4.0-gemfiles/grape_swagger.gemfile - 33498797105.1 01 Sep 2026 10:43AM UTC 168
55.17
GitHub Action Run
2 run-4.0-gemfiles/rack_2_2.gemfile - 33498797105.2 01 Sep 2026 10:43AM UTC 168
95.66
GitHub Action Run
3 run-3.3-gemfiles/rack_3_0.gemfile - 33498797105.3 01 Sep 2026 10:42AM UTC 168
95.7
GitHub Action Run
4 run-3.3-gemfiles/rails_8_0.gemfile - 33498797105.4 01 Sep 2026 10:43AM UTC 169
95.7
GitHub Action Run
5 run-4.0-Gemfile - 33498797105.5 01 Sep 2026 10:43AM UTC 168
95.7
GitHub Action Run
6 run-3.4-gemfiles/rails_8_0.gemfile - 33498797105.6 01 Sep 2026 10:43AM UTC 169
95.7
GitHub Action Run
7 run-4.0-gemfiles/rails_8_0.gemfile - 33498797105.7 01 Sep 2026 10:43AM UTC 169
95.7
GitHub Action Run
8 run-4.0-gemfiles/rails_7_2.gemfile - 33498797105.8 01 Sep 2026 10:43AM UTC 169
95.7
GitHub Action Run
9 run-3.4-gemfiles/rails_8_1.gemfile - 33498797105.9 01 Sep 2026 10:43AM UTC 169
95.7
GitHub Action Run
10 run-3.4-gemfiles/rack_3_2.gemfile - 33498797105.10 01 Sep 2026 10:43AM UTC 168
95.7
GitHub Action Run
11 run-3.3-gemfiles/rails_7_2.gemfile - 33498797105.11 01 Sep 2026 10:43AM UTC 169
95.7
GitHub Action Run
12 run-4.0-gemfiles/multi_json_1_20.gemfile - 33498797105.12 01 Sep 2026 10:42AM UTC 168
47.49
GitHub Action Run
13 run-4.0-gemfiles/grape_entity.gemfile - 33498797105.13 01 Sep 2026 10:42AM UTC 168
50.23
GitHub Action Run
14 run-4.0-gemfiles/dry_validation.gemfile - 33498797105.14 01 Sep 2026 10:42AM UTC 168
57.85
GitHub Action Run
15 run-3.3-gemfiles/rack_3_1.gemfile - 33498797105.15 01 Sep 2026 10:42AM UTC 168
95.7
GitHub Action Run
16 run-3.3-gemfiles/rails_8_1.gemfile - 33498797105.16 01 Sep 2026 10:43AM UTC 169
95.7
GitHub Action Run
17 run-4.0-gemfiles/multi_json.gemfile - 33498797105.17 01 Sep 2026 10:43AM UTC 168
47.45
GitHub Action Run
18 run-4.0-gemfiles/multi_xml.gemfile - 33498797105.18 01 Sep 2026 10:42AM UTC 168
46.85
GitHub Action Run
19 run-4.0-gemfiles/rack_3_1.gemfile - 33498797105.19 01 Sep 2026 10:43AM UTC 168
95.7
GitHub Action Run
20 run-3.3-Gemfile - 33498797105.20 01 Sep 2026 10:43AM UTC 168
95.7
GitHub Action Run
21 run-4.0-gemfiles/rails_8_1.gemfile - 33498797105.21 01 Sep 2026 10:43AM UTC 169
95.7
GitHub Action Run
22 run-3.4-gemfiles/rack_3_0.gemfile - 33498797105.22 01 Sep 2026 10:42AM UTC 168
95.7
GitHub Action Run
23 run-3.3-gemfiles/rack_3_2.gemfile - 33498797105.23 01 Sep 2026 10:42AM UTC 168
95.7
GitHub Action Run
24 run-3.4-Gemfile - 33498797105.24 01 Sep 2026 10:43AM UTC 168
95.7
GitHub Action Run
25 run-3.4-gemfiles/rails_7_2.gemfile - 33498797105.25 01 Sep 2026 10:43AM UTC 169
95.7
GitHub Action Run
26 run-4.0-gemfiles/hashie.gemfile - 33498797105.26 01 Sep 2026 10:42AM UTC 168
61.73
GitHub Action Run
27 run-3.4-gemfiles/rack_2_2.gemfile - 33498797105.27 01 Sep 2026 10:42AM UTC 168
95.66
GitHub Action Run
28 run-3.4-gemfiles/rack_3_1.gemfile - 33498797105.28 01 Sep 2026 10:43AM UTC 168
95.7
GitHub Action Run
29 run-4.0-gemfiles/multi_xml_0_8.gemfile - 33498797105.29 01 Sep 2026 10:43AM UTC 168
46.89
GitHub Action Run
30 run-3.3-gemfiles/rack_2_2.gemfile - 33498797105.30 01 Sep 2026 10:43AM UTC 168
95.66
GitHub Action Run
31 run-4.0-gemfiles/rack_3_0.gemfile - 33498797105.31 01 Sep 2026 10:42AM UTC 168
95.7
GitHub Action Run
32 run-4.0-gemfiles/rack_3_2.gemfile - 33498797105.32 01 Sep 2026 10:43AM UTC 168
95.7
GitHub Action Run
Source Files on build 33498797105
  • Tree
  • List 169
  • Changed 2
  • Source Changed 2
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #33498797105
  • Pull Request #2880
  • PR Base - master (#33414584203)
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