FAILURE MAP
← Case archive

FA-3156 / Serialization / Open access

Nonstandard numeric constants enter a JSON document · case 01

Nonstandard numeric constants enter a JSON document.

Verified by executionVariant 1 · 4 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The implementation applies an operation whose text or grammar semantics violate this contract: Decode JSON and reject NaN or Infinity anywhere by returning None.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Decode JSON and reject NaN or Infinity anywhere by returning None.

Unsuccessful approach: The attempted repair handles the primary example but still violates a separate boundary of the same contract.

Case contract

Decode JSON and reject NaN or Infinity anywhere by returning None.

Why this case matters

A local executable model for consumers of structured text; oracle values are authored literals, not outputs copied from the repaired implementation.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return json.loads(x)
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('NaN rejected', solve('NaN') is None, True)
check('nested Infinity rejected', solve('[Infinity]') is None, True)
check('boundary 3', solve('"NaN"'), 'NaN')
check('boundary 4', solve('[1]'), [1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
NaN rejectedFalseTrueFailed
nested Infinity rejectedFalseTrueFailed
boundary 3NaNNaNPassed
boundary 4[1][1]Passed

SHA-256 / 079310894f3ac2682f7a513516d8282773c6368621a47a66a3bbf3c3d297e9ee

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        return None if 'NaN' in x else json.loads(x)
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('NaN rejected', solve('NaN') is None, True)
check('nested Infinity rejected', solve('[Infinity]') is None, True)
check('boundary 3', solve('"NaN"'), 'NaN')
check('boundary 4', solve('[1]'), [1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
NaN rejectedTrueTruePassed
nested Infinity rejectedFalseTrueFailed
boundary 3NoneNaNFailed
boundary 4[1][1]Passed

SHA-256 / 301f46bd811a632e534c9817d3f63aa5f1aa30a5edff2e5094649bb91e8d69b7

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import re, unicodedata, json, csv, io, html, base64, binascii, codecs, struct
from urllib.parse import quote, unquote, unquote_to_bytes, urlencode, parse_qsl, urlsplit, urlunsplit
from email.header import decode_header, make_header
from email.utils import getaddresses
from xml.etree import ElementTree as ET
import shlex, string, textwrap

N = 1
observations = []
def solve(x):
    try:
        try:
            return json.loads(x,parse_constant=lambda v: (_ for _ in ()).throw(ValueError(v)))
        except ValueError:
            return None
    except Exception as exc:
        return {"error": type(exc).__name__}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('NaN rejected', solve('NaN') is None, True)
check('nested Infinity rejected', solve('[Infinity]') is None, True)
check('boundary 3', solve('"NaN"'), 'NaN')
check('boundary 4', solve('[1]'), [1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
NaN rejectedTrueTruePassed
nested Infinity rejectedTrueTruePassed
boundary 3NaNNaNPassed
boundary 4[1][1]Passed

SHA-256 / c728a9e5df80c9e6acdf618278d9fa1b6f6ca542f9d73269f406869d918371b7

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:37:22.196879+00:00.

Case digest / 2c98be75937c306799a7c7bf3d8970adb9a9763fb4d0dab67e293a4730547edf