{"abstract":"Every cue from a CRLF subtitle file fails to parse because its end timestamp carries a carriage return.","category":"Subtitle cue timing","checks":9,"contract":"Parse an SRT timestamp HH:MM:SS,mmm to integer milliseconds. Hours have 2 or more digits, minutes and seconds are below 60, the fraction has 1 to 3 digits and is right-padded (\",5\" means 500 ms), \".\" is accepted as the separator, surrounding whitespace (including a CR from CRLF files) is ignored; invalid text returns None.","contract_signature":"s","evaluation_group":"w2-subtitle-cue-timing-srt-parse","failed_approach":"Stripping only leading whitespace still leaves the trailing CR from Windows line endings.","family":"w2-subtitle-cue-timing-srt-parse-surrounding-whitespace","id":"FA-77861","implementations":{"attempt":{"sha256":"e07ebd6317c8994e43f6a183d30a569a3e138dfb7b57182af5c715743125ef17","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    s=s.lstrip()\n    parts=s.replace('.',',').split(',')\n    if len(parts)!=2: return None\n    hms,frac=parts\n    fields=hms.split(':')\n    if len(fields)!=3: return None\n    if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None\n    if len(frac)>3: return None\n    h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])\n    if mi>=60 or se>=60: return None\n    ms=int(frac.ljust(3,'0'))\n    return h*3600000+mi*60000+se*1000+ms\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: surrounding whitespace', ['00:59:59,999\\r'], 3599999), ('regression variant: surrounding whitespace', ['01:05:00,500\\r'], 3900500), ('partial repair probe: surrounding whitespace', ['99:00:59,001 \\r'], 356459001), ('partial repair variant: surrounding whitespace', ['100:59:42.001\\r'], 363582001), ('boundary control', ['00:00:00,000'], 0), ('boundary control', ['00:60:00,000'], None), ('normal control', ['00:00:01,5'], 1500), ('normal control', ['100:00:00,000'], 360000000), ('normal control', ['00:61:00;5 \\r'], None)], [('regression: surrounding whitespace', ['99:00:00.500\\r'], 356400500), ('regression variant: surrounding whitespace', [' 00:05:00.5 '], 300500), ('partial repair probe: surrounding whitespace', ['01:30:01,500 \\r'], 5401500), ('partial repair variant: surrounding whitespace', ['00:30:59,12 '], 1859120), ('boundary control', ['00:00:01,5'], 1500), ('boundary control', ['100:00:00,000'], 360000000), ('normal control', ['123:60:59,5'], None), ('normal control', [' 00:30:60,500'], None), ('normal control', ['00:00:60.1234 '], None)], [('regression: surrounding whitespace', ['99:00:59,001 \\r'], 356459001), ('regression variant: surrounding whitespace', ['100:30:42,500\\r'], 361842500), ('partial repair probe: surrounding whitespace', ['01:05:00,500\\r'], 3900500), ('partial repair variant: surrounding whitespace', ['10:05:42,000 '], 36342000), ('boundary control', ['01:02:03.004'], 3723004), ('boundary control', ['00:00:00,000'], 0), ('normal control', ['123:60:42,999'], None), ('normal control', ['00:30:59;12'], None), ('normal control', ['00:00:60,1234\\r'], None)], [('regression: surrounding whitespace', ['01:30:01,500 \\r'], 5401500), ('regression variant: surrounding whitespace', ['123:05:01,001\\t'], 443101001), ('partial repair probe: surrounding whitespace', [' 00:05:00.5 '], 300500), ('partial repair variant: surrounding whitespace', [' 123:59:42,50 '], 446382500), ('boundary control', ['00:60:00,000'], None), ('boundary control', ['00:00:01,5'], 1500), ('normal control', ['00:59:00.000'], 3540000), ('normal control', [' 00:61:42,000'], None), ('normal control', ['100:60:60,999 '], None)], [('regression: surrounding whitespace', [' 10:05:00.000'], 36300000), ('regression variant: surrounding whitespace', ['02:30:42,5\\t'], 9042500), ('partial repair probe: surrounding whitespace', ['100:30:42,500\\r'], 361842500), ('partial repair variant: surrounding whitespace', ['01:59:00.500\\t'], 7140500), ('boundary control', ['100:00:00,000'], 360000000), ('boundary control', ['01:02:03.004'], 3723004), ('normal control', ['02:00:01,1234 \\r'], None), ('normal control', [' 99:60:60, '], None), ('normal control', [' 100:59:61,50'], None)]]\nfor label, args, expected in fixtures[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":"e323501653d4c0433f4d6d104f3a0d274433def157140e7a7bbd7cea45e4141f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(s):\n    s=s\n    parts=s.replace('.',',').split(',')\n    if len(parts)!=2: return None\n    hms,frac=parts\n    fields=hms.split(':')\n    if len(fields)!=3: return None\n    if not all(p.isdigit() for p in fields) or not frac.isdigit(): return None\n    if len(frac)>3: return None\n    h,mi,se=int(fields[0]),int(fields[1]),int(fields[2])\n    if mi>=60 or se>=60: return None\n    ms=int(frac.ljust(3,'0'))\n    return h*3600000+mi*60000+se*1000+ms\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: surrounding whitespace', ['00:59:59,999\\r'], 3599999), ('regression variant: surrounding whitespace', ['01:05:00,500\\r'], 3900500), ('partial repair probe: surrounding whitespace', ['99:00:59,001 \\r'], 356459001), ('partial repair variant: surrounding whitespace', ['100:59:42.001\\r'], 363582001), ('boundary control', ['00:00:00,000'], 0), ('boundary control', ['00:60:00,000'], None), ('normal control', ['00:00:01,5'], 1500), ('normal control', ['100:00:00,000'], 360000000), ('normal control', ['00:61:00;5 \\r'], None)], [('regression: surrounding whitespace', ['99:00:00.500\\r'], 356400500), ('regression variant: surrounding whitespace', [' 00:05:00.5 '], 300500), ('partial repair probe: surrounding whitespace', ['01:30:01,500 \\r'], 5401500), ('partial repair variant: surrounding whitespace', ['00:30:59,12 '], 1859120), ('boundary control', ['00:00:01,5'], 1500), ('boundary control', ['100:00:00,000'], 360000000), ('normal control', ['123:60:59,5'], None), ('normal control', [' 00:30:60,500'], None), ('normal control', ['00:00:60.1234 '], None)], [('regression: surrounding whitespace', ['99:00:59,001 \\r'], 356459001), ('regression variant: surrounding whitespace', ['100:30:42,500\\r'], 361842500), ('partial repair probe: surrounding whitespace', ['01:05:00,500\\r'], 3900500), ('partial repair variant: surrounding whitespace', ['10:05:42,000 '], 36342000), ('boundary control', ['01:02:03.004'], 3723004), ('boundary control', ['00:00:00,000'], 0), ('normal control', ['123:60:42,999'], None), ('normal control', ['00:30:59;12'], None), ('normal control', ['00:00:60,1234\\r'], None)], [('regression: surrounding whitespace', ['01:30:01,500 \\r'], 5401500), ('regression variant: surrounding whitespace', ['123:05:01,001\\t'], 443101001), ('partial repair probe: surrounding whitespace', [' 00:05:00.5 '], 300500), ('partial repair variant: surrounding whitespace', [' 123:59:42,50 '], 446382500), ('boundary control', ['00:60:00,000'], None), ('boundary control', ['00:00:01,5'], 1500), ('normal control', ['00:59:00.000'], 3540000), ('normal control', [' 00:61:42,000'], None), ('normal control', ['100:60:60,999 '], None)], [('regression: surrounding whitespace', [' 10:05:00.000'], 36300000), ('regression variant: surrounding whitespace', ['02:30:42,5\\t'], 9042500), ('partial repair probe: surrounding whitespace', ['100:30:42,500\\r'], 361842500), ('partial repair variant: surrounding whitespace', ['01:59:00.500\\t'], 7140500), ('boundary control', ['100:00:00,000'], 360000000), ('boundary control', ['01:02:03.004'], 3723004), ('normal control', ['02:00:01,1234 \\r'], None), ('normal control', [' 99:60:60, '], None), ('normal control', [' 100:59:61,50'], None)]]\nfor label, args, expected in fixtures[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 does not claim conformance to any subtitle 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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-subtitle-cue-timing-srt-parse-surrounding-whitespace","generated_at":"2026-09-29T14:49:29.947808+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Subtitle timing defects shift, hide or overlap captions that viewers depend on for comprehension and accessibility.","root_cause":"Surrounding whitespace is not removed, so a trailing CR makes the fraction non-numeric.","sha256":"28d00e83bca765915ec6ad38b349e8b52fbda561a023bfe6c9d5832e02e46f6d","title":"SRT timestamp parsing: surrounding whitespace · 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":40.199,"exit_code":1,"observations":[{"actual":null,"check":"regression: surrounding whitespace","expected":3599999,"passed":false},{"actual":null,"check":"regression variant: surrounding whitespace","expected":3900500,"passed":false},{"actual":null,"check":"partial repair probe: surrounding whitespace","expected":356459001,"passed":false},{"actual":null,"check":"partial repair variant: surrounding whitespace","expected":363582001,"passed":false},{"actual":0,"check":"boundary control","expected":0,"passed":true},{"actual":null,"check":"boundary control","expected":null,"passed":true},{"actual":1500,"check":"normal control","expected":1500,"passed":true},{"actual":360000000,"check":"normal control","expected":360000000,"passed":true},{"actual":null,"check":"normal control","expected":null,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: surrounding whitespace\", \"actual\": null, \"expected\": 3599999, \"passed\": false}, {\"check\": \"regression variant: surrounding whitespace\", \"actual\": null, \"expected\": 3900500, \"passed\": false}, {\"check\": \"partial repair probe: surrounding whitespace\", \"actual\": null, \"expected\": 356459001, \"passed\": false}, {\"check\": \"partial repair variant: surrounding whitespace\", \"actual\": null, \"expected\": 363582001, \"passed\": false}, {\"check\": \"boundary control\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"boundary control\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"normal control\", \"actual\": 1500, \"expected\": 1500, \"passed\": true}, {\"check\": \"normal control\", \"actual\": 360000000, \"expected\": 360000000, \"passed\": true}, {\"check\": \"normal control\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.418,"exit_code":1,"observations":[{"actual":null,"check":"regression: surrounding whitespace","expected":3599999,"passed":false},{"actual":null,"check":"regression variant: surrounding whitespace","expected":3900500,"passed":false},{"actual":null,"check":"partial repair probe: surrounding whitespace","expected":356459001,"passed":false},{"actual":null,"check":"partial repair variant: surrounding whitespace","expected":363582001,"passed":false},{"actual":0,"check":"boundary control","expected":0,"passed":true},{"actual":null,"check":"boundary control","expected":null,"passed":true},{"actual":1500,"check":"normal control","expected":1500,"passed":true},{"actual":360000000,"check":"normal control","expected":360000000,"passed":true},{"actual":null,"check":"normal control","expected":null,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: surrounding whitespace\", \"actual\": null, \"expected\": 3599999, \"passed\": false}, {\"check\": \"regression variant: surrounding whitespace\", \"actual\": null, \"expected\": 3900500, \"passed\": false}, {\"check\": \"partial repair probe: surrounding whitespace\", \"actual\": null, \"expected\": 356459001, \"passed\": false}, {\"check\": \"partial repair variant: surrounding whitespace\", \"actual\": null, \"expected\": 363582001, \"passed\": false}, {\"check\": \"boundary control\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"boundary control\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"normal control\", \"actual\": 1500, \"expected\": 1500, \"passed\": true}, {\"check\": \"normal control\", \"actual\": 360000000, \"expected\": 360000000, \"passed\": true}, {\"check\": \"normal control\", \"actual\": null, \"expected\": null, \"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."}}