FA-96341 / Phone number formatting / Open access
Ten-digit display formatter: any eleventh leading digit is stripped · case 01
"2" followed by a valid ten-digit number is accepted with the 2 discarded.
ROOT CAUSE
The first digit of any eleven-digit string is removed without checking that it is 1.
VERIFIED REPAIR
Drop the first digit only when there are eleven digits and the first one is 1.
Unsuccessful approach: Keeping the last ten digits of any longer input silently accepts the same malformed numbers.
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:
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| parenthesized input | (302) 555-0115 | (302) 555-0115 | Passed |
| dotted input | (302) 555-0115 | (302) 555-0115 | Passed |
| national prefix one | (302) 555-0115 | (302) 555-0115 | Passed |
| plus one prefix | (302) 555-0115 | (302) 555-0115 | Passed |
| space after the plus | (302) 555-0115 | (302) 555-0115 | Passed |
| plus without country one | None | None | Passed |
| eleven digits not starting with one | (302) 555-0115 | None | Failed |
| slash separators rejected | None | None | Passed |
| service-code area rejected | None | None | Passed |
| area code ending in one is fine | (201) 555-0115 | (201) 555-0115 | Passed |
| exchange starting with one rejected | None | None | Passed |
| service-code exchange rejected | None | None | Passed |
SHA-256 / 3303f2a8e97b02fc460ced7990e8abcf86b1adf1b1da585cd07c8ceeabcb2ea0
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) > 10:
d = d[-10:]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| parenthesized input | (302) 555-0115 | (302) 555-0115 | Passed |
| dotted input | (302) 555-0115 | (302) 555-0115 | Passed |
| national prefix one | (302) 555-0115 | (302) 555-0115 | Passed |
| plus one prefix | (302) 555-0115 | (302) 555-0115 | Passed |
| space after the plus | (302) 555-0115 | (302) 555-0115 | Passed |
| plus without country one | None | None | Passed |
| eleven digits not starting with one | (302) 555-0115 | None | Failed |
| slash separators rejected | None | None | Passed |
| service-code area rejected | None | None | Passed |
| area code ending in one is fine | (201) 555-0115 | (201) 555-0115 | Passed |
| exchange starting with one rejected | None | None | Passed |
| service-code exchange rejected | None | None | Passed |
SHA-256 / 90efb10f15aaa0451c63bb71427cb3ec1ad90b7dc516c82b0584f45f3f1624d7
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| parenthesized input | (302) 555-0115 | (302) 555-0115 | Passed |
| dotted input | (302) 555-0115 | (302) 555-0115 | Passed |
| national prefix one | (302) 555-0115 | (302) 555-0115 | Passed |
| plus one prefix | (302) 555-0115 | (302) 555-0115 | Passed |
| space after the plus | (302) 555-0115 | (302) 555-0115 | Passed |
| plus without country one | None | None | Passed |
| eleven digits not starting with one | None | None | Passed |
| slash separators rejected | None | None | Passed |
| service-code area rejected | None | None | Passed |
| area code ending in one is fine | (201) 555-0115 | (201) 555-0115 | Passed |
| exchange starting with one rejected | None | None | Passed |
| service-code exchange rejected | None | None | Passed |
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.913881+00:00.
Case digest / 8a8b21a5831b2e75fcbd4edafdb8e931924a1011130236dc6669b76d72f16221