FAILURE MAP
← Case archive

FA-96351 / Phone number formatting / Open access

Ten-digit display formatter: area codes starting with 1 are accepted · case 01

An exchange or area beginning with 1 is formatted instead of rejected.

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

ROOT CAUSE

Only a leading 0 is rejected.

VERIFIED REPAIR

Reject a leading 0 or 1 in both the area and the exchange.

Unsuccessful approach: Checking both digits but only for the area code lets exchanges 155 and 511 through.

Case contract

Strip the input. Only digits, spaces, parentheses, hyphens, dots and plus are allowed. If the input starts with "+" the digits must start with country digit 1. Eleven digits starting with 1 lose that 1. Exactly ten digits must remain: area (3), exchange (3), line (4). Neither the area nor the exchange may start with 0 or 1 or end in "11". Return "(AAA) EEE-LLLL" or None.

Why this case matters

Ten-digit display formatting is applied to every stored number; accepting impossible numbers or rejecting valid punctuation corrupts contact data.

1 / The failure

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

N = 1
observations = []
def solve(x):
    s = x.strip()
    if any(not (c.isdigit() or c in ' ()-.+') for c in s):
        return None
    d = ''.join(c for c in s if c.isdigit())
    if s.startswith('+') and not d.startswith('1'):
        return None
    if len(d) == 11 and d[0] == '1':
        d = d[1:]
    if len(d) != 10:
        return None
    a, e, sub = d[:3], d[3:6], d[6:]
    for part in (a, e):
        if part[0] == '0' or part[1:] == '11':
            return None
    return '(%s) %s-%s' % (a, e, sub)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['parenthesized input', '(302) 555-0115', '(302) 555-0115'], ['dotted input', '302.555.0115', '(302) 555-0115'], ['national prefix one', '1-302-555-0115', '(302) 555-0115'], ['plus one prefix', '+1 302 555 0115', '(302) 555-0115'], ['space after the plus', '+ 1 302 555 0115', '(302) 555-0115'], ['plus without country one', '+3025550115', None], ['eleven digits not starting with one', '23025550115', None], ['slash separators rejected', '302/555/0115', None], ['service-code area rejected', '211-555-0115', None], ['area code ending in one is fine', '201-555-0115', '(201) 555-0115'], ['exchange starting with one rejected', '302-155-0115', None], ['service-code exchange rejected', '302-511-0115', None]], [['parenthesized input', '(403) 555-0126', '(403) 555-0126'], ['dotted input', '403.555.0126', '(403) 555-0126'], ['national prefix one', '1-403-555-0126', '(403) 555-0126'], ['plus one prefix', '+1 403 555 0126', '(403) 555-0126'], ['space after the plus', '+ 1 403 555 0126', '(403) 555-0126'], ['plus without country one', '+4035550126', None], ['eleven digits not starting with one', '24035550126', None], ['slash separators rejected', '403/555/0126', None], ['service-code area rejected', '211-555-0126', None], ['area code ending in one is fine', '201-555-0126', '(201) 555-0126'], ['exchange starting with one rejected', '403-155-0126', None], ['service-code exchange rejected', '403-511-0126', None]], [['parenthesized input', '(504) 555-0137', '(504) 555-0137'], ['dotted input', '504.555.0137', '(504) 555-0137'], ['national prefix one', '1-504-555-0137', '(504) 555-0137'], ['plus one prefix', '+1 504 555 0137', '(504) 555-0137'], ['space after the plus', '+ 1 504 555 0137', '(504) 555-0137'], ['plus without country one', '+5045550137', None], ['eleven digits not starting with one', '25045550137', None], ['slash separators rejected', '504/555/0137', None], ['service-code area rejected', '211-555-0137', None], ['area code ending in one is fine', '201-555-0137', '(201) 555-0137'], ['exchange starting with one rejected', '504-155-0137', None], ['service-code exchange rejected', '504-511-0137', None]], [['parenthesized input', '(605) 555-0148', '(605) 555-0148'], ['dotted input', '605.555.0148', '(605) 555-0148'], ['national prefix one', '1-605-555-0148', '(605) 555-0148'], ['plus one prefix', '+1 605 555 0148', '(605) 555-0148'], ['space after the plus', '+ 1 605 555 0148', '(605) 555-0148'], ['plus without country one', '+6055550148', None], ['eleven digits not starting with one', '26055550148', None], ['slash separators rejected', '605/555/0148', None], ['service-code area rejected', '211-555-0148', None], ['area code ending in one is fine', '201-555-0148', '(201) 555-0148'], ['exchange starting with one rejected', '605-155-0148', None], ['service-code exchange rejected', '605-511-0148', None]], [['parenthesized input', '(706) 555-0159', '(706) 555-0159'], ['dotted input', '706.555.0159', '(706) 555-0159'], ['national prefix one', '1-706-555-0159', '(706) 555-0159'], ['plus one prefix', '+1 706 555 0159', '(706) 555-0159'], ['space after the plus', '+ 1 706 555 0159', '(706) 555-0159'], ['plus without country one', '+7065550159', None], ['eleven digits not starting with one', '27065550159', None], ['slash separators rejected', '706/555/0159', None], ['service-code area rejected', '211-555-0159', None], ['area code ending in one is fine', '201-555-0159', '(201) 555-0159'], ['exchange starting with one rejected', '706-155-0159', None], ['service-code exchange rejected', '706-511-0159', None]]]
