CodeSampleX

Sample

sorbet-runtime 0.6.13427: Handle T::Enum serialization, deserialization, type contracts, and T::Struct subclassing restrictions in sorbet-runtime

Verified sample for gem sorbet-runtime 0.6.13427: Handle T::Enum serialization, deserialization, type contracts, and T::Struct subclassing restrictions in…

sha256:e670e1091ab22e46ce68006e734aa4cde0ed100b0682a748df26780705c0d94e

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 bundler

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
Handle T::Enum serialization, deserialization, type contracts, and T::Struct subclassing restrictions in sorbet-runtime
Packages
Symbols
  • T::Enum
  • T::Struct
  • T::Sig
  • T.nilable
  • T.any
  • T::Configuration
Environment
ruby
Created
2026-08-16T17:10:12Z

Contract

  1. assert T::Enum instances are not equal to strings or symbols, and that passing a raw string to a T::Enum parameter raises TypeError
  2. assert from_serialized raises KeyError on unknown strings rather than returning nil, and try_deserialize is the method that returns nil
  3. assert default serialization converts constant names to lowercase strings rather than preserving constant casing
  4. assert instantiating a T::Enum subclass after initialization raises RuntimeError
  5. assert subclassing a T::Struct raises RuntimeError and constructor rejects unknown keyword arguments with ArgumentError
  6. assert type combinators use T.nilable and T.any because T.optional, T.union, and T.intersection do not exist
  7. assert T::Configuration.call_validation_error_handler can intercept signature failures to prevent raising TypeError

Files

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

Download the source artifact (tar.gz)

Origin Seeder

csx-seed