FAILURE MAP
← Case archive

FA-83896 / Sports scoring and tiebreakers / Open access

Current set score dropped from or padded into the set list · case 01

An in-progress set is missing from the scoreboard, or a phantom "0-0" set appears after a set ends.

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

ROOT CAUSE

The trailing in-progress set is never appended to the output.

VERIFIED REPAIR

Append the current set only when at least one game has been played in it.

Unsuccessful approach: Always appending the current set adds "0-0" immediately after a completed set.

Case contract

games is a string of game winners (A/B); best_of is 3 or 5. A set is won by the first player to 6 games with a lead of two, or at 7 games (7-5, or 7-6 after the tiebreak game played at 6-6). The match ends when a player has won best_of // 2 + 1 sets; later games are ignored. Return [set scores as "a-b" strings in A-B order, match winner or None]; an unfinished set with at least one game is appended as its current score.

Why this case matters

Tournament live-results feeds reconstruct set scores from game-level events.

1 / The failure

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

N = 1
observations = []
def solve(games, best_of):
    sets = []
    a = b = 0
    won = {'A': 0, 'B': 0}
    need = best_of // 2 + 1
    for g in games:
        if g == 'A':
            a += 1
        else:
            b += 1
        if (max(a, b) >= 6 and abs(a - b) >= 2) or max(a, b) == 7:
            w = 'A' if a > b else 'B'
            won[w] += 1
            sets.append('%d-%d' % (a, b))
            a = b = 0
            if won[w] == need:
                return [sets, w]
    if False:
        sets.append('%d-%d' % (a, b))
    return [sets, None]
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 bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report', ('BAAAABAAAAAAAABA', 5), [['6-2', '6-0', '1-1'], None]),
  ('regression: in progress set report',
   ('ABAAAAABBBABABAABBBAAAAAA', 5),
   [['6-1', '4-6', '6-2'], None]),
  ('variant scenario 1', ('BBBAAABABAAAABBAAAAAABB', 5), [['7-5', '6-2', '1-2'], None]),
  ('variant scenario 2', ('ABBAABBAAABABAABAAA', 3), [['6-4', '6-3'], 'A'])],
 [('control bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report',
   ('AABBBABABABABAABBBBAAAABBABB', 3),
   [['6-7', '6-4', '1-4'], None]),
  ('regression: in progress set report', ('AAAAAA', 5), [['6-0'], None]),
  ('variant scenario 1', ('ABAAAABAABAAABBBAAAABAAA', 3), [['6-2', '6-4'], 'A']),
  ('variant scenario 2', ('AAAAB', 3), [['4-1'], None])],
 [('control bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report',
   ('BBBBBABBBBABBABBBBAAAABABBAABBAABAABABAAABBA', 5),
   [['1-6', '2-6', '7-6', '7-5', '2-2'], None]),
  ('regression: in progress set report', ('AABBABBAAAAAAABBBBBABAB', 3), [['6-4', '6-7'], None]),
  ('variant scenario 1', ('ABABBBBABAAABBBAABAAAABBAABAAAABBA', 3), [['3-6', '6-4', '6-3'], 'A']),
  ('variant scenario 2', ('ABBBAAABBABABABBAABAABAAAAAABBBB', 3), [['6-7', '6-4', '5-4'], None])],
 [('control bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report', ('ABABBAAABAABBABABABB', 3), [['6-4', '4-6'], None]),
  ('regression: in progress set report',
   ('BBAAABABAAABAABBAABBBBABABA', 3),
   [['6-4', '5-7', '3-2'], None]),
  ('variant scenario 1',
   ('AABABBABBBBAAAAABABBAAAAABAABABAAABAAABAABABBBBAA', 5),
   [['4-6', '6-2', '6-3', '6-3'], 'A']),
  ('variant scenario 2',
   ('ABAABBBBBAAABAABBAABBABABBAAAAABBABAAABBAAA', 5),
   [['3-6', '6-3', '7-5', '7-5'], 'A'])],
 [('control bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report', ('BAAAAAAABAABAABAB', 5), [['6-1', '6-3', '0-1'], None]),
  ('regression: in progress set report', ('BBAAABBBAAABA', 5), [['7-6'], None]),
  ('variant scenario 1',
   ('BBBBABAAAAABBAABBAAABAABABBAABAABABAABABBBBBAABABABBBBAABBB', 5),
   [['6-7', '6-3', '6-4', '4-6', '4-6'], 'B']),
  ('variant scenario 2', ('ABBBB', 3), [['1-4'], None])]]
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 bagel set[['6-0'], None][['6-0'], None]Passed
boundary seven-five[['7-5'], None][['7-5'], None]Passed
boundary tiebreak set[['6-7'], None][['6-7'], None]Passed
control straight sets[['6-0', '6-0'], 'A'][['6-0', '6-0'], 'A']Passed
control in-progress set[['6-0'], None][['6-0', '0-1'], None]Failed
control empty[[], None][[], None]Passed
regression: in progress set report[['6-2', '6-0'], None][['6-2', '6-0', '1-1'], None]Failed
regression: in progress set report[['6-1', '4-6', '6-2'], None][['6-1', '4-6', '6-2'], None]Passed
variant scenario 1[['7-5', '6-2'], None][['7-5', '6-2', '1-2'], None]Failed
variant scenario 2[['6-4', '6-3'], 'A'][['6-4', '6-3'], 'A']Passed