for label, arg, expected in fixtures[N - 1]:
    check(label, solve(arg), 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
parenthesized input(302) 555-0115(302) 555-0115Passed
dotted input(302) 555-0115(302) 555-0115Passed
national prefix one(302) 555-0115(302) 555-0115Passed
plus one prefix(302) 555-0115(302) 555-0115Passed
space after the plus(302) 555-0115(302) 555-0115Passed
plus without country oneNoneNonePassed
eleven digits not starting with oneNoneNonePassed
slash separators rejectedNoneNonePassed
service-code area rejectedNoneNonePassed
area code ending in one is fine(201) 555-0115(201) 555-0115Passed
exchange starting with one rejected(302) 155-0115NoneFailed
service-code exchange rejectedNoneNonePassed

SHA-256 / 09d1c2635ab3d32aad27b4da4a02d42cabd4bfc126e21e09218f881dc6690e80

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    s = x.strip()
    if any(not (c.isdigit() or c in ' ()-.+') for c in s):
        return None
    d = ''.join(c for c in s if c.isdigit())
    if s.startswith('+') and not d.startswith('1'):
        return None
    if len(d) == 11 and d[0] == '1':
        d = d[1:]
    if len(d) != 10:
        return None
    a, e, sub = d[:3], d[3:6], d[6:]
    for part in (a,):
        if part[0] in '01' or part[1:] == '11':
            return None
    return '(%s) %s-%s' % (a, e, sub)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['parenthesized input', '(302) 555-0115', '(302) 555-0115'], ['dotted input', '302.555.0115', '(302) 555-0115'], ['national prefix one', '1-302-555-0115', '(302) 555-0115'], ['plus one prefix', '+1 302 555 0115', '(302) 555-0115'], ['space after the plus', '+ 1 302 555 0115', '(302) 555-0115'], ['plus without country one', '+3025550115', None], ['eleven digits not starting with one', '23025550115', None], ['slash separators rejected', '302/555/0115', None], ['service-code area rejected', '211-555-0115', None], ['area code ending in one is fine', '201-555-0115', '(201) 555-0115'], ['exchange starting with one rejected', '302-155-0115', None], ['service-code exchange rejected', '302-511-0115', None]], [['parenthesized input', '(403) 555-0126', '(403) 555-0126'], ['dotted input', '403.555.0126', '(403) 555-0126'], ['national prefix one', '1-403-555-0126', '(403) 555-0126'], ['plus one prefix', '+1 403 555 0126', '(403) 555-0126'], ['space after the plus', '+ 1 403 555 0126', '(403) 555-0126'], ['plus without country one', '+4035550126', None], ['eleven digits not starting with one', '24035550126', None], ['slash separators rejected', '403/555/0126', None], ['service-code area rejected', '211-555-0126', None], ['area code ending in one is fine', '201-555-0126', '(201) 555-0126'], ['exchange starting with one rejected', '403-155-0126', None], ['service-code exchange rejected', '403-511-0126', None]], [['parenthesized input', '(504) 555-0137', '(504) 555-0137'], ['dotted input', '504.555.0137', '(504) 555-0137'], ['national prefix one', '1-504-555-0137', '(504) 555-0137'], ['plus one prefix', '+1 504 555 0137', '(504) 555-0137'], ['space after the plus', '+ 1 504 555 0137', '(504) 555-0137'], ['plus without country one', '+5045550137', None], ['eleven digits not starting with one', '25045550137', None], ['slash separators rejected', '504/555/0137', None], ['service-code area rejected', '211-555-0137', None], ['area code ending in one is fine', '201-555-0137', '(201) 555-0137'], ['exchange starting with one rejected', '504-155-0137', None], ['service-code exchange rejected', '504-511-0137', None]], [['parenthesized input', '(605) 555-0148', '(605) 555-0148'], ['dotted input', '605.555.0148', '(605) 555-0148'], ['national prefix one', '1-605-555-0148', '(605) 555-0148'], ['plus one prefix', '+1 605 555 0148', '(605) 555-0148'], ['space after the plus', '+ 1 605 555 0148', '(605) 555-0148'], ['plus without country one', '+6055550148', None], ['eleven digits not starting with one', '26055550148', None], ['slash separators rejected', '605/555/0148', None], ['service-code area rejected', '211-555-0148', None], ['area code ending in one is fine', '201-555-0148', '(201) 555-0148'], ['exchange starting with one rejected', '605-155-0148', None], ['service-code exchange rejected', '605-511-0148', None]], [['parenthesized input', '(706) 555-0159', '(706) 555-0159'], ['dotted input', '706.555.0159', '(706) 555-0159'], ['national prefix one', '1-706-555-0159', '(706) 555-0159'], ['plus one prefix', '+1 706 555 0159', '(706) 555-0159'], ['space after the plus', '+ 1 706 555 0159', '(706) 555-0159'], ['plus without country one', '+7065550159', None], ['eleven digits not starting with one', '27065550159', None], ['slash separators rejected', '706/555/0159', None], ['service-code area rejected', '211-555-0159', None], ['area code ending in one is fine', '201-555-0159', '(201) 555-0159'], ['exchange starting with one rejected', '706-155-0159', None], ['service-code exchange rejected', '706-511-0159', None]]]
