FAILURE MAP
← Case archive

FA-3131 / Regular expressions / Open access

An absent optional group is conflated with an empty group · case 01

An absent optional group is conflated with an empty group.

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: Parse a name optionally followed by = and any value; distinguish missing value as None.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Parse a name optionally followed by = and any value; distinguish missing value as None.

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

Case contract

Parse a name optionally followed by = and any value; distinguish missing value as 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 x.split('=',1) if '=' in x else [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'), ['a', None])
check('boundary 2', solve('a='), ['a', ''])
check('boundary 3', solve('a=b'), ['a', 'b'])
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 1['a', '']['a', None]Failed
boundary 2['a', '']['a', '']Passed
boundary 3['a', 'b']['a', 'b']Passed
boundary 4['', '']['', '']Passed

SHA-256 / d8d799b6eb406c44a7cd4029b9cfefabc287a41a55af96a259ce2f2eb8c62458

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.partition('=')[0],x.partition('=')[2] or 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('boundary 1', solve('a'), ['a', None])
check('boundary 2', solve('a='), ['a', ''])
check('boundary 3', solve('a=b'), ['a', 'b'])
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 1['a', None]['a', None]Passed
boundary 2['a', None]['a', '']Failed
boundary 3['a', 'b']['a', 'b']Passed
boundary 4['', None]['', '']Failed

SHA-256 / b5b5c7d0c861c5d04b513cb42d947da469e32736ea4b8e113d42edadb01ac0db

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.partition('=')[0],x.partition('=')[2] if '=' in x else 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('boundary 1', solve('a'), ['a', None])
check('boundary 2', solve('a='), ['a', ''])
check('boundary 3', solve('a=b'), ['a', 'b'])
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 1['a', None]['a', None]Passed
boundary 2['a', '']['a', '']Passed
boundary 3['a', 'b']['a', 'b']Passed
boundary 4['', '']['', '']Passed

SHA-256 / f6246f26d74c41a36e8043c9b0fa8b83ee14302455c118762dbc878b6410550c

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

Case digest / edfd9720cfdc8d3417971d736c86cc1fd0d100e8ea49ecba75c10f1bd5158fca