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

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

Build:
Build:
LAST BUILD BRANCH: revisit_validators
DEFAULT BRANCH: master
Ran 21 Feb 2026 03:59PM UTC
Jobs 37
Files 155
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

21 Feb 2026 03:58PM UTC coverage: 96.757% (-0.1%) from 96.906%
22259784049

Pull #2657

github

ericproulx
Instantiate validators at definition time and fix thread safety

Validator instantiation at definition time:
- Store validator instances in ParamsScope/ContractScope and have
  Endpoint#run_validators read them directly
- Remove ValidatorFactory indirection and eagerly compute validator
  messages/options in constructors
- Freeze validator instances after initialization via Base.new to
  prevent mutation across shared requests (shallow freeze)
- Extract Grape::Util::Translation module shared by Exceptions::Base
  and Validators::Base for I18n translate with fallback locale
- Support Hash messages in translate_message for deferred translation
  with interpolation parameters (e.g. { key: :length, min: 2 })
- Normalize Grape::Exceptions::Validation params handling and refactor
  validator specs to define routes per example group
- Use case/when for message_key extraction in Exceptions::Validation
- Guard LengthValidator against missing constraints and extract option
  validation into private methods to stay within complexity limits
- Store zero-arity procs directly in ValuesValidator (consistent with
  ExceptValuesValidator) and document DB-backed lazy evaluation intent
- Drop test-prof dependency and its spec config

Thread safety for shared ParamsScope instances:
- Introduce Grape::Validations::ScopeTracker to hold all per-request
  mutable state (array index and qualifying params) in a single
  Thread.current entry, keeping shared ParamsScope objects immutable
- ScopeTracker.track { } wraps the validation run in Endpoint and
  ensures cleanup via ensure regardless of errors
- AttributesIterator stores current array indices via ScopeTracker
  instead of mutating @index on the shared scope
- ParamsScope#full_name reads the current index from ScopeTracker
  instead of @index; remove @index, reset_index, and attr_accessor
- meets_dependency? stores qualifying array params in ScopeTracker
  instead of @params_meeting_dependency on the shared scope
- Change... (continued)
Pull Request #2657: Instantiate validators at definition time

1080 of 1172 branches covered (92.15%)

Branch coverage included in aggregate %.

269 of 271 new or added lines in 29 files covered. (99.26%)

1 existing line in 1 file now uncovered.

3366 of 3423 relevant lines covered (98.33%)

38934.63 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
91.67
-4.33% lib/grape/exceptions/base.rb
1
95.65
-0.27% lib/grape/validations/validators/base.rb

Uncovered Existing Lines

