FAILURE MAP
← Case archive

FA-54381 / Accessibility interaction semantics / Open access

Distinct labels with equal text lose their second contribution · case 01

Distinct labels with equal text lose their second contribution.

Verified by executionVariant 1 · 9 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The text dedupe decision in the label association adapter violates its declared contract.

VERIFIED REPAIR

Apply the exact contract at the text dedupe decision: selected.append(text)

Unsuccessful approach: The local repair substitutes selected.append(text) if not selected or selected[-1] != text else None but still mishandles the regression fixtures.

Case contract

Input [controls,labels,document] controls [id,doc,labelable,wrapping_label], labels [id,doc,for_id,text,order]. Labels with for_id None apply only through wrapping_label; explicit empty for_id never wraps. For each labelable control in document, combine matching labels sorted order, ignoring other documents; repeated text retained but each label ID occurs at most once. Explicit for_id matches exact control ID and overrides wrapping. Preserve text verbatim except skip empty text. Return [control_id,label_texts]. Every control ID is unique within document, labels may repeat IDs; first eligible duplicate wins.

Why this case matters

Offline accessibility bridge model with explicit policy; useful for testing semantic API adapters independently of browser implementations.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    controls,labels,document = data
    result = []
    for ident,doc,labelable,wrapper in controls:
        if doc != document or not labelable: continue
        selected = []
        seen = set()
        for lid,ldoc,target,text,order in sorted(labels,key=lambda row:row[4]):
            if ldoc != document or not text: continue
            match = target == ident if target is not None else lid == wrapper
            if not match or lid in seen: continue
            seen.add(lid)
            selected.append(text) if text not in selected else None
        result.append([ident,selected])
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['c','d',True,'wrap']],[['later','d','c','Second',N+1],['first','d','c','First'+str(N),N],['wrap','d',None,'Wrapped',N+2]],'d'],), [['c',['First'+str(N),'Second','Wrapped']]])
check('contract fixture 2', solve([[['c','d',True,'wrap']],[['wrap','d','other','Wrong',0],['empty','d','','Wrong',1]],'d'],), [['c',[]]])
check('contract fixture 3', solve([[['c','d',True,'wrap'],['foreign','e',True,None],['not','d',False,None]],[['wrap','e',None,'Other doc',0]],'d'],), [['c',[]]])
check('contract fixture 4', solve([[['c','d',True,None]],[['a','d','c','Same',0],['b','d','c','Same',1],['a','d','c','Duplicate ID',2]],'d'],), [['c',['Same','Same']]])
check('contract fixture 5', solve([[['c','d',True,None]],[['a','d','c','',0],['b','d','c',' A ',1]],'d'],), [['c',[' A ']]])
check('contract fixture 6', solve([[['c','d',True,None]],[],'d'],), [['c',[]]])
check('contract fixture 7', solve([[['c','d',True,'wrap']],[['wrap','d','','wrong',0]],'d'],), [['c',[]]])
check('contract fixture 8', solve([[['c','d',True,None]],[['z','d','c','first',0],['a','d','c','second',1]],'d'],), [['c',['first','second']]])
check('contract fixture 9', solve([[],[],'d'],), [])
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
contract fixture 1[['c', ['First1', 'Second', 'Wrapped']]][['c', ['First1', 'Second', 'Wrapped']]]Passed
contract fixture 2[['c', []]][['c', []]]Passed
contract fixture 3[['c', []]][['c', []]]Passed
contract fixture 4[['c', ['Same']]][['c', ['Same', 'Same']]]Failed
contract fixture 5[['c', [' A ']]][['c', [' A ']]]Passed
contract fixture 6[['c', []]][['c', []]]Passed
contract fixture 7[['c', []]][['c', []]]Passed
contract fixture 8[['c', ['first', 'second']]][['c', ['first', 'second']]]Passed
contract fixture 9[][]Passed

