FAILURE MAP
← Case archive

FA-3291 / Serialization / Open access

A list-valued query field becomes a Python representation · case 01

A list-valued query field becomes a Python representation.

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 ordered pairs expanding sequence values into repeated keys.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Encode ordered pairs expanding sequence values into repeated keys.

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

Case contract

Encode ordered pairs expanding sequence values into repeated keys.

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 urlencode(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('boundary 1', solve([['a', ['1', '2']]]), 'a=1&a=2')
check('boundary 2', solve([['x', []]]), '')
check('boundary 3', solve([['x', 'a b']]), 'x=a+b')
check('boundary 4', solve([['a', ['']]]), 'a=')
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 1{'error': 'TypeError'}a=1&a=2Failed
boundary 2{'error': 'TypeError'}Failed
boundary 3{'error': 'TypeError'}x=a+bFailed
boundary 4{'error': 'TypeError'}a=Failed

SHA-256 / dbe3d0d1be33f841f86aaff9ce4f13ac7d586608da4e9f82d037a3946cccd66f

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 urlencode([(k,','.join(v) if isinstance(v,list) else v) for k,v in 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('boundary 1', solve([['a', ['1', '2']]]), 'a=1&a=2')
check('boundary 2', solve([['x', []]]), '')
check('boundary 3', solve([['x', 'a b']]), 'x=a+b')
check('boundary 4', solve([['a', ['']]]), 'a=')
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=1%2C2a=1&a=2Failed
boundary 2x=Failed
boundary 3x=a+bx=a+bPassed
boundary 4a=a=Passed

SHA-256 / 57a1ec88051c9d23ead44e0d06f9c936c805bf9b1a565261e7eb0de399f975e5

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 urlencode([tuple(p) for p in x],doseq=True)
    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', ['1', '2']]]), 'a=1&a=2')
check('boundary 2', solve([['x', []]]), '')
check('boundary 3', solve([['x', 'a b']]), 'x=a+b')
check('boundary 4', solve([['a', ['']]]), 'a=')
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=1&a=2a=1&a=2Passed
boundary 2Passed
boundary 3x=a+bx=a+bPassed
boundary 4a=a=Passed

SHA-256 / 5c33bb41b93e3a6f8c9f924dcb7d38f22b49e03088febed71be668de7a736b44

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

Case digest / f89400ea2e8a6d066ddf85d8b952240b5e52cae5bf840339cf436f1575b030b5