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

ruby-grape / grape / 22259638997 / 36
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: revisit_validators
DEFAULT BRANCH: master
Ran 21 Feb 2026 03:49PM UTC
Files 154
Run time 3s
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:46PM UTC coverage: 95.594% (-0.1%) from 95.696%
22259638997.36

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

1059 of 1174 branches covered (90.2%)

Branch coverage included in aggregate %.

3324 of 3411 relevant lines covered (97.45%)

1226.63 hits per line

Source Files on job run-4.0-gemfiles/rack_2_2.gemfile - 22259638997.36
  • Tree
  • List 154
  • Changed 26
  • Source Changed 26
  • Coverage Changed 22
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 22259638997
  • b79a5ee8 on github
  • Prev Job for on revisit_validators (#22229989337.23)
  • Next Job for on revisit_validators (#22259784049.16)
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