FAILURE MAP
← Case archive

FA-3181 / Serialization / Open access

Pointer token escaping recursively escapes inserted text · case 01

Pointer token escaping recursively escapes inserted text.

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: Encode a JSON Pointer token by escaping tilde before slash.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Encode a JSON Pointer token by escaping tilde before slash.

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

Case contract

Encode a JSON Pointer token by escaping tilde before slash.

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('/','~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('a/b'), 'a~1b')
check('boundary 2', solve('~1'), '~01')
check('boundary 3', solve('~/'), '~0~1')
check('boundary 4', solve(''), '')
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
boundary 1a~01ba~1bFailed
boundary 2~01~01Passed
boundary 3~0~01~0~1Failed
boundary 4Passed

SHA-256 / 4d8a7f03c70dc28fb7d4690070fca10e8f2e60fd7663227e38755b032fe74a1f

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('a/b'), 'a~1b')
check('boundary 2', solve('~1'), '~01')
check('boundary 3', solve('~/'), '~0~1')
check('boundary 4', solve(''), '')
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
boundary 1a~1ba~1bPassed
boundary 2~1~01Failed
boundary 3~~1~0~1Failed
boundary 4Passed

SHA-256 / 8b1f5823bea4955ecd15395c8e2b1928f7e33957e7e5dc44aa849f114ad0f29a

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('~','~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('a/b'), 'a~1b')
check('boundary 2', solve('~1'), '~01')
check('boundary 3', solve('~/'), '~0~1')
check('boundary 4', solve(''), '')
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
boundary 1a~1ba~1bPassed
boundary 2~01~01Passed
boundary 3~0~1~0~1Passed
boundary 4Passed

SHA-256 / c2f6f008aad497cea7651a7544f60f488d47f6775d51ff66d8257ddfeb631092

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.493472+00:00.

Case digest / c6931a2ba8badafad70e7289ebc3e4f76417583879745d898101c259c7833a9c