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

ruby-grape / grape / 30217930297 / 1
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: fix/adversarial-sweep-2026-08
DEFAULT BRANCH: master
Ran 26 Jul 2026 07:59PM UTC
Files 167
Run time 4s
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

26 Jul 2026 07:56PM UTC coverage: 95.553% (+0.03%) from 95.526%
30217930297.1

Pull #2828

github

ericproulx
Compare InheritableSetting without serializing both chains

`InheritableSetting#to_hash` had no direct caller in `lib/`: it existed only
to back `#==`, which `Endpoint#==` calls from the duplicate-route check in
`DSL::Routing#route`. `Endpoint#==` compares `config` first, so distinct paths
short-circuit before settings are touched — but a namespace's prefix lives in
the settings, not in `config.path`, so every endpoint declaring the same
*relative* path (`get '/'`, `get '/:id'` under N namespaces) fell through to
two full `#to_hash` serializations. That is O(n²) over an API's endpoints:
800 routes across 200 namespaces produced 159,200 `#to_hash` calls.

Endpoint settings are forked as siblings of the scope they came from
(`point_in_time_copy` calls `inherit_from(parent)`), so both sides of these
comparisons hang off the same parent object and inherit the same values.
Comparing own state then decides the question without serializing either
chain. `InheritableValues` gets the `#==` it never had, which is what forced
the round-trip in the first place.

Resolved-equality semantics are preserved: stacks concatenate and `#stack`
never records an empty one, so matching own stacks means matching resolved
ones, while the rescue handler maps merge — a scope can restate an inherited
mapping — so those stay compared resolved. Settings whose parents differ fall
back to `#to_hash`, and a lazily-allocated store compares alike whether it is
nil or an emptied Hash.

800 routes across 200 namespaces: 159,200 `#to_hash` calls and 0.63s of
definition time become 0 and 0.29s. Duplicate detection is unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Pull Request #2828: Compare InheritableSetting without serializing both chains

1157 of 1272 branches covered (90.96%)

Branch coverage included in aggregate %.

3764 of 3878 relevant lines covered (97.06%)

1041.86 hits per line

Source Files on job run-4.0-gemfiles/rack_3_0.gemfile - 30217930297.1
  • Tree
  • List 167
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 30217930297
  • 29f9a291 on github
  • Prev Job for on inheritable-setting-cheap-equality (#30216088388.28)
  • Next Job for on inheritable-setting-cheap-equality (#30217960603.10)
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