SHA-256 / 29492c2764211cc2e8a4574b5605df11b42899ba0fbf46a7ed1b99391ecc0aeb

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    controls,labels,document = data
    result = []
    for ident,doc,labelable,wrapper in controls:
        if doc != document or not labelable: continue
        selected = []
        seen = set()
        for lid,ldoc,target,text,order in sorted(labels,key=lambda row:row[4]):
            if ldoc != document or not text: continue
            match = target == ident if target is not None else lid == wrapper
            if not match or lid in seen: continue
            seen.add(lid)
            selected.append(text) if not selected or selected[-1] != text else None
        result.append([ident,selected])
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['c','d',True,'wrap']],[['later','d','c','Second',N+1],['first','d','c','First'+str(N),N],['wrap','d',None,'Wrapped',N+2]],'d'],), [['c',['First'+str(N),'Second','Wrapped']]])
check('contract fixture 2', solve([[['c','d',True,'wrap']],[['wrap','d','other','Wrong',0],['empty','d','','Wrong',1]],'d'],), [['c',[]]])
check('contract fixture 3', solve([[['c','d',True,'wrap'],['foreign','e',True,None],['not','d',False,None]],[['wrap','e',None,'Other doc',0]],'d'],), [['c',[]]])
check('contract fixture 4', solve([[['c','d',True,None]],[['a','d','c','Same',0],['b','d','c','Same',1],['a','d','c','Duplicate ID',2]],'d'],), [['c',['Same','Same']]])
check('contract fixture 5', solve([[['c','d',True,None]],[['a','d','c','',0],['b','d','c',' A ',1]],'d'],), [['c',[' A ']]])
check('contract fixture 6', solve([[['c','d',True,None]],[],'d'],), [['c',[]]])
check('contract fixture 7', solve([[['c','d',True,'wrap']],[['wrap','d','','wrong',0]],'d'],), [['c',[]]])
check('contract fixture 8', solve([[['c','d',True,None]],[['z','d','c','first',0],['a','d','c','second',1]],'d'],), [['c',['first','second']]])
check('contract fixture 9', solve([[],[],'d'],), [])
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
contract fixture 1[['c', ['First1', 'Second', 'Wrapped']]][['c', ['First1', 'Second', 'Wrapped']]]Passed
contract fixture 2[['c', []]][['c', []]]Passed
contract fixture 3[['c', []]][['c', []]]Passed
contract fixture 4[['c', ['Same']]][['c', ['Same', 'Same']]]Failed
contract fixture 5[['c', [' A ']]][['c', [' A ']]]Passed
contract fixture 6[['c', []]][['c', []]]Passed
contract fixture 7[['c', []]][['c', []]]Passed
contract fixture 8[['c', ['first', 'second']]][['c', ['first', 'second']]]Passed
contract fixture 9[][]Passed

SHA-256 / 30b80345a13b1b23c6e372eb0bb3400b0669e53e508fa0866d91f5237240c650

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(data):
    controls,labels,document = data
    result = []
    for ident,doc,labelable,wrapper in controls:
        if doc != document or not labelable: continue
        selected = []
        seen = set()
        for lid,ldoc,target,text,order in sorted(labels,key=lambda row:row[4]):
            if ldoc != document or not text: continue
            match = target == ident if target is not None else lid == wrapper
            if not match or lid in seen: continue
            seen.add(lid)
            selected.append(text)
        result.append([ident,selected])
    return result
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([[['c','d',True,'wrap']],[['later','d','c','Second',N+1],['first','d','c','First'+str(N),N],['wrap','d',None,'Wrapped',N+2]],'d'],), [['c',['First'+str(N),'Second','Wrapped']]])
check('contract fixture 2', solve([[['c','d',True,'wrap']],[['wrap','d','other','Wrong',0],['empty','d','','Wrong',1]],'d'],), [['c',[]]])
check('contract fixture 3', solve([[['c','d',True,'wrap'],['foreign','e',True,None],['not','d',False,None]],[['wrap','e',None,'Other doc',0]],'d'],), [['c',[]]])
check('contract fixture 4', solve([[['c','d',True,None]],[['a','d','c','Same',0],['b','d','c','Same',1],['a','d','c','Duplicate ID',2]],'d'],), [['c',['Same','Same']]])
check('contract fixture 5', solve([[['c','d',True,None]],[['a','d','c','',0],['b','d','c',' A ',1]],'d'],), [['c',[' A ']]])
check('contract fixture 6', solve([[['c','d',True,None]],[],'d'],), [['c',[]]])
check('contract fixture 7', solve([[['c','d',True,'wrap']],[['wrap','d','','wrong',0]],'d'],), [['c',[]]])
check('contract fixture 8', solve([[['c','d',True,None]],[['z','d','c','first',0],['a','d','c','second',1]],'d'],), [['c',['first','second']]])
check('contract fixture 9', solve([[],[],'d'],), [])
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
contract fixture 1[['c', ['First1', 'Second', 'Wrapped']]][['c', ['First1', 'Second', 'Wrapped']]]Passed
contract fixture 2[['c', []]][['c', []]]Passed
contract fixture 3[['c', []]][['c', []]]Passed
contract fixture 4[['c', ['Same', 'Same']]][['c', ['Same', 'Same']]]Passed
contract fixture 5[['c', [' A ']]][['c', [' A ']]]Passed
contract fixture 6[['c', []]][['c', []]]Passed
contract fixture 7[['c', []]][['c', []]]Passed
contract fixture 8[['c', ['first', 'second']]][['c', ['first', 'second']]]Passed
contract fixture 9[][]Passed

SHA-256 / 46bb14925fab587f95313cdbd6c276258105a97ea10b11ce59240ffc74e649ed

Verification & scope

Stipulated finite adapter contract, not a claim of platform accessibility or ARIA conformance. 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:45:47.864182+00:00.

Case digest / 14f7a907d74f32fc9c00096f33ca3b51d639714ea0d1730775f02207cdf541e9