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

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

Build:
Build:
LAST BUILD BRANCH: router-compile-registered-methods
DEFAULT BRANCH: master
Ran 01 Sep 2026 10:30AM 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:29AM UTC coverage: 96.95% (+0.002%) from 96.948%
33497701357

Pull #2880

github

ericproulx
Skip the version pattern test when it is the one that matches 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` defaults to `/.*/i`, which matches any segment including the empty
one, so for that value the test can only ever say yes. It is also what every
API that declares a version the usual way is holding: `Endpoint#build_stack`
does not pass `pattern:` when it builds the versioner, and the DSL rejects the
keyword outright:

    version 'v1', using: :path, pattern: /v.+/
    # => ArgumentError: unknown keyword: :pattern

A pattern does reach the middleware when an API inserts the versioner itself,
which the `use` DSL supports:

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

That keeps working unchanged — under `/v.+/` a `/x1/...` segment is not taken
as a version, where the default takes it. Only the default is skipped.

Name the default and hold the pattern only when an API supplied something else,
so the regexp runs when it can decide something and not otherwise. `pattern`
still answers the default, and a supplied pattern is still enforced — both
branches stay covered by the existing specs, which construct the middleware
with `pattern: /v./i` and assert on a segment that matches and one that does
not.

What it buys, measured in one process on the segment the versioner tests:

    seg.match?(/.*/i)                      57 ns
    custom_pattern && !seg.match?(...)     18 ns   (nil, so short-circuits)

That is roughly 39 ns per request of a path-versioned API — about 0.7% of a
minimal request, and nothing at all for an API with no version. End to end it
sits below what the version_throughput harness can resolve (+0.4% median of 9
interleaved runs, against a noise floor of several percent), so no end-to-end
figure is claimed here. Allocation counts are unc... (continued)
Pull Request #2880: Skip the version pattern test when it is the one that matches anything

1238 of 1332 branches covered (92.94%)

Branch coverage included in aggregate %.

3912 of 3980 relevant lines covered (98.29%)

27252.04 hits per line

Jobs
ID Job ID Ran Files Coverage
1 run-4.0-gemfiles/rails_8_0.gemfile - 33497701357.1 01 Sep 2026 10:30AM UTC 169
95.71
GitHub Action Run
2 run-4.0-gemfiles/rails_8_1.gemfile - 33497701357.2 01 Sep 2026 10:31AM UTC 169
95.71
GitHub Action Run
3 run-4.0-gemfiles/multi_json_1_20.gemfile - 33497701357.3 01 Sep 2026 10:31AM UTC 168
47.47
GitHub Action Run
4 run-4.0-gemfiles/multi_xml.gemfile - 33497701357.4 01 Sep 2026 10:30AM UTC 168
46.83
GitHub Action Run
5 run-3.3-gemfiles/rails_7_2.gemfile - 33497701357.5 01 Sep 2026 10:31AM UTC 169
95.71
GitHub Action Run
6 run-4.0-gemfiles/rack_3_1.gemfile - 33497701357.6 01 Sep 2026 10:30AM UTC 168
95.7
GitHub Action Run
7 run-3.3-Gemfile - 33497701357.7 01 Sep 2026 10:31AM UTC 168
95.7
GitHub Action Run
8 run-3.4-gemfiles/rails_7_2.gemfile - 33497701357.8 01 Sep 2026 10:30AM UTC 169
95.71
GitHub Action Run
9 run-4.0-gemfiles/rack_3_0.gemfile - 33497701357.9 01 Sep 2026 10:30AM UTC 168
95.7
GitHub Action Run
10 run-4.0-gemfiles/hashie.gemfile - 33497701357.10 01 Sep 2026 10:31AM UTC 168
61.7
GitHub Action Run
11 run-3.4-gemfiles/rack_3_1.gemfile - 33497701357.11 01 Sep 2026 10:31AM UTC 168
95.7
GitHub Action Run
12 run-4.0-gemfiles/multi_json.gemfile - 33497701357.12 01 Sep 2026 10:31AM UTC 168
47.44
GitHub Action Run
13 run-3.3-gemfiles/rack_3_0.gemfile - 33497701357.13 01 Sep 2026 10:30AM UTC 168
95.7
GitHub Action Run
14 run-4.0-gemfiles/multi_xml_0_8.gemfile - 33497701357.14 01 Sep 2026 10:30AM UTC 168
46.87
GitHub Action Run
15 run-3.4-gemfiles/rack_2_2.gemfile - 33497701357.15 01 Sep 2026 10:31AM UTC 168
95.67
GitHub Action Run
16 run-3.3-gemfiles/rails_8_1.gemfile - 33497701357.16 01 Sep 2026 10:30AM UTC 169
95.71
GitHub Action Run
17 run-3.3-gemfiles/rack_2_2.gemfile - 33497701357.17 01 Sep 2026 10:30AM UTC 168
95.66
GitHub Action Run
18 run-4.0-gemfiles/rack_2_2.gemfile - 33497701357.18 01 Sep 2026 10:31AM UTC 168
95.67
GitHub Action Run
19 run-3.3-gemfiles/rack_3_1.gemfile - 33497701357.19 01 Sep 2026 10:30AM UTC 168
95.7
GitHub Action Run
20 run-3.3-gemfiles/rack_3_2.gemfile - 33497701357.20 01 Sep 2026 10:31AM UTC 168
95.7
GitHub Action Run
21 run-3.4-gemfiles/rails_8_1.gemfile - 33497701357.21 01 Sep 2026 10:30AM UTC 169
95.71
GitHub Action Run
22 run-3.3-gemfiles/rails_8_0.gemfile - 33497701357.22 01 Sep 2026 10:31AM UTC 169
95.71
GitHub Action Run
23 run-4.0-gemfiles/dry_validation.gemfile - 33497701357.23 01 Sep 2026 10:30AM UTC 168
57.82
GitHub Action Run
24 run-4.0-gemfiles/grape_swagger.gemfile - 33497701357.24 01 Sep 2026 10:30AM UTC 168
55.15
GitHub Action Run
25 run-3.4-gemfiles/rack_3_2.gemfile - 33497701357.25 01 Sep 2026 10:30AM UTC 168
95.7
GitHub Action Run
26 run-4.0-gemfiles/rack_3_2.gemfile - 33497701357.26 01 Sep 2026 10:30AM UTC 168
95.7
GitHub Action Run
27 run-4.0-gemfiles/rails_7_2.gemfile - 33497701357.27 01 Sep 2026 10:30AM UTC 169
95.71
GitHub Action Run
28 run-4.0-gemfiles/grape_entity.gemfile - 33497701357.28 01 Sep 2026 10:31AM UTC 168
50.21
GitHub Action Run
29 run-3.4-Gemfile - 33497701357.29 01 Sep 2026 10:30AM UTC 168
95.7
GitHub Action Run
30 run-4.0-Gemfile - 33497701357.30 01 Sep 2026 10:30AM UTC 168
95.7
GitHub Action Run
31 run-3.4-gemfiles/rails_8_0.gemfile - 33497701357.31 01 Sep 2026 10:31AM UTC 169
95.71
GitHub Action Run
32 run-3.4-gemfiles/rack_3_0.gemfile - 33497701357.32 01 Sep 2026 10:30AM UTC 168
95.7
GitHub Action Run
Source Files on build 33497701357
  • Tree
  • List 169
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #33497701357
  • 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