FA-4006 / Markup / Open access
Element matching relies on a source prefix spelling · case 01
Element matching relies on a source prefix spelling.
ROOT CAUSE
The implementation applies an operation whose text or grammar semantics violate this contract: Count direct children whose expanded name is {urn:a}x independent of prefix.
VERIFIED REPAIR
Implement the complete stated contract, including the boundary fixtures: Count direct children whose expanded name is {urn:a}x independent of prefix.
Unsuccessful approach: The attempted repair handles the primary example but still violates a separate boundary of the same contract.
Case contract
Count direct children whose expanded name is {urn:a}x independent of prefix.
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.count('<a: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('<r xmlns:q="urn:a"><q:x/></r>'), 1)
check('boundary 2', solve('<r xmlns:a="urn:b"><a:x/></r>'), 0)
check('boundary 3', solve('<r><x/></r>'), 0)
check('boundary 4', solve('<r xmlns="urn:a"><x/><x/></r>'), 2)
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 | 0 | 1 | Failed |
| boundary 2 | 1 | 0 | Failed |
| boundary 3 | 0 | 0 | Passed |
| boundary 4 | 0 | 2 | Failed |
SHA-256 / d502f63081e8a1ff43e0ad17bf3053ef5a98f9bdd8d67307892e43a3398fc50c
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 sum(e.tag.rsplit('}',1)[-1]=='x' for e in ET.fromstring(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('<r xmlns:q="urn:a"><q:x/></r>'), 1)
check('boundary 2', solve('<r xmlns:a="urn:b"><a:x/></r>'), 0)
check('boundary 3', solve('<r><x/></r>'), 0)
check('boundary 4', solve('<r xmlns="urn:a"><x/><x/></r>'), 2)
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 | 1 | 0 | Failed |
| boundary 3 | 1 | 0 | Failed |
| boundary 4 | 2 | 2 | Passed |
SHA-256 / 9b4086f3c9b63dee53488a6aa266eb317af1ec5d0bf4c85d19633cfc8704a82e
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 len(ET.fromstring(x).findall('{urn:a}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('<r xmlns:q="urn:a"><q:x/></r>'), 1)
check('boundary 2', solve('<r xmlns:a="urn:b"><a:x/></r>'), 0)
check('boundary 3', solve('<r><x/></r>'), 0)
check('boundary 4', solve('<r xmlns="urn:a"><x/><x/></r>'), 2)
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 | 0 | 0 | Passed |
| boundary 3 | 0 | 0 | Passed |
| boundary 4 | 2 | 2 | Passed |
SHA-256 / 2f3462e11aff1d73833fc04cbeeed8ff696a2b160a91c9c749b88e418c217459
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:34.395268+00:00.
Case digest / 0a686d656632147a10a94ec6e81546656729554de14d6cec74c1458f02141217