FA-3176 / Serialization / Open access
JSON Pointer escape replacement runs in reverse order · case 01
JSON Pointer escape replacement runs in reverse order.
ROOT CAUSE
The implementation applies an operation whose text or grammar semantics violate this contract: Decode a single JSON Pointer token: ~1 becomes slash, then ~0 becomes tilde.
VERIFIED REPAIR
Implement the complete stated contract, including the boundary fixtures: Decode a single JSON Pointer token: ~1 becomes slash, then ~0 becomes tilde.
Unsuccessful approach: The attempted repair handles the primary example but still violates a separate boundary of the same contract.
Case contract
Decode a single JSON Pointer token: ~1 becomes slash, then ~0 becomes tilde.
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 x.replace('~0','~').replace('~1','/')
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('boundary 1', solve('~01'), '~1')
check('boundary 2', solve('a~1b'), 'a/b')
check('boundary 3', solve('~0'), '~')
check('boundary 4', solve('x'), 'x')
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary 1 | / | ~1 | Failed |
| boundary 2 | a/b | a/b | Passed |
| boundary 3 | ~ | ~ | Passed |
| boundary 4 | x | x | Passed |
SHA-256 / 7055617d58194a6b5f22f783ee42657974baf414c1e1efc141422212a702bad2
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 x.replace('~1','/')
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('boundary 1', solve('~01'), '~1')
check('boundary 2', solve('a~1b'), 'a/b')
check('boundary 3', solve('~0'), '~')
check('boundary 4', solve('x'), 'x')
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary 1 | ~01 | ~1 | Failed |
| boundary 2 | a/b | a/b | Passed |
| boundary 3 | ~0 | ~ | Failed |
| boundary 4 | x | x | Passed |
SHA-256 / 27394cec4a5240d7dba1e9cc72be788a15a1ddfe3fd93c494526db4e8f980de7
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:
return x.replace('~1','/').replace('~0','~')
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('boundary 1', solve('~01'), '~1')
check('boundary 2', solve('a~1b'), 'a/b')
check('boundary 3', solve('~0'), '~')
check('boundary 4', solve('x'), 'x')
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| boundary 1 | ~1 | ~1 | Passed |
| boundary 2 | a/b | a/b | Passed |
| boundary 3 | ~ | ~ | Passed |
| boundary 4 | x | x | Passed |
SHA-256 / 9cc6204740c30d36a84462b3c7bdfb7baeea34b09ef76a685182063e718546f3
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.265807+00:00.
Case digest / 6625a43aac8e122c272b6228c3676858313cf67a3fa2a9dd98a7e52c245d5e31