FAILURE MAP
← Case archive

FA-100171 / Annotation span alignment / Open access

Adjacent same-label spans remain fragmented · case 01

Adjacent same-label spans remain fragmented.

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

ROOT CAUSE

The coalescer merges overlap but omits exactly adjacent intervals.

THE FAILURE

The coalescer merges overlap but omits exactly adjacent intervals.

Unsuccessful approach: Merging all overlapping spans combines annotations whose labels differ.

Case contract

Input spans are ordered [start,end,label]. Merge touching or overlapping spans with equal labels; preserve input order and keep different labels separate.

Why this case matters

A small offline annotation transformation keeps span coordinates explicit when text or token boundaries change.

1 / The failure

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

N = 1
observations = []
def solve(spans):
    out=[]
    for s,e,l in spans:
     if out and out[-1][2]==l and s<out[-1][1]: out[-1][1]=max(out[-1][1],e)
     else: out.append([s,e,l])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('adjacent same label', solve([[0,N,'a'],[N,N+2,'a']]), [[0,N+2,'a']])
check('gap retained', solve([[0,2,'a'],[3,5,'a']]), [[0,2,'a'],[3,5,'a']])
check('different labels retained', solve([[0,3,'a'],[3,5,'b']]), [[0,3,'a'],[3,5,'b']])
check('overlap same label', solve([[0,4,'a'],[2,6,'a']]), [[0,6,'a']])
check('empty input', solve([]), [])
check('singleton unchanged', solve([[N,N+1,'x']]), [[N,N+1,'x']])
check('nested different label', solve([[0,8,'a'],[2,3,'b']]), [[0,8,'a'],[2,3,'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
adjacent same label[[0, 1, 'a'], [1, 3, 'a']][[0, 3, 'a']]Failed
gap retained[[0, 2, 'a'], [3, 5, 'a']][[0, 2, 'a'], [3, 5, 'a']]Passed
different labels retained[[0, 3, 'a'], [3, 5, 'b']][[0, 3, 'a'], [3, 5, 'b']]Passed
overlap same label[[0, 6, 'a']][[0, 6, 'a']]Passed
empty input[][]Passed
singleton unchanged[[1, 2, 'x']][[1, 2, 'x']]Passed
nested different label[[0, 8, 'a'], [2, 3, 'b']][[0, 8, 'a'], [2, 3, 'b']]Passed

SHA-256 / ba526f459a16b96b00fa8bb8f472cbff862df7363ac5b985c0f1402b6c32222e

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(spans):
    out=[]
    for s,e,l in spans:
     if out and s<=out[-1][1]: out[-1][1]=max(out[-1][1],e)
     else: out.append([s,e,l])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('adjacent same label', solve([[0,N,'a'],[N,N+2,'a']]), [[0,N+2,'a']])
check('gap retained', solve([[0,2,'a'],[3,5,'a']]), [[0,2,'a'],[3,5,'a']])
check('different labels retained', solve([[0,3,'a'],[3,5,'b']]), [[0,3,'a'],[3,5,'b']])
check('overlap same label', solve([[0,4,'a'],[2,6,'a']]), [[0,6,'a']])
check('empty input', solve([]), [])
check('singleton unchanged', solve([[N,N+1,'x']]), [[N,N+1,'x']])
check('nested different label', solve([[0,8,'a'],[2,3,'b']]), [[0,8,'a'],[2,3,'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
adjacent same label[[0, 3, 'a']][[0, 3, 'a']]Passed
gap retained[[0, 2, 'a'], [3, 5, 'a']][[0, 2, 'a'], [3, 5, 'a']]Passed
different labels retained[[0, 5, 'a']][[0, 3, 'a'], [3, 5, 'b']]Failed
overlap same label[[0, 6, 'a']][[0, 6, 'a']]Passed
empty input[][]Passed
singleton unchanged[[1, 2, 'x']][[1, 2, 'x']]Passed
nested different label[[0, 8, 'a']][[0, 8, 'a'], [2, 3, 'b']]Failed

SHA-256 / 250437bc4b235225c46dfd15219dfc78f2b3d84bef37246860a95b9c7c4cdba6

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

Verification & scope

Contracts use integer offsets, explicit edits, and supplied token boundaries; they do not define a tokenizer or production annotation format. 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-30T16:48:32.646853+00:00.

Case digest / acb4cab1603042f66ba368c0bdd1c8ff373f5427bffd32617f0ee51c1ca33a32