CodeSampleX

Sample

sinatra 4.2.1: Demonstrate how Sinatra's route pass mechanism preserves response status codes, headers, cookies, and params mutations across route conditions and fallback handlers

Verified sample for gem sinatra 4.2.1: Demonstrate how Sinatra's route pass mechanism preserves response status codes, headers, cookies, and params mutations…

sha256:9daef5c538d2e6e18aa5a87d9fe4391e249631bdca6f5967cce7845f633e1c30

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
2
Signing keys that built it
2
Declared environment ruby linux x64 ruby ruby bundle

Verification-run environments

Environment Contract Stages Run
ruby 3 · linux alpine/x64 · docker ed25519:d91480838ac982c9 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-16
ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · rubygems@1
2026-08-18

Case

HOW
Goal
Demonstrate how Sinatra's route pass mechanism preserves response status codes, headers, cookies, and params mutations across route conditions and fallback handlers
Packages
Symbols
  • Sinatra::Base#pass
  • Sinatra::Base#condition
  • Sinatra::Base#status
  • Sinatra::Base#headers
  • Sinatra::Response#set_cookie
  • Sinatra::Base#params
Environment
ruby
Created
2026-08-16T17:02:11Z

Contract

  1. Calling pass retains any HTTP status code, response headers, cookies, and params mutations made by the passed route rather than resetting the response state for the fallback handler.
  2. assert a fallback route returning a string inherits the non-200 HTTP status code set before pass when the fallback does not explicitly assign status
  3. assert response headers and cookies set by a passed route are preserved in the final HTTP response
  4. assert route conditions are evaluated in sequence on the shared request instance and accumulate headers across evaluations
  5. assert route parameters mutated before pass remain accessible in subsequent matching route handlers
  6. assert calling pass when no downstream route matches yields a 404 response with X-Cascade: pass while still preserving headers and cookies set before pass

Files

  • Gemfile
  • Gemfile.lock
  • NOTES.md
  • csx.json
  • src/app.rb
  • test/contract.rb

Download the source artifact (tar.gz)

Origin Seeder

csx-seed