FAILURE MAP
← Case archive

FA-83856 / Sports scoring and tiebreakers / Open access

Rally log validation ignores the end-of-game cutoff · case 01

Corrupt characters are silently skipped or trailing garbage after a finished game is reported as an error.

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

ROOT CAUSE

Unknown characters are skipped instead of producing the invalid-point result when they are reached.

VERIFIED REPAIR

Report an invalid character only when it is reached before the game has ended.

Unsuccessful approach: Validating the whole string before scoring rejects logs whose junk appears after the game already ended.

Case contract

points is a string of rally winners, each character A or B. A game ends at the first point where a player has at least 4 points and leads by at least 2; characters after that point are ignored. Return "game A"/"game B" when finished; otherwise "deuce" when both have at least 3 points and are level, "advantage A"/"advantage B" when both have at least 3 points and differ by one, else "S-R" using the labels 0, 15, 30, 40 in A-B order. A character other than A or B that is reached before the game ends returns "invalid point <c>".

Why this case matters

Live scoreboards and umpire tablets derive the displayed tennis game score from a raw rally log.

1 / The failure

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

N = 1
observations = []
def solve(points):
    names = ['0', '15', '30', '40']
    a = b = 0
    for p in points:
        if p == 'A':
            a += 1
        elif p == 'B':
            b += 1
        else:
            continue
        if (a >= 4 or b >= 4) and abs(a - b) >= 2:
            return 'game A' if a > b else 'game B'
    if a >= 3 and b >= 3:
        if a == b:
            return 'deuce'
        return 'advantage A' if a > b else 'advantage B'
    return names[a] + '-' + names[b]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('BAAABABC',), 'game A'),
  ('regression: input validation scope', ('BAABBAx',), 'invalid point x'),
  ('variant scenario 1', ('BBBAB',), 'game B'),
  ('variant scenario 2', ('AAAABAAA',), 'game A')],
 [('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('BAC',), 'invalid point C'),
  ('regression: input validation scope', ('ABABAAABBC',), 'game A'),
  ('variant scenario 1', ('BBBB',), 'game B'),
  ('variant scenario 2', ('AABBBBBAA',), 'game B')],
 [('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('x',), 'invalid point x'),
  ('regression: input validation scope', ('BAABBABBBBAx',), 'game B'),
  ('variant scenario 1', ('AAAABABAA',), 'game A'),
  ('variant scenario 2', ('AAABABA',), 'game A')],
 [('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('BBAAABBABx',), 'invalid point x'),
  ('regression: input validation scope', ('ABBBBAAABx',), 'game B'),
  ('variant scenario 1', ('BAAAAA',), 'game A'),
  ('variant scenario 2', ('AB',), '15-15')],
 [('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('BABAABBBBAAAx',), 'game B'),
  ('regression: input validation scope', ('ABC',), 'invalid point C'),
  ('variant scenario 1', ('BBAAAABABBABBB',), 'game A'),
  ('variant scenario 2', ('BBBBAABABBA',), 'game B')]]
for label, args, expected in cases[N - 1]:
    check(label, run(args), expected)
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
control love-thirty0-300-30Passed
boundary first deucedeucedeucePassed
boundary advantage after deuceadvantage Badvantage BPassed
control straight gamegame Agame APassed
boundary win from advantagegame Agame APassed
control empty log0-00-0Passed
regression: input validation scopegame Agame APassed
regression: input validation scopedeuceinvalid point xFailed
variant scenario 1game Bgame BPassed
variant scenario 2game Agame APassed

SHA-256 / d0967f249c89ea289bbfa6f20d946d4e32f7f31ead6a05870bacf642f420792e

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(points):
    names = ['0', '15', '30', '40']
    a = b = 0
    for p in points:
        if p not in ('A', 'B'):
            return 'invalid point ' + p
    for p in points:
        if p == 'A':
            a += 1
        elif p == 'B':
            b += 1
        else:
            return 'invalid point ' + p
        if (a >= 4 or b >= 4) and abs(a - b) >= 2:
            return 'game A' if a > b else 'game B'
    if a >= 3 and b >= 3:
        if a == b:
            return 'deuce'
        return 'advantage A' if a > b else 'advantage B'
    return names[a] + '-' + names[b]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('BAAABABC',), 'game A'),
  ('regression: input validation scope', ('BAABBAx',), 'invalid point x'),
  ('variant scenario 1', ('BBBAB',), 'game B'),
  ('variant scenario 2', ('AAAABAAA',), 'game A')],
 [('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('BAC',), 'invalid point C'),
  ('regression: input validation scope', ('ABABAAABBC',), 'game A'),
  ('variant scenario 1', ('BBBB',), 'game B'),
  ('variant scenario 2', ('AABBBBBAA',), 'game B')],
 [('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('x',), 'invalid point x'),
  ('regression: input validation scope', ('BAABBABBBBAx',), 'game B'),
  ('variant scenario 1', ('AAAABABAA',), 'game A'),
  ('variant scenario 2', ('AAABABA',), 'game A')],
 [('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('BBAAABBABx',), 'invalid point x'),
  ('regression: input validation scope', ('ABBBBAAABx',), 'game B'),
  ('variant scenario 1', ('BAAAAA',), 'game A'),
  ('variant scenario 2', ('AB',), '15-15')],
 [('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('BABAABBBBAAAx',), 'game B'),
  ('regression: input validation scope', ('ABC',), 'invalid point C'),
  ('variant scenario 1', ('BBAAAABABBABBB',), 'game A'),
  ('variant scenario 2', ('BBBBAABABBA',), 'game B')]]
for label, args, expected in cases[N - 1]:
    check(label, run(args), expected)
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
control love-thirty0-300-30Passed
boundary first deucedeucedeucePassed
boundary advantage after deuceadvantage Badvantage BPassed
control straight gamegame Agame APassed
boundary win from advantagegame Agame APassed
control empty log0-00-0Passed
regression: input validation scopeinvalid point Cgame AFailed
regression: input validation scopeinvalid point xinvalid point xPassed
variant scenario 1game Bgame BPassed
variant scenario 2game Agame APassed

SHA-256 / 5e94cebd82f3d16b2a1e78b912d3345324587a9bb70b44912217e7b25ff1f5a9

3 / The verified repair

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

N = 1
observations = []
def solve(points):
    names = ['0', '15', '30', '40']
    a = b = 0
    for p in points:
        if p == 'A':
            a += 1
        elif p == 'B':
            b += 1
        else:
            return 'invalid point ' + p
        if (a >= 4 or b >= 4) and abs(a - b) >= 2:
            return 'game A' if a > b else 'game B'
    if a >= 3 and b >= 3:
        if a == b:
            return 'deuce'
        return 'advantage A' if a > b else 'advantage B'
    return names[a] + '-' + names[b]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('BAAABABC',), 'game A'),
  ('regression: input validation scope', ('BAABBAx',), 'invalid point x'),
  ('variant scenario 1', ('BBBAB',), 'game B'),
  ('variant scenario 2', ('AAAABAAA',), 'game A')],
 [('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('BAC',), 'invalid point C'),
  ('regression: input validation scope', ('ABABAAABBC',), 'game A'),
  ('variant scenario 1', ('BBBB',), 'game B'),
  ('variant scenario 2', ('AABBBBBAA',), 'game B')],
 [('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('x',), 'invalid point x'),
  ('regression: input validation scope', ('BAABBABBBBAx',), 'game B'),
  ('variant scenario 1', ('AAAABABAA',), 'game A'),
  ('variant scenario 2', ('AAABABA',), 'game A')],
 [('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('BBAAABBABx',), 'invalid point x'),
  ('regression: input validation scope', ('ABBBBAAABx',), 'game B'),
  ('variant scenario 1', ('BAAAAA',), 'game A'),
  ('variant scenario 2', ('AB',), '15-15')],
 [('control love-thirty', ('BB',), '0-30'),
  ('boundary first deuce', ('AABBAB',), 'deuce'),
  ('boundary advantage after deuce', ('AAABBBB',), 'advantage B'),
  ('control straight game', ('AAAA',), 'game A'),
  ('boundary win from advantage', ('ABABABAA',), 'game A'),
  ('control empty log', ('',), '0-0'),
  ('regression: input validation scope', ('BABAABBBBAAAx',), 'game B'),
  ('regression: input validation scope', ('ABC',), 'invalid point C'),
  ('variant scenario 1', ('BBAAAABABBABBB',), 'game A'),
  ('variant scenario 2', ('BBBBAABABBA',), 'game B')]]
for label, args, expected in cases[N - 1]:
    check(label, run(args), expected)
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
control love-thirty0-300-30Passed
boundary first deucedeucedeucePassed
boundary advantage after deuceadvantage Badvantage BPassed
control straight gamegame Agame APassed
boundary win from advantagegame Agame APassed
control empty log0-00-0Passed
regression: input validation scopegame Agame APassed
regression: input validation scopeinvalid point xinvalid point xPassed
variant scenario 1game Bgame BPassed
variant scenario 2game Agame APassed

SHA-256 / ff404242d8a563bfa7e82db9010505bd621577ad0a63bd3fa7e3772dd1673563

Verification & scope

Stipulated, bounded toy contract stated in the contract field; not a claim of conformance with any governing body rulebook or operator house rules. 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-29T14:50:25.384818+00:00.

Case digest / 87045e10a68fa43e4578419123ebf54b0d6663339ef9ceae88ffaabfc4a4b0bc