CodeSampleX

Exemplo

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

Amostra verificada para gem sinatra 4.2.1: Sinatra 4 removes the IndifferentHash initializer that merged a hash argument, silently producing an empty hash…

sha256:505354b2db0a9e15b3c1720605ee174c820a6c6345acea3e8f620bc078351ab0

Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu. Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas. MIT-0

Evidência de execução

O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.

Base da evidência
Contrato assinado aprovado
Recibos de verificação
2
Chaves de assinatura que o compilaram
1
Ambiente declarado ruby linux x64 ruby ruby bundler

Ambientes das execuções de verificação

Ambiente Contrato Etapas Execução
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

Caso

HOW
Objetivo
Sinatra 4 removes the IndifferentHash initializer that merged a hash argument, silently producing an empty hash with the argument as the default value instead
Pacotes
Símbolos
  • Sinatra::IndifferentHash
  • Sinatra::IndifferentHash.new
  • Rack::Protection::EncryptedCookie
Ambiente
ruby
Criado
2026-08-16T17:07:41Z

Contrato

  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

Arquivos

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

Baixar o artefato de código-fonte (tar.gz)

Seeder de origem

csx-seed