SHA-256 / 9f753d71613f36821bbc941033c228e85aca943d4f854af84f091073d9b90bc1

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(games, best_of):
    sets = []
    a = b = 0
    won = {'A': 0, 'B': 0}
    need = best_of // 2 + 1
    for g in games:
        if g == 'A':
            a += 1
        else:
            b += 1
        if (max(a, b) >= 6 and abs(a - b) >= 2) or max(a, b) == 7:
            w = 'A' if a > b else 'B'
            won[w] += 1
            sets.append('%d-%d' % (a, b))
            a = b = 0
            if won[w] == need:
                return [sets, w]
    if True:
        sets.append('%d-%d' % (a, b))
    return [sets, None]
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 bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report', ('BAAAABAAAAAAAABA', 5), [['6-2', '6-0', '1-1'], None]),
  ('regression: in progress set report',
   ('ABAAAAABBBABABAABBBAAAAAA', 5),
   [['6-1', '4-6', '6-2'], None]),
  ('variant scenario 1', ('BBBAAABABAAAABBAAAAAABB', 5), [['7-5', '6-2', '1-2'], None]),
  ('variant scenario 2', ('ABBAABBAAABABAABAAA', 3), [['6-4', '6-3'], 'A'])],
 [('control bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report',
   ('AABBBABABABABAABBBBAAAABBABB', 3),
   [['6-7', '6-4', '1-4'], None]),
  ('regression: in progress set report', ('AAAAAA', 5), [['6-0'], None]),
  ('variant scenario 1', ('ABAAAABAABAAABBBAAAABAAA', 3), [['6-2', '6-4'], 'A']),
  ('variant scenario 2', ('AAAAB', 3), [['4-1'], None])],
 [('control bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report',
   ('BBBBBABBBBABBABBBBAAAABABBAABBAABAABABAAABBA', 5),
   [['1-6', '2-6', '7-6', '7-5', '2-2'], None]),
  ('regression: in progress set report', ('AABBABBAAAAAAABBBBBABAB', 3), [['6-4', '6-7'], None]),
  ('variant scenario 1', ('ABABBBBABAAABBBAABAAAABBAABAAAABBA', 3), [['3-6', '6-4', '6-3'], 'A']),
  ('variant scenario 2', ('ABBBAAABBABABABBAABAABAAAAAABBBB', 3), [['6-7', '6-4', '5-4'], None])],
 [('control bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report', ('ABABBAAABAABBABABABB', 3), [['6-4', '4-6'], None]),
  ('regression: in progress set report',
   ('BBAAABABAAABAABBAABBBBABABA', 3),
   [['6-4', '5-7', '3-2'], None]),
  ('variant scenario 1',
   ('AABABBABBBBAAAAABABBAAAAABAABABAAABAAABAABABBBBAA', 5),
   [['4-6', '6-2', '6-3', '6-3'], 'A']),
  ('variant scenario 2',
   ('ABAABBBBBAAABAABBAABBABABBAAAAABBABAAABBAAA', 5),
   [['3-6', '6-3', '7-5', '7-5'], 'A'])],
 [('control bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report', ('BAAAAAAABAABAABAB', 5), [['6-1', '6-3', '0-1'], None]),
  ('regression: in progress set report', ('BBAAABBBAAABA', 5), [['7-6'], None]),
  ('variant scenario 1',
   ('BBBBABAAAAABBAABBAAABAABABBAABAABABAABABBBBBAABABABBBBAABBB', 5),
   [['6-7', '6-3', '6-4', '4-6', '4-6'], 'B']),
  ('variant scenario 2', ('ABBBB', 3), [['1-4'], None])]]
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 bagel set[['6-0', '0-0'], None][['6-0'], None]Failed
boundary seven-five[['7-5', '0-0'], None][['7-5'], None]Failed
boundary tiebreak set[['6-7', '0-0'], None][['6-7'], None]Failed
control straight sets[['6-0', '6-0'], 'A'][['6-0', '6-0'], 'A']Passed
control in-progress set[['6-0', '0-1'], None][['6-0', '0-1'], None]Passed
control empty[['0-0'], None][[], None]Failed
regression: in progress set report[['6-2', '6-0', '1-1'], None][['6-2', '6-0', '1-1'], None]Passed
regression: in progress set report[['6-1', '4-6', '6-2', '0-0'], None][['6-1', '4-6', '6-2'], None]Failed
variant scenario 1[['7-5', '6-2', '1-2'], None][['7-5', '6-2', '1-2'], None]Passed
variant scenario 2[['6-4', '6-3'], 'A'][['6-4', '6-3'], 'A']Passed

