FAILURE MAP
← Case archive

FA-100206 / Annotation span alignment / Open access

Leading whitespace trim leaves annotation offsets stale · case 01

Leading whitespace trim leaves annotation offsets stale.

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

ROOT CAUSE

Text trimming removes characters but associated spans keep their source offsets.

THE FAILURE

Text trimming removes characters but associated spans keep their source offsets.

Unsuccessful approach: Subtracting the trim count from both endpoints creates negative starts for clipped spans.

Case contract

Trim k characters from the front. Keep spans with end>k, clip start to k, and rebase surviving endpoints by k.

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, k):
    return [[s,e,l] for s,e,l in spans if e>k]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('after trim', solve([[N+2,N+5,'a']],N), [[2,5,'a']])
check('crosses trim point', solve([[N-2,N+2,'b']],N), [[0,2,'b']])
check('fully trimmed', solve([[0,N,'c']],N), [])
check('touch point empty', solve([[N,N+2,'d']],N), [[0,2,'d']])
check('empty input', solve([],N), [])
check('zero trim', solve([[1,3,'x']],0), [[1,3,'x']])
check('span begins at new origin', solve([[N,N+1,'x']],N), [[0,1,'x']])
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
after trim[[3, 6, 'a']][[2, 5, 'a']]Failed
crosses trim point[[-1, 3, 'b']][[0, 2, 'b']]Failed
fully trimmed[][]Passed
touch point empty[[1, 3, 'd']][[0, 2, 'd']]Failed
empty input[][]Passed
zero trim[[1, 3, 'x']][[1, 3, 'x']]Passed
span begins at new origin[[1, 2, 'x']][[0, 1, 'x']]Failed

SHA-256 / 2c6090aade7d8d6d2e76797f3c9c108318fef5a142f296aed6dab23f8a08f3bb

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(spans, k):
    return [[s-k,e-k,l] for s,e,l in spans if e>k]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('after trim', solve([[N+2,N+5,'a']],N), [[2,5,'a']])
check('crosses trim point', solve([[N-2,N+2,'b']],N), [[0,2,'b']])
check('fully trimmed', solve([[0,N,'c']],N), [])
check('touch point empty', solve([[N,N+2,'d']],N), [[0,2,'d']])
check('empty input', solve([],N), [])
check('zero trim', solve([[1,3,'x']],0), [[1,3,'x']])
check('span begins at new origin', solve([[N,N+1,'x']],N), [[0,1,'x']])
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
after trim[[2, 5, 'a']][[2, 5, 'a']]Passed
crosses trim point[[-2, 2, 'b']][[0, 2, 'b']]Failed
fully trimmed[][]Passed
touch point empty[[0, 2, 'd']][[0, 2, 'd']]Passed
empty input[][]Passed
zero trim[[1, 3, 'x']][[1, 3, 'x']]Passed
span begins at new origin[[0, 1, 'x']][[0, 1, 'x']]Passed

SHA-256 / d2751fee877940b8f20f5bce2ce8bc907860a6e41db08e220b8f61c1c40a16a4

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

Case digest / 92c4260d36cef3c15327772a39715a8997960c692f3e55822cb3b508443f2967