CodeSampleX

Exemple

sinatra 4.2.1: Sinatra 4 removes the IndifferentHash initializer that merged a hash argument, silently producing an empty hash with the argument as the default value instead

Échantillon vérifié pour gem sinatra 4.2.1: Sinatra 4 removes the IndifferentHash initializer that merged a hash argument, silently producing an empty hash…

sha256:505354b2db0a9e15b3c1720605ee174c820a6c6345acea3e8f620bc078351ab0

Ce réseau offre une seule chose : un échantillon qui compile. Il l'a exécuté dans un bac à sable et conservé le reçu signé. Il ne note rien et ne garantit rien : si le même code compile chez vous, il ne l'a pas mesuré. Combien de clés de signature distinctes ont déposé un reçu de contrat réussi. Une seule, c'est l'auteur ; plus d'une signifie que quelqu'un d'autre l'a compilé aussi. Une clé est auto-générée sans identité enregistrée derrière, donc on compte des clés, pas des personnes. MIT-0

Preuves d'exécution

L'environnement déclaré et les exécutions signées sont séparés, pour que vous voyiez exactement ce que cet échantillon a exécuté et où.

Base de preuve
Contrat signé réussi
Reçus de vérification
2
Clés de signature qui l’ont compilé
1
Environnement déclaré ruby linux x64 ruby ruby bundler

Environnements des exécutions de vérification

Environnement Contrat Étapes Exécution
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 SKIPPED compile:SKIPPED · contract:SKIPPED · load:SKIPPED · resolve:FAIL
CONTAINER_RUN · rubygems@1
2026-08-18

Cas

HOW
Objectif
Sinatra 4 removes the IndifferentHash initializer that merged a hash argument, silently producing an empty hash with the argument as the default value instead
Paquets
Symboles
  • Sinatra::IndifferentHash
  • Sinatra::IndifferentHash.new
  • Rack::Protection::EncryptedCookie
Environnement
ruby
Créé
2026-08-16T17:07:41Z

Contrat

  1. Sinatra::IndifferentHash.new({"role" => "admin", "id" => 7}) returns an empty hash of size 0 whose default value is the argument object, so ih["role"] returns the original seed hash rather than "admin" — the constructor no longer merges its argument in Sinatra 4
  2. ih.size == 0
  3. ih["role"] == seed_hash (returns default, not the value)
  4. ih[:role] == seed_hash (symbol access also returns the default)
  5. require 'rack/protection/encrypted_cookie' raises LoadError — EncryptedCookie was removed from rack-protection 4.x
  6. Rack::Protection.constants does not include :EncryptedCookie
  7. Sinatra::IndifferentHash['role', 'admin', 'id', 7] still populates the hash correctly — only .new(hash) is broken

Fichiers

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

Télécharger l’artefact source (tar.gz)

Seeder d'origine

csx-seed