Lines Coverage ∆ File
1
92.98
-4.31% lib/grape/validations/attributes_iterator.rb
Jobs
ID Job ID Ran Files Coverage
1 run-3.2-gemfiles/rack_3_0.gemfile - 22259784049.1 21 Feb 2026 03:59PM UTC 154
95.68
GitHub Action Run
2 run-4.0-gemfiles/rails_8_0.gemfile - 22259784049.2 21 Feb 2026 03:59PM UTC 155
95.64
GitHub Action Run
3 run-3.2-gemfiles/rails_8_0.gemfile - 22259784049.3 21 Feb 2026 03:59PM UTC 155
95.69
GitHub Action Run
4 run-4.0-gemfiles/rack_3_0.gemfile - 22259784049.4 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
5 run-3.4-gemfiles/rack_3_1.gemfile - 22259784049.5 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
6 run-3.2-gemfiles/rack_3_2.gemfile - 22259784049.6 21 Feb 2026 03:59PM UTC 154
95.68
GitHub Action Run
7 run-4.0-gemfiles/rails_7_2.gemfile - 22259784049.7 21 Feb 2026 03:59PM UTC 155
95.64
GitHub Action Run
8 run-3.4-gemfiles/rails_7_2.gemfile - 22259784049.8 21 Feb 2026 03:59PM UTC 155
95.64
GitHub Action Run
9 run-3.3-gemfiles/rack_3_1.gemfile - 22259784049.9 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
10 run-4.0-gemfiles/dry_validation.gemfile - 22259784049.10 21 Feb 2026 03:59PM UTC 154
56.8
GitHub Action Run
11 run-3.4-gemfiles/rack_3_2.gemfile - 22259784049.11 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
12 run-3.2-gemfiles/rails_8_1.gemfile - 22259784049.12 21 Feb 2026 03:59PM UTC 155
95.69
GitHub Action Run
13 run-3.2-gemfiles/rack_3_1.gemfile - 22259784049.13 21 Feb 2026 03:59PM UTC 154
95.68
GitHub Action Run
14 run-4.0-gemfiles/rack_3_1.gemfile - 22259784049.14 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
15 run-3.2-Gemfile - 22259784049.15 21 Feb 2026 03:59PM UTC 154
95.68
GitHub Action Run
16 run-3.3-gemfiles/rack_3_0.gemfile - 22259784049.16 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
17 run-3.4-Gemfile - 22259784049.17 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
18 run-3.3-Gemfile - 22259784049.18 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
19 run-4.0-gemfiles/grape_entity.gemfile - 22259784049.19 21 Feb 2026 03:59PM UTC 154
48.78
GitHub Action Run
20 run-4.0-gemfiles/multi_json.gemfile - 22259784049.20 21 Feb 2026 03:59PM UTC 154
35.28
GitHub Action Run
21 run-3.2-gemfiles/rails_7_2.gemfile - 22259784049.21 21 Feb 2026 03:59PM UTC 155
95.69
GitHub Action Run
22 run-4.0-gemfiles/rack_2_2.gemfile - 22259784049.22 21 Feb 2026 03:59PM UTC 154
95.6
GitHub Action Run
23 run-3.3-gemfiles/rails_8_1.gemfile - 22259784049.23 21 Feb 2026 03:59PM UTC 155
95.64
GitHub Action Run
24 run-4.0-gemfiles/multi_xml.gemfile - 22259784049.24 21 Feb 2026 03:59PM UTC 154
35.28
GitHub Action Run
25 run-3.2-gemfiles/rack_2_2.gemfile - 22259784049.25 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
26 run-3.3-gemfiles/rack_2_2.gemfile - 22259784049.26 21 Feb 2026 03:59PM UTC 154
95.59
GitHub Action Run
27 run-3.4-gemfiles/rack_3_0.gemfile - 22259784049.27 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
28 run-3.3-gemfiles/rails_8_0.gemfile - 22259784049.28 21 Feb 2026 03:59PM UTC 155
95.64
GitHub Action Run
29 run-3.3-gemfiles/rack_3_2.gemfile - 22259784049.29 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
30 run-4.0-gemfiles/rails_8_1.gemfile - 22259784049.30 21 Feb 2026 03:59PM UTC 155
95.64
GitHub Action Run
31 run-3.4-gemfiles/rails_8_0.gemfile - 22259784049.31 21 Feb 2026 03:59PM UTC 155
95.64
GitHub Action Run
32 run-4.0-Gemfile - 22259784049.32 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
33 run-4.0-gemfiles/hashie.gemfile - 22259784049.33 21 Feb 2026 03:59PM UTC 154
61.21
GitHub Action Run
34 run-4.0-gemfiles/rack_3_2.gemfile - 22259784049.34 21 Feb 2026 03:59PM UTC 154
95.64
GitHub Action Run
35 run-3.4-gemfiles/rails_8_1.gemfile - 22259784049.35 21 Feb 2026 03:59PM UTC 155
95.64
GitHub Action Run
36 run-3.3-gemfiles/rails_7_2.gemfile - 22259784049.36 21 Feb 2026 03:59PM UTC 155
95.64
GitHub Action Run
37 run-3.4-gemfiles/rack_2_2.gemfile - 22259784049.37 21 Feb 2026 03:59PM UTC 154
95.6
GitHub Action Run
Source Files on build 22259784049
  • Tree
  • List 155
  • Changed 27
  • Source Changed 26
  • Coverage Changed 23
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #22259784049
  • Pull Request #2657
  • PR Base - master (#22229989337)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc