Sample
Enforce JSON gem 2.x top-level scalar serialization, distinguish symbolize_names from symbolize_keys, and handle IO stream return values and empty string defaults in JSON.load
sha256:11b68ca217837cb2a5baf3ef7bd8bda4524866b9eccedef9840bab91c2e1098f
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Case
- Goal
- Enforce JSON gem 2.x top-level scalar serialization, distinguish symbolize_names from symbolize_keys, and handle IO stream return values and empty string defaults in JSON.load HOW
- Packages
- json 2.9.1
- Environment
- ruby
- Created
- 2026-08-17T02:44:27Z
Commonly assumed
JSON.generate and JSON.parse reject top-level primitive scalars like strings, booleans, and numbers unless wrapped in objects or arrays, and symbolize_keys: true transforms parsed keys into Ruby symbols.
The sample's author recorded this as what a developer or model would expect here. The contract below is what actually ran.
Contract
- assert JSON.generate and JSON.parse serialize and deserialize top-level primitive strings, numbers, booleans, and nil directly without quirks mode, while symbolize_keys is silently ignored leaving string keys unless symbolize_names is used
- assert JSON.load with an empty string returns nil via default allow_blank but raises JSON::ParserError on non-empty whitespace, whereas JSON.parse raises JSON::ParserError on both
- assert JSON.dump with an IO destination writes the payload and returns the IO instance itself rather than the generated JSON string
- assert JSON.dump depth limit violation raises ArgumentError whereas JSON.generate depth limit violation raises JSON::NestingError
- assert JSON.dump with keyword arguments like indent raises ArgumentError for unknown keywords instead of configuring pretty printing
Files
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- src/json_v2_core.rb
- 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-17 · ed25519:d91480838ac982c9