FAILURE MAP
← Case archive

FA-100216 / Annotation span alignment / Open access

Repeated mention alignment always selects the first occurrence · case 01

Repeated mention alignment always selects the first occurrence.

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

ROOT CAUSE

Occurrence lookup ignores the cursor after the prior annotation.

THE FAILURE

Occurrence lookup ignores the cursor after the prior annotation.

Unsuccessful approach: Allowing an empty needle returns the cursor as a zero-width match instead of rejecting it.

Case contract

Return [start,end) for the first occurrence of needle at or after cursor, or None. Empty needle is invalid.

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(text, needle, cursor):
    i=text.find(needle); return [i,i+len(needle)] if i>=0 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second repeated mention', solve('cat and cat','cat',4), [8,11])
check('cursor inside earlier match', solve('banana','ana',2), [3,6])
check('no later match', solve('cat cat','cat',5), None)
check('empty needle', solve('abc','',0), None)
check('single occurrence', solve('x'+str(N),'x',0), [0,1])
check('match at cursor', solve('abc','b',1), [1,2])
check('empty text', solve('','a',0), None)
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
second repeated mention[0, 3][8, 11]Failed
cursor inside earlier match[1, 4][3, 6]Failed
no later match[0, 3]NoneFailed
empty needle[0, 0]NoneFailed
single occurrence[0, 1][0, 1]Passed
match at cursor[1, 2][1, 2]Passed
empty textNoneNonePassed

SHA-256 / 0613bf3e14291fb79310bac79610685cb4281647f1ff99e7371d6746a35f6807

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(text, needle, cursor):
    i=text.find(needle,cursor); return [i,i+len(needle)] if i>=0 else None
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('second repeated mention', solve('cat and cat','cat',4), [8,11])
check('cursor inside earlier match', solve('banana','ana',2), [3,6])
check('no later match', solve('cat cat','cat',5), None)
check('empty needle', solve('abc','',0), None)
check('single occurrence', solve('x'+str(N),'x',0), [0,1])
check('match at cursor', solve('abc','b',1), [1,2])
check('empty text', solve('','a',0), None)
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
second repeated mention[8, 11][8, 11]Passed
cursor inside earlier match[3, 6][3, 6]Passed
no later matchNoneNonePassed
empty needle[0, 0]NoneFailed
single occurrence[0, 1][0, 1]Passed
match at cursor[1, 2][1, 2]Passed
empty textNoneNonePassed

SHA-256 / 8ca5ede1e9fee59ae65a3bf5b27db597c45c4f83087f402e8e6aaff5a5e53aa6

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

Case digest / a245f9a32bf27e676d9d50e0418ccb37efb47b446a8d19b91257cb7f11f72546