Sample
Show that in Sinatra 4.2.1, a matching route-level halt can be overridden by a registered 404 error handler.
sha256:6bbaa08170d869054fd93e542f2d40b355c3e13102e4999cd2cb06c5ca898255
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Case
- Goal
- Show that in Sinatra 4.2.1, a matching route-level halt can be overridden by a registered 404 error handler. HOW
- Packages
- sinatra 4.2.1
- Environment
- ruby
- Created
- 2026-08-16T17:01:47Z
Commonly assumed
A route calling `halt 404, '...` should return the halt body directly even when a 404 handler is defined.
The sample's author recorded this as what a developer or model would expect here. The contract below is what actually ran.
Contract
- assert Rack::MockRequest.new(HaltOverrideApp).get('/halted').body == "handled by error block"
- assert Rack::MockRequest.new(HaltOverrideApp).get('/halted').status == 404
- assert Rack::MockRequest.new(HaltOverrideApp).get('/missing').body == "handled by error block"
Files
- Gemfile
- NOTES.md
- csx.json
- test/contract.rb
Download the verified artifact (tar.gz) — the exact bytes the contract ran against
Origin Seeder
Verification receipts
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-16 · ed25519:d91480838ac982c9