FAILURE MAP
← Case archive

FA-75541 / Text diff and three-way merge / Open access

Whitespace comparison modes: -b discards leading whitespace · case 01

Indenting a line is not reported under -b, although whitespace appeared where there was none.

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

ROOT CAUSE

The -b normalization strips both ends instead of only trailing whitespace.

VERIFIED REPAIR

Collapse runs to one space and strip only trailing spaces and tabs.

Unsuccessful approach: Stripping leading and trailing separately is the same full strip and still hides new indentation.

Case contract

Normalize each line: with strip_cr remove one trailing "\r"; mode "w" deletes all whitespace (str.split semantics); mode "b" collapses runs of spaces and tabs to one space and strips trailing spaces and tabs; mode "none" leaves the line. With ignore_blank, drop lines whose normalized key is empty. Return both key lists and whether they are equal.

Why this case matters

Diff options like -w, -b, --strip-trailing-cr and --ignore-blank-lines decide which changes are shown at all.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(a, b, mode, strip_cr, ignore_blank):
    def norm(line):
        if strip_cr and line.endswith('\r'):
            line = line[:-1]
        if mode == 'w':
            return ''.join(line.split())
        if mode == 'b':
            return re.sub(r'[ \t]+', ' ', line).strip(' \t')
        return line
    ka = [norm(x) for x in a]
    kb = [norm(x) for x in b]
    if ignore_blank:
        ka = [x for x in ka if x != '']
        kb = [x for x in kb if x != '']
    return {'a': ka, 'b': kb, 'equal': ka == kb}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    2: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    3: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    4: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    5: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
}[N]
for label, args, expected in cases:
    check(label, solve(*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
amount of whitespace ignored{'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}{'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}Passed
leading whitespace presence matters under -b{'a': ['x'], 'b': ['x'], 'equal': True}{'a': [' x'], 'b': ['x'], 'equal': False}Failed
all whitespace ignored{'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}{'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}Passed
carriage return stripped once{'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}{'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}Passed
carriage return kept without the flag{'a': ['cr\r'], 'b': ['cr'], 'equal': False}{'a': ['cr\r'], 'b': ['cr'], 'equal': False}Passed
interior carriage return is content{'a': ['a\rb'], 'b': ['ab'], 'equal': False}{'a': ['a\rb'], 'b': ['ab'], 'equal': False}Passed
whitespace-only line is blank only when normalized empty{'a': ['x', ' ', 'y'], 'b': ['x', 'y'], 'equal': False}{'a': ['x', ' ', 'y'], 'b': ['x', 'y'], 'equal': False}Passed
blank lines ignored under -w{'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}{'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}Passed
tabs under -w{'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}{'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}Passed
vertical tab under -w{'a': ['mn'], 'b': ['mn'], 'equal': True}{'a': ['mn'], 'b': ['mn'], 'equal': True}Passed

SHA-256 / dd201d9192d5837fb5e79e2b93b87ef3bd3314234909911312f511bb2449f52e

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(a, b, mode, strip_cr, ignore_blank):
    def norm(line):
        if strip_cr and line.endswith('\r'):
            line = line[:-1]
        if mode == 'w':
            return ''.join(line.split())
        if mode == 'b':
            return re.sub(r'[ \t]+', ' ', line).lstrip(' \t').rstrip(' \t')
        return line
    ka = [norm(x) for x in a]
    kb = [norm(x) for x in b]
    if ignore_blank:
        ka = [x for x in ka if x != '']
        kb = [x for x in kb if x != '']
    return {'a': ka, 'b': kb, 'equal': ka == kb}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    2: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    3: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    4: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    5: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
}[N]
for label, args, expected in cases:
    check(label, solve(*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
amount of whitespace ignored{'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}{'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}Passed
leading whitespace presence matters under -b{'a': ['x'], 'b': ['x'], 'equal': True}{'a': [' x'], 'b': ['x'], 'equal': False}Failed
all whitespace ignored{'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}{'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}Passed
carriage return stripped once{'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}{'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}Passed
carriage return kept without the flag{'a': ['cr\r'], 'b': ['cr'], 'equal': False}{'a': ['cr\r'], 'b': ['cr'], 'equal': False}Passed
interior carriage return is content{'a': ['a\rb'], 'b': ['ab'], 'equal': False}{'a': ['a\rb'], 'b': ['ab'], 'equal': False}Passed
whitespace-only line is blank only when normalized empty{'a': ['x', ' ', 'y'], 'b': ['x', 'y'], 'equal': False}{'a': ['x', ' ', 'y'], 'b': ['x', 'y'], 'equal': False}Passed
blank lines ignored under -w{'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}{'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}Passed
tabs under -w{'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}{'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}Passed
vertical tab under -w{'a': ['mn'], 'b': ['mn'], 'equal': True}{'a': ['mn'], 'b': ['mn'], 'equal': True}Passed

SHA-256 / aa137509d28a3eca56a86a9ea9b21cc5612ab4659d0227b509fecf94c6ee2227

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(a, b, mode, strip_cr, ignore_blank):
    def norm(line):
        if strip_cr and line.endswith('\r'):
            line = line[:-1]
        if mode == 'w':
            return ''.join(line.split())
        if mode == 'b':
            return re.sub(r'[ \t]+', ' ', line).rstrip(' \t')
        return line
    ka = [norm(x) for x in a]
    kb = [norm(x) for x in b]
    if ignore_blank:
        ka = [x for x in ka if x != '']
        kb = [x for x in kb if x != '']
    return {'a': ka, 'b': kb, 'equal': ka == kb}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    2: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    3: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    4: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    5: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
}[N]
for label, args, expected in cases:
    check(label, solve(*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
amount of whitespace ignored{'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}{'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}Passed
leading whitespace presence matters under -b{'a': [' x'], 'b': ['x'], 'equal': False}{'a': [' x'], 'b': ['x'], 'equal': False}Passed
all whitespace ignored{'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}{'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}Passed
carriage return stripped once{'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}{'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}Passed
carriage return kept without the flag{'a': ['cr\r'], 'b': ['cr'], 'equal': False}{'a': ['cr\r'], 'b': ['cr'], 'equal': False}Passed
interior carriage return is content{'a': ['a\rb'], 'b': ['ab'], 'equal': False}{'a': ['a\rb'], 'b': ['ab'], 'equal': False}Passed
whitespace-only line is blank only when normalized empty{'a': ['x', ' ', 'y'], 'b': ['x', 'y'], 'equal': False}{'a': ['x', ' ', 'y'], 'b': ['x', 'y'], 'equal': False}Passed
blank lines ignored under -w{'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}{'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}Passed
tabs under -w{'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}{'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}Passed
vertical tab under -w{'a': ['mn'], 'b': ['mn'], 'equal': True}{'a': ['mn'], 'b': ['mn'], 'equal': True}Passed

SHA-256 / c004dde0f25b1133d2a36dd64148fa02d548feb4cbb32e1f557ed155676cebf5

Verification & scope

A deterministic, bounded teaching model of one diff, patch or merge rule with stipulated conventions; it is not a production diff or version-control implementation and makes no claim of conformance to any specific tool. 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:49:07.480951+00:00.

Case digest / 7107a657a975352527898e15466588836d2465655c18b15a05974637efdf624d