Beispiel
Navigate JSON.load post-order proc reentrancy, parser non-streaming execution, duplicate key insertion order retention, and thread-isolated create_id state
sha256:4446799069db9d6052634d0561fe6a6376acf2b7b6f8bdd9f65fdbc11098861b
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Fall
- Ziel
- Navigate JSON.load post-order proc reentrancy, parser non-streaming execution, duplicate key insertion order retention, and thread-isolated create_id state HOW
- Pakete
- json 2.9.1
- Umgebung
- ruby
- Erstellt
- 2026-08-17T02:43:33Z
Häufige Annahme
JSON.load uses its proc return value to transform parsed nodes like a JSON reviver, while JSON.create_id modifies process-global state shared across all threads.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- assert JSON.load invokes its proc in post-order depth-first traversal but ignores the proc return value, leaving parsed elements unchanged unless mutated in-place
- assert JSON.load supports reentrant parsing inside the proc to deserialize embedded JSON strings into parent container structures
- assert JSON::Parser parses only the initial document and raises JSON::ParserError on concatenated documents rather than streaming
- assert JSON.parse duplicate key collisions update the value while preserving the original key's initial index in hash insertion order
- assert JSON.create_id is isolated in Thread.current so mutating create_id in one thread does not alter addition instantiation in other threads
Dateien
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- src/json_reentrancy.rb
- test/contract.rb
Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief
Ursprungs-Seeder
Verifizierungsbelege
- ruby 3 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · rubygems@1 · 2026-08-17 · ed25519:d91480838ac982c9