FAILURE MAP
← Case archive

FA-100156 / Annotation span alignment / Open access

Token index maps to the wrong character boundary · case 01

Token index maps to the wrong character boundary.

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

ROOT CAUSE

Token offsets are calculated from token widths without intervening separators.

THE FAILURE

Token offsets are calculated from token widths without intervening separators.

Unsuccessful approach: Using the previous token end works only when adjacent tokens have no gap.

Case contract

Given token intervals [start,end), return the start offset at index i; index equal to token count maps to final end; invalid indices return -1.

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(tokens, i):
    return tokens[i][0] if i<len(tokens) else (tokens[-1][1] if tokens else 0)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('first token', solve([[N,N+2],[N+5,N+7]],0), N)
check('second token after gap', solve([[0,2],[5,8]],1), 5)
check('terminal boundary', solve([[1,3],[6,9]],2), 9)
check('negative index', solve([[1,3]],-1), -1)
check('past terminal', solve([[1,3]],2), -1)
check('empty token list origin', solve([],0), 0)
check('singleton start', solve([[N,N+1]],0), N)
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
first token11Passed
second token after gap55Passed
terminal boundary99Passed
negative index1-1Failed
past terminal3-1Failed
empty token list origin00Passed
singleton start11Passed

SHA-256 / bdad176652b688d09953ed37baa3eee4ee2bd31912eaf027cbca061e9e9df007

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(tokens, i):
    return tokens[i-1][1] if i>0 and i<=len(tokens) else (-1 if i<0 or i>len(tokens) else (tokens[0][0] if tokens else 0))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('first token', solve([[N,N+2],[N+5,N+7]],0), N)
check('second token after gap', solve([[0,2],[5,8]],1), 5)
check('terminal boundary', solve([[1,3],[6,9]],2), 9)
check('negative index', solve([[1,3]],-1), -1)
check('past terminal', solve([[1,3]],2), -1)
check('empty token list origin', solve([],0), 0)
check('singleton start', solve([[N,N+1]],0), N)
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
first token11Passed
second token after gap25Failed
terminal boundary99Passed
negative index-1-1Passed
past terminal-1-1Passed
empty token list origin00Passed
singleton start11Passed

SHA-256 / 6bf3e4322bad8535d763993042d31e26d78800b8292693a7fafb1380e30b9e7f

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

Case digest / 0a851c6a111adb21b5d25aca7dd01a795796fecb1127de0ced4e3a86099cfe72