FAILURE MAP
← Case archive

FA-100176 / Annotation span alignment / Open access

Nested annotations are sorted by end before start · case 01

Nested annotations are sorted by end before start.

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

ROOT CAUSE

Sorting by end position places a short nested span before its container.

THE FAILURE

Sorting by end position places a short nested span before its container.

Unsuccessful approach: Sorting by start alone leaves equal-start annotations nondeterministic.

Case contract

Return [start,end,label] spans sorted by start ascending, then end descending, then label ascending.

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):
    return sorted(spans,key=lambda x:(x[1],x[0],x[2]))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested first container', solve([[2,4,'b'],[2,9,'a'],[1,3,'z']]), [[1,3,'z'],[2,9,'a'],[2,4,'b']])
check('equal bounds label tie', solve([[0,2,'z'],[0,2,'a']]), [[0,2,'a'],[0,2,'z']])
check('later start', solve([[4,5,'x'],[1,8,'y']]), [[1,8,'y'],[4,5,'x']])
check('empty list', solve([]), [])
check('singleton', solve([[N,N+1,'x']]), [[N,N+1,'x']])
check('same start long first', solve([[N,N+2,'b'],[N,N+3,'a']]), [[N,N+3,'a'],[N,N+2,'b']])
check('same length labels', solve([[3,6,'b'],[3,6,'a']]), [[3,6,'a'],[3,6,'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
nested first container[[1, 3, 'z'], [2, 4, 'b'], [2, 9, 'a']][[1, 3, 'z'], [2, 9, 'a'], [2, 4, 'b']]Failed
equal bounds label tie[[0, 2, 'a'], [0, 2, 'z']][[0, 2, 'a'], [0, 2, 'z']]Passed
later start[[4, 5, 'x'], [1, 8, 'y']][[1, 8, 'y'], [4, 5, 'x']]Failed
empty list[][]Passed
singleton[[1, 2, 'x']][[1, 2, 'x']]Passed
same start long first[[1, 3, 'b'], [1, 4, 'a']][[1, 4, 'a'], [1, 3, 'b']]Failed
same length labels[[3, 6, 'a'], [3, 6, 'b']][[3, 6, 'a'], [3, 6, 'b']]Passed

SHA-256 / 3b71eca9597833024c072e2820906216e51e36e9c869a86c98d579cbea0ea90c

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(spans):
    return sorted(spans,key=lambda x:x[0])
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('nested first container', solve([[2,4,'b'],[2,9,'a'],[1,3,'z']]), [[1,3,'z'],[2,9,'a'],[2,4,'b']])
check('equal bounds label tie', solve([[0,2,'z'],[0,2,'a']]), [[0,2,'a'],[0,2,'z']])
check('later start', solve([[4,5,'x'],[1,8,'y']]), [[1,8,'y'],[4,5,'x']])
check('empty list', solve([]), [])
check('singleton', solve([[N,N+1,'x']]), [[N,N+1,'x']])
check('same start long first', solve([[N,N+2,'b'],[N,N+3,'a']]), [[N,N+3,'a'],[N,N+2,'b']])
check('same length labels', solve([[3,6,'b'],[3,6,'a']]), [[3,6,'a'],[3,6,'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
nested first container[[1, 3, 'z'], [2, 4, 'b'], [2, 9, 'a']][[1, 3, 'z'], [2, 9, 'a'], [2, 4, 'b']]Failed
equal bounds label tie[[0, 2, 'z'], [0, 2, 'a']][[0, 2, 'a'], [0, 2, 'z']]Failed
later start[[1, 8, 'y'], [4, 5, 'x']][[1, 8, 'y'], [4, 5, 'x']]Passed
empty list[][]Passed
singleton[[1, 2, 'x']][[1, 2, 'x']]Passed
same start long first[[1, 3, 'b'], [1, 4, 'a']][[1, 4, 'a'], [1, 3, 'b']]Failed
same length labels[[3, 6, 'b'], [3, 6, 'a']][[3, 6, 'a'], [3, 6, 'b']]Failed

SHA-256 / 81d459bdb18b64a81ba06867fcf20787e539c0ad8bb915b94d55d0120450fe48

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

Case digest / ed1898691b8d0d56c3ca4b5ebb732e846ab2a3e9d6a2cdf3699ddecd6244a21d