for label, arg, expected in fixtures[N - 1]:
    check(label, solve(arg), 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
parenthesized input(302) 555-0115(302) 555-0115Passed
dotted input(302) 555-0115(302) 555-0115Passed
national prefix one(302) 555-0115(302) 555-0115Passed
plus one prefix(302) 555-0115(302) 555-0115Passed
space after the plus(302) 555-0115(302) 555-0115Passed
plus without country oneNoneNonePassed
eleven digits not starting with oneNoneNonePassed
slash separators rejectedNoneNonePassed
service-code area rejectedNoneNonePassed
area code ending in one is fine(201) 555-0115(201) 555-0115Passed
exchange starting with one rejected(302) 155-0115NoneFailed
service-code exchange rejected(302) 511-0115NoneFailed

SHA-256 / 536665c326bac0414937a834f3ec930c09dbed5853b17f3d00a47ad2c0316745

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    s = x.strip()
    if any(not (c.isdigit() or c in ' ()-.+') for c in s):
        return None
    d = ''.join(c for c in s if c.isdigit())
    if s.startswith('+') and not d.startswith('1'):
        return None
    if len(d) == 11 and d[0] == '1':
        d = d[1:]
    if len(d) != 10:
        return None
    a, e, sub = d[:3], d[3:6], d[6:]
    for part in (a, e):
        if part[0] in '01' or part[1:] == '11':
            return None
    return '(%s) %s-%s' % (a, e, sub)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['parenthesized input', '(302) 555-0115', '(302) 555-0115'], ['dotted input', '302.555.0115', '(302) 555-0115'], ['national prefix one', '1-302-555-0115', '(302) 555-0115'], ['plus one prefix', '+1 302 555 0115', '(302) 555-0115'], ['space after the plus', '+ 1 302 555 0115', '(302) 555-0115'], ['plus without country one', '+3025550115', None], ['eleven digits not starting with one', '23025550115', None], ['slash separators rejected', '302/555/0115', None], ['service-code area rejected', '211-555-0115', None], ['area code ending in one is fine', '201-555-0115', '(201) 555-0115'], ['exchange starting with one rejected', '302-155-0115', None], ['service-code exchange rejected', '302-511-0115', None]], [['parenthesized input', '(403) 555-0126', '(403) 555-0126'], ['dotted input', '403.555.0126', '(403) 555-0126'], ['national prefix one', '1-403-555-0126', '(403) 555-0126'], ['plus one prefix', '+1 403 555 0126', '(403) 555-0126'], ['space after the plus', '+ 1 403 555 0126', '(403) 555-0126'], ['plus without country one', '+4035550126', None], ['eleven digits not starting with one', '24035550126', None], ['slash separators rejected', '403/555/0126', None], ['service-code area rejected', '211-555-0126', None], ['area code ending in one is fine', '201-555-0126', '(201) 555-0126'], ['exchange starting with one rejected', '403-155-0126', None], ['service-code exchange rejected', '403-511-0126', None]], [['parenthesized input', '(504) 555-0137', '(504) 555-0137'], ['dotted input', '504.555.0137', '(504) 555-0137'], ['national prefix one', '1-504-555-0137', '(504) 555-0137'], ['plus one prefix', '+1 504 555 0137', '(504) 555-0137'], ['space after the plus', '+ 1 504 555 0137', '(504) 555-0137'], ['plus without country one', '+5045550137', None], ['eleven digits not starting with one', '25045550137', None], ['slash separators rejected', '504/555/0137', None], ['service-code area rejected', '211-555-0137', None], ['area code ending in one is fine', '201-555-0137', '(201) 555-0137'], ['exchange starting with one rejected', '504-155-0137', None], ['service-code exchange rejected', '504-511-0137', None]], [['parenthesized input', '(605) 555-0148', '(605) 555-0148'], ['dotted input', '605.555.0148', '(605) 555-0148'], ['national prefix one', '1-605-555-0148', '(605) 555-0148'], ['plus one prefix', '+1 605 555 0148', '(605) 555-0148'], ['space after the plus', '+ 1 605 555 0148', '(605) 555-0148'], ['plus without country one', '+6055550148', None], ['eleven digits not starting with one', '26055550148', None], ['slash separators rejected', '605/555/0148', None], ['service-code area rejected', '211-555-0148', None], ['area code ending in one is fine', '201-555-0148', '(201) 555-0148'], ['exchange starting with one rejected', '605-155-0148', None], ['service-code exchange rejected', '605-511-0148', None]], [['parenthesized input', '(706) 555-0159', '(706) 555-0159'], ['dotted input', '706.555.0159', '(706) 555-0159'], ['national prefix one', '1-706-555-0159', '(706) 555-0159'], ['plus one prefix', '+1 706 555 0159', '(706) 555-0159'], ['space after the plus', '+ 1 706 555 0159', '(706) 555-0159'], ['plus without country one', '+7065550159', None], ['eleven digits not starting with one', '27065550159', None], ['slash separators rejected', '706/555/0159', None], ['service-code area rejected', '211-555-0159', None], ['area code ending in one is fine', '201-555-0159', '(201) 555-0159'], ['exchange starting with one rejected', '706-155-0159', None], ['service-code exchange rejected', '706-511-0159', None]]]
for label, arg, expected in fixtures[N - 1]:
    check(label, solve(arg), 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
parenthesized input(302) 555-0115(302) 555-0115Passed
dotted input(302) 555-0115(302) 555-0115Passed
national prefix one(302) 555-0115(302) 555-0115Passed
plus one prefix(302) 555-0115(302) 555-0115Passed
space after the plus(302) 555-0115(302) 555-0115Passed
plus without country oneNoneNonePassed
eleven digits not starting with oneNoneNonePassed
slash separators rejectedNoneNonePassed
service-code area rejectedNoneNonePassed
area code ending in one is fine(201) 555-0115(201) 555-0115Passed
exchange starting with one rejectedNoneNonePassed
service-code exchange rejectedNoneNonePassed

SHA-256 / 482ef29c5b0baf243c88abc2bba28e3406d8c1bfc454efbaa2a6269874e74595

Verification & scope

A deterministic toy contract over synthetic, obviously fictitious telephone numbers and toy country tables. The rules are stipulated for this model only and make no claim of conformance with any numbering plan or telecommunications standard. 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:52:21.950240+00:00.

Case digest / fd5a64b57ad20607a03a3e047389ca7db9cdce8f991ec7a5625a6b3c78c08143