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

ruby-grape / grape / 26331367761 / 19
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: fix/recompile-settings-mutation-race
DEFAULT BRANCH: master
Ran 23 May 2026 05:34PM UTC
Files 163
Run time 10s
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

23 May 2026 11:22AM UTC coverage: 95.707% (+0.02%) from 95.688%
26331367761.19

Pull #2736

github

ericproulx
Lazy-allocate validation_exceptions and unify rescue branches via ValidationErrors flatten

`Grape::Endpoint#run_validators`:

- Happy path used to allocate an empty `validation_errors = []` Array on
  every request. Start at `nil` and lazy-initialize the local (now named
  `validation_exceptions`) inside the rescue so the happy path allocates zero.
- Collapse the two rescue handlers into one. Both `Grape::Exceptions::Validation`
  (one error) and `Grape::Exceptions::ValidationArrayErrors` (a bundle of
  Validations from one validator) are now pushed onto the same list as-is.

`Grape::Exceptions::Validation#errors` returns `self` so callers can treat a
single Validation and a ValidationArrayErrors wrapper uniformly via
`flat_map(&:errors)` — Array returns flatten in, non-Array returns
(i.e. `self`) append as one element.

`Grape::Exceptions::ValidationErrors#initialize` keyword renamed
`errors:` → `exceptions:` (the input array is a mix of validation
exception objects, not the grouped errors Hash). Flattens any nested
`ValidationArrayErrors` via `flat_map(&:errors)` before grouping by
`params`. The unwrapping knowledge lives in the aggregator that *is* the
validation-errors collection rather than being duplicated in the
endpoint loop. UPGRADING entry added.

`if validation_exceptions` is the new raise guard — non-nil iff at least
one validator raised, equivalent to the prior `.any?` check on a
possibly-empty array.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pull Request #2736: Lazy-allocate validation_exceptions and unify rescue branches via ValidationErrors flatten

1061 of 1169 branches covered (90.76%)

Branch coverage included in aggregate %.

3487 of 3583 relevant lines covered (97.32%)

991.68 hits per line

Source Files on job run-4.0-gemfiles/rack_3_0.gemfile - 26331367761.19
  • Tree
  • List 163
  • Changed 3
  • Source Changed 3
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 26331367761
  • b2cadc83 on github
  • Prev Job for on perf/skip-empty-validation-errors-alloc (#26292056269.8)
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