{"abstract":"'1,23,4.00' is accepted as 1234.00 although it is not a valid grouped amount.","category":"Currency rounding and FX conversion","checks":6,"contract":"solve(text, locale, exp): parse a localized amount into integer minor units at exponent exp. Group/decimal separators: en ',' '.', de '.' ',', ch \"'\" '.', fr ' ' or U+202F and ','. An optional leading '-' marks a negative amount (including -0.xx). If grouping is used, the first group has 1-3 digits and every later group exactly 3. A decimal separator must be followed by digits. Fraction digits beyond exp are allowed only if they are zeros, otherwise 'ERR:precision'. Malformed text returns 'ERR:format'; an unknown locale 'ERR:locale'.","contract_signature":"text, locale, exp","evaluation_group":"w2-currency_rounding_and_fx_conversion-locale-amount-parsing","failed_approach":"Checking only the trailing groups still accepts an oversized leading group such as '1234,567'.","family":"w2-currency_rounding_and_fx_conversion-locale-amount-parsing-group-shape","id":"FA-62121","implementations":{"attempt":{"sha256":"ef6bfab2e4c709a860ce3553b051257be32f9b0dfea4f4f2d8209541d6b886cd","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, locale, exp):\n    seps = {'en': (',', '.'), 'de': ('.', ','), 'ch': (\"'\", '.'), 'fr': (' \\u202f', ',')}\n    if locale not in seps: return 'ERR:locale'\n    groups, dec = seps[locale]\n    dig = lambda t: t != '' and all(c in '0123456789' for c in t)\n    s = text.strip()\n    neg = s.startswith('-')\n    if neg: s = s[1:]\n    whole, _, frac = s.partition(dec)\n    for g in groups[1:]: whole = whole.replace(g, groups[0])\n    parts = whole.split(groups[0])\n    if not all(dig(p) for p in parts) or (dec in s and not dig(frac)): return 'ERR:format'\n    if len(parts) > 1 and any(len(p) != 3 for p in parts[1:]): return 'ERR:format'\n    if frac[exp:].strip('0'): return 'ERR:precision'\n    frac = frac[:exp].ljust(exp, '0')\n    v = int(''.join(parts)) * 10 ** exp + (int(frac) if frac else 0)\n    return -v if neg else v\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression group-shape 1', ('1,23,4.00', 'en', 2), 'ERR:format'),\n  ('regression group-shape 2', ('1234,567.00', 'en', 2), 'ERR:format'),\n  ('control: english grouping', ('1,234.56', 'en', 2), 123456),\n  ('control: german short fraction', ('1.234,5', 'de', 2), 123450),\n  ('control: negative below one', ('-0,50', 'de', 2), -50),\n  ('control: narrow space with trailing zero', ('1\\u202f234,500', 'fr', 2), 123450)],\n [('regression group-shape 1', ('-100 1000,1', 'fr', 3), 'ERR:format'),\n  ('regression group-shape 2', (\"1'1000.50\", 'ch', 2), 'ERR:format'),\n  ('partial repair guard 1', ('1234,567.00', 'en', 2), 'ERR:format'),\n  ('control: narrow space with trailing zero', ('1\\u202f234,500', 'fr', 2), 123450),\n  ('control: excess precision', ('12.345', 'en', 2), 'ERR:precision'),\n  ('control: bad grouping', ('1,23,4.00', 'en', 2), 'ERR:format'),\n  ('control: dinar fraction', ('12.5', 'en', 3), 12500)],\n [('regression group-shape 1', ('-1 1000,123', 'fr', 3), 'ERR:format'),\n  ('regression group-shape 2', ('12.1345,123', 'de', 2), 'ERR:format'),\n  ('partial repair guard 1', ('1234,567.00', 'en', 2), 'ERR:format'),\n  ('control: dinar fraction', ('12.5', 'en', 3), 12500), ('control: swiss integer', (\"1'000\", 'ch', 0), 1000),\n  ('control: french plain space', ('12 345,6', 'fr', 2), 1234560),\n  ('control: dangling separator', ('12.', 'en', 2), 'ERR:format')],\n [('regression group-shape 1', ('100,1000.1', 'en', 3), 'ERR:format'),\n  ('regression group-shape 2', ('12,1345', 'en', 3), 'ERR:format'),\n  ('partial repair guard 1', ('1234,567.00', 'en', 2), 'ERR:format'),\n  ('control: dangling separator', ('12.', 'en', 2), 'ERR:format'),\n  ('control: unknown locale', ('12', 'it', 2), 'ERR:locale'),\n  ('control: english grouping', ('1,234.56', 'en', 2), 123456),\n  ('control: german short fraction', ('1.234,5', 'de', 2), 123450)],\n [('regression group-shape 1', ('100,1000.50', 'en', 2), 'ERR:format'),\n  ('regression group-shape 2', (\"1'1234'567.05\", 'ch', 3), 'ERR:format'),\n  ('partial repair guard 1', ('1234,567.00', 'en', 2), 'ERR:format'),\n  ('control: english grouping', ('1,234.56', 'en', 2), 123456),\n  ('control: german short fraction', ('1.234,5', 'de', 2), 123450),\n  ('control: negative below one', ('-0,50', 'de', 2), -50),\n  ('control: narrow space with trailing zero', ('1\\u202f234,500', 'fr', 2), 123450)]]\nfor label, args, expected in cases[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"e992830d3516ff556add128678a7f7c28e627aa4a44f78a0028e3ad4c9f087e8","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(text, locale, exp):\n    seps = {'en': (',', '.'), 'de': ('.', ','), 'ch': (\"'\", '.'), 'fr': (' \\u202f', ',')}\n    if locale not in seps: return 'ERR:locale'\n    groups, dec = seps[locale]\n    dig = lambda t: t != '' and all(c in '0123456789' for c in t)\n    s = text.strip()\n    neg = s.startswith('-')\n    if neg: s = s[1:]\n    whole, _, frac = s.partition(dec)\n    for g in groups[1:]: whole = whole.replace(g, groups[0])\n    parts = whole.split(groups[0])\n    if not all(dig(p) for p in parts) or (dec in s and not dig(frac)): return 'ERR:format'\n    if frac[exp:].strip('0'): return 'ERR:precision'\n    frac = frac[:exp].ljust(exp, '0')\n    v = int(''.join(parts)) * 10 ** exp + (int(frac) if frac else 0)\n    return -v if neg else v\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression group-shape 1', ('1,23,4.00', 'en', 2), 'ERR:format'),\n  ('regression group-shape 2', ('1234,567.00', 'en', 2), 'ERR:format'),\n  ('control: english grouping', ('1,234.56', 'en', 2), 123456),\n  ('control: german short fraction', ('1.234,5', 'de', 2), 123450),\n  ('control: negative below one', ('-0,50', 'de', 2), -50),\n  ('control: narrow space with trailing zero', ('1\\u202f234,500', 'fr', 2), 123450)],\n [('regression group-shape 1', ('-100 1000,1', 'fr', 3), 'ERR:format'),\n  ('regression group-shape 2', (\"1'1000.50\", 'ch', 2), 'ERR:format'),\n  ('partial repair guard 1', ('1234,567.00', 'en', 2), 'ERR:format'),\n  ('control: narrow space with trailing zero', ('1\\u202f234,500', 'fr', 2), 123450),\n  ('control: excess precision', ('12.345', 'en', 2), 'ERR:precision'),\n  ('control: bad grouping', ('1,23,4.00', 'en', 2), 'ERR:format'),\n  ('control: dinar fraction', ('12.5', 'en', 3), 12500)],\n [('regression group-shape 1', ('-1 1000,123', 'fr', 3), 'ERR:format'),\n  ('regression group-shape 2', ('12.1345,123', 'de', 2), 'ERR:format'),\n  ('partial repair guard 1', ('1234,567.00', 'en', 2), 'ERR:format'),\n  ('control: dinar fraction', ('12.5', 'en', 3), 12500), ('control: swiss integer', (\"1'000\", 'ch', 0), 1000),\n  ('control: french plain space', ('12 345,6', 'fr', 2), 1234560),\n  ('control: dangling separator', ('12.', 'en', 2), 'ERR:format')],\n [('regression group-shape 1', ('100,1000.1', 'en', 3), 'ERR:format'),\n  ('regression group-shape 2', ('12,1345', 'en', 3), 'ERR:format'),\n  ('partial repair guard 1', ('1234,567.00', 'en', 2), 'ERR:format'),\n  ('control: dangling separator', ('12.', 'en', 2), 'ERR:format'),\n  ('control: unknown locale', ('12', 'it', 2), 'ERR:locale'),\n  ('control: english grouping', ('1,234.56', 'en', 2), 123456),\n  ('control: german short fraction', ('1.234,5', 'de', 2), 123450)],\n [('regression group-shape 1', ('100,1000.50', 'en', 2), 'ERR:format'),\n  ('regression group-shape 2', (\"1'1234'567.05\", 'ch', 3), 'ERR:format'),\n  ('partial repair guard 1', ('1234,567.00', 'en', 2), 'ERR:format'),\n  ('control: english grouping', ('1,234.56', 'en', 2), 123456),\n  ('control: german short fraction', ('1.234,5', 'de', 2), 123450),\n  ('control: negative below one', ('-0,50', 'de', 2), -50),\n  ('control: narrow space with trailing zero', ('1\\u202f234,500', 'fr', 2), 123450)]]\nfor label, args, expected in cases[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"A deterministic, bounded teaching model with a stipulated toy contract; it makes no claim of conformance to any real regulation, standard, or institution's 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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-currency_rounding_and_fx_conversion-locale-amount-parsing-group-shape","generated_at":"2026-09-29T14:47:01.687736+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Currency amounts must be rounded at the right stage and in the right unit, or ledgers, quotes and settlements drift by minor units.","root_cause":"Group separators are removed without validating group widths.","sha256":"dde70e5e5e726e18412b0d20bde8a8c64d1ed26b438ea52f793705c7747ed329","title":"Digit groups of any width are accepted · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":41.161,"exit_code":1,"observations":[{"actual":"ERR:format","check":"regression group-shape 1","expected":"ERR:format","passed":true},{"actual":123456700,"check":"regression group-shape 2","expected":"ERR:format","passed":false},{"actual":123456,"check":"control: english grouping","expected":123456,"passed":true},{"actual":123450,"check":"control: german short fraction","expected":123450,"passed":true},{"actual":-50,"check":"control: negative below one","expected":-50,"passed":true},{"actual":123450,"check":"control: narrow space with trailing zero","expected":123450,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression group-shape 1\", \"actual\": \"ERR:format\", \"expected\": \"ERR:format\", \"passed\": true}, {\"check\": \"regression group-shape 2\", \"actual\": 123456700, \"expected\": \"ERR:format\", \"passed\": false}, {\"check\": \"control: english grouping\", \"actual\": 123456, \"expected\": 123456, \"passed\": true}, {\"check\": \"control: german short fraction\", \"actual\": 123450, \"expected\": 123450, \"passed\": true}, {\"check\": \"control: negative below one\", \"actual\": -50, \"expected\": -50, \"passed\": true}, {\"check\": \"control: narrow space with trailing zero\", \"actual\": 123450, \"expected\": 123450, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.383,"exit_code":1,"observations":[{"actual":123400,"check":"regression group-shape 1","expected":"ERR:format","passed":false},{"actual":123456700,"check":"regression group-shape 2","expected":"ERR:format","passed":false},{"actual":123456,"check":"control: english grouping","expected":123456,"passed":true},{"actual":123450,"check":"control: german short fraction","expected":123450,"passed":true},{"actual":-50,"check":"control: negative below one","expected":-50,"passed":true},{"actual":123450,"check":"control: narrow space with trailing zero","expected":123450,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression group-shape 1\", \"actual\": 123400, \"expected\": \"ERR:format\", \"passed\": false}, {\"check\": \"regression group-shape 2\", \"actual\": 123456700, \"expected\": \"ERR:format\", \"passed\": false}, {\"check\": \"control: english grouping\", \"actual\": 123456, \"expected\": 123456, \"passed\": true}, {\"check\": \"control: german short fraction\", \"actual\": 123450, \"expected\": 123450, \"passed\": true}, {\"check\": \"control: negative below one\", \"actual\": -50, \"expected\": -50, \"passed\": true}, {\"check\": \"control: narrow space with trailing zero\", \"actual\": 123450, \"expected\": 123450, \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}