FAILURE MAP
← Case archive

FA-3251 / Markup / Open access

An empty XML attribute collapses into a missing attribute · case 01

An empty XML attribute collapses into a missing attribute.

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: Return the root id attribute or None if absent; retain empty string.

VERIFIED REPAIR

Implement the complete stated contract, including the boundary fixtures: Return the root id attribute or None if absent; retain empty string.

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

Case contract

Return the root id attribute or None if absent; retain empty string.

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 ET.fromstring(x).get('id') 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('<r id=""/>'), '')
check('boundary 2', solve('<r/>'), None)
check('boundary 3', solve('<r id="0"/>'), '0')
check('boundary 4', solve('<r id="a&amp;b"/>'), 'a&b')
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 1NoneFailed
boundary 2NoneNonePassed
boundary 300Passed
boundary 4a&ba&bPassed

SHA-256 / ee0175a5fbe0fb36d5aece2d07d04106e0bed50a4a007031bf02a0d7039f9058

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 ET.fromstring(x).get('id','')
    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('<r id=""/>'), '')
check('boundary 2', solve('<r/>'), None)
check('boundary 3', solve('<r id="0"/>'), '0')
check('boundary 4', solve('<r id="a&amp;b"/>'), 'a&b')
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 1Passed
boundary 2NoneFailed
boundary 300Passed
boundary 4a&ba&bPassed

SHA-256 / 3362934a3d7e65f82a4979d064803ad3c181bd9a7fdd38471f45f443585a9658

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 ET.fromstring(x).get('id')
    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('<r id=""/>'), '')
check('boundary 2', solve('<r/>'), None)
check('boundary 3', solve('<r id="0"/>'), '0')
check('boundary 4', solve('<r id="a&amp;b"/>'), 'a&b')
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 1Passed
boundary 2NoneNonePassed
boundary 300Passed
boundary 4a&ba&bPassed

SHA-256 / 8c09ca9765182c0af1f159b498ef9a960b1a7f682341e0077c99680919354f3b

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

Case digest / e10ed90854e4920a31f5876beb2472caab7efd5f4be112d859ef49abbdbbb15b