SHA-256 / 2d3726150a9dba9302a1705912865132a5e82b201234e72630fbdaf828da96d0

3 / The verified repair

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

N = 1
observations = []
def solve(games, best_of):
    sets = []
    a = b = 0
    won = {'A': 0, 'B': 0}
    need = best_of // 2 + 1
    for g in games:
        if g == 'A':
            a += 1
        else:
            b += 1
        if (max(a, b) >= 6 and abs(a - b) >= 2) or max(a, b) == 7:
            w = 'A' if a > b else 'B'
            won[w] += 1
            sets.append('%d-%d' % (a, b))
            a = b = 0
            if won[w] == need:
                return [sets, w]
    if a or b:
        sets.append('%d-%d' % (a, b))
    return [sets, None]
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 bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report', ('BAAAABAAAAAAAABA', 5), [['6-2', '6-0', '1-1'], None]),
  ('regression: in progress set report',
   ('ABAAAAABBBABABAABBBAAAAAA', 5),
   [['6-1', '4-6', '6-2'], None]),
  ('variant scenario 1', ('BBBAAABABAAAABBAAAAAABB', 5), [['7-5', '6-2', '1-2'], None]),
  ('variant scenario 2', ('ABBAABBAAABABAABAAA', 3), [['6-4', '6-3'], 'A'])],
 [('control bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report',
   ('AABBBABABABABAABBBBAAAABBABB', 3),
   [['6-7', '6-4', '1-4'], None]),
  ('regression: in progress set report', ('AAAAAA', 5), [['6-0'], None]),
  ('variant scenario 1', ('ABAAAABAABAAABBBAAAABAAA', 3), [['6-2', '6-4'], 'A']),
  ('variant scenario 2', ('AAAAB', 3), [['4-1'], None])],
 [('control bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report',
   ('BBBBBABBBBABBABBBBAAAABABBAABBAABAABABAAABBA', 5),
   [['1-6', '2-6', '7-6', '7-5', '2-2'], None]),
  ('regression: in progress set report', ('AABBABBAAAAAAABBBBBABAB', 3), [['6-4', '6-7'], None]),
  ('variant scenario 1', ('ABABBBBABAAABBBAABAAAABBAABAAAABBA', 3), [['3-6', '6-4', '6-3'], 'A']),
  ('variant scenario 2', ('ABBBAAABBABABABBAABAABAAAAAABBBB', 3), [['6-7', '6-4', '5-4'], None])],
 [('control bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report', ('ABABBAAABAABBABABABB', 3), [['6-4', '4-6'], None]),
  ('regression: in progress set report',
   ('BBAAABABAAABAABBAABBBBABABA', 3),
   [['6-4', '5-7', '3-2'], None]),
  ('variant scenario 1',
   ('AABABBABBBBAAAAABABBAAAAABAABABAAABAAABAABABBBBAA', 5),
   [['4-6', '6-2', '6-3', '6-3'], 'A']),
  ('variant scenario 2',
   ('ABAABBBBBAAABAABBAABBABABBAAAAABBABAAABBAAA', 5),
   [['3-6', '6-3', '7-5', '7-5'], 'A'])],
 [('control bagel set', ('AAAAAA', 3), [['6-0'], None]),
  ('boundary seven-five', ('AAAAABBBBBAA', 3), [['7-5'], None]),
  ('boundary tiebreak set', ('AAAAABBBBBABB', 3), [['6-7'], None]),
  ('control straight sets', ('AAAAAAAAAAAA', 3), [['6-0', '6-0'], 'A']),
  ('control in-progress set', ('AAAAAAB', 3), [['6-0', '0-1'], None]),
  ('control empty', ('', 5), [[], None]),
  ('regression: in progress set report', ('BAAAAAAABAABAABAB', 5), [['6-1', '6-3', '0-1'], None]),
  ('regression: in progress set report', ('BBAAABBBAAABA', 5), [['7-6'], None]),
  ('variant scenario 1',
   ('BBBBABAAAAABBAABBAAABAABABBAABAABABAABABBBBBAABABABBBBAABBB', 5),
   [['6-7', '6-3', '6-4', '4-6', '4-6'], 'B']),
  ('variant scenario 2', ('ABBBB', 3), [['1-4'], None])]]
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 bagel set[['6-0'], None][['6-0'], None]Passed
boundary seven-five[['7-5'], None][['7-5'], None]Passed
boundary tiebreak set[['6-7'], None][['6-7'], None]Passed
control straight sets[['6-0', '6-0'], 'A'][['6-0', '6-0'], 'A']Passed
control in-progress set[['6-0', '0-1'], None][['6-0', '0-1'], None]Passed
control empty[[], None][[], None]Passed
regression: in progress set report[['6-2', '6-0', '1-1'], None][['6-2', '6-0', '1-1'], None]Passed
regression: in progress set report[['6-1', '4-6', '6-2'], None][['6-1', '4-6', '6-2'], None]Passed
variant scenario 1[['7-5', '6-2', '1-2'], None][['7-5', '6-2', '1-2'], None]Passed
variant scenario 2[['6-4', '6-3'], 'A'][['6-4', '6-3'], 'A']Passed

SHA-256 / 3866ff96dd04a4526cbae0c17c696e6c6f6fd7d0f2cb8e202936d52a153d8527

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

Case digest / c51c45af2645bab469607982beb4ec0b8c5b9069f102a9e0e52baf1a13bfaa43