{"abstract":"Timestamps a few ticks before a frame boundary map to the previous frame.","category":"Broadcast timecode arithmetic","checks":9,"contract":"PTS values are 33-bit 90 kHz ticks. The elapsed ticks since first_pts wrap modulo 2^33, except that a PTS less than 90000 ticks before first_pts (reordering pre-roll) returns None. The frame is the nearest frame at rate [N,D] (halves up); the label uses nominal rate ceil(N/D) and wraps at 24 hours.","contract_signature":"pts, first_pts, fps","evaluation_group":"w2-broadcast-timecode-arithmetic-pts-to-frame","failed_approach":"Float half-to-even rounding still misplaces exact half-frame ticks.","family":"w2-broadcast-timecode-arithmetic-pts-to-frame-nearest-frame","id":"FA-78831","implementations":{"attempt":{"sha256":"51302013c58ca53ab8d70ed24e54c6ab66281e70ed8e4782f1c8c07b0cf6c30c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(pts, first_pts, fps):\n    WRAP=1<<33\n    raw=pts-first_pts\n    if -90000<raw<0:\n        return None\n    d=raw%WRAP\n    num,den=fps\n    n=round(d*num/(90000*den))\n    nominal=-(-num//den)\n    return [n,'%02d:%02d:%02d:%02d'%(n//(3600*nominal)%24,n//(60*nominal)%60,n//nominal%60,n%nominal)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: nearest frame', [1800, 0, [25, 1]], [1, '00:00:00:01']), ('regression variant: nearest frame', [877, 8589933592, [24000, 1001]], [1, '00:00:00:01']), ('partial repair probe: nearest frame', [8589846392, 8589844592, [25, 1]], [1, '00:00:00:01']), ('partial repair variant: nearest frame', [800, 8589933592, [25, 1]], [1, '00:00:00:01']), ('boundary control', [100, 8589931092, [25, 1]], [1, '00:00:00:01']), ('boundary control', [0, 45000, [25, 1]], None), ('normal control', [901502, 900000, [24000, 1001]], [0, '00:00:00:00']), ('normal control', [7775999000, 8589933592, [50, 1]], [4320000, '00:00:00:00']), ('normal control', [1801, 0, [50, 1]], [1, '00:00:00:01'])], [('regression: nearest frame', [1502, 0, [30000, 1001]], [1, '00:00:00:01']), ('regression variant: nearest frame', [36000, 126000, [24000, 1001]], [2288337, '02:29:07:09']), ('partial repair probe: nearest frame', [901800, 900000, [25, 1]], [1, '00:00:00:01']), ('partial repair variant: nearest frame', [1800, 0, [25, 1]], [1, '00:00:00:01']), ('boundary control', [0, 45000, [25, 1]], None), ('boundary control', [100, 8589931092, [25, 1]], [1, '00:00:00:01']), ('normal control', [900001, 900000, [50, 1]], [0, '00:00:00:00']), ('normal control', [8589846093, 8589844592, [25, 1]], [0, '00:00:00:00']), ('normal control', [3754, 0, [24000, 1001]], [1, '00:00:00:01'])], [('regression: nearest frame', [0, 90000, [25, 1]], [2386068, '02:30:42:18']), ('regression variant: nearest frame', [324126000, 126000, [24000, 1001]], [86314, '00:59:56:10']), ('partial repair probe: nearest frame', [800, 8589933592, [25, 1]], [1, '00:00:00:01']), ('partial repair variant: nearest frame', [127800, 126000, [25, 1]], [1, '00:00:00:01']), ('boundary control', [100, 8589931092, [25, 1]], [1, '00:00:00:01']), ('boundary control', [0, 45000, [25, 1]], None), ('normal control', [126000, 126000, [25, 1]], [0, '00:00:00:00']), ('normal control', [0, 0, [50, 1]], [0, '00:00:00:00']), ('normal control', [3753, 0, [50, 1]], [2, '00:00:00:02'])], [('regression: nearest frame', [127800, 126000, [25, 1]], [1, '00:00:00:01']), ('regression variant: nearest frame', [8586244592, 8589844592, [25, 1]], [2385093, '02:30:03:18']), ('partial repair probe: nearest frame', [1800, 0, [25, 1]], [1, '00:00:00:01']), ('partial repair variant: nearest frame', [8589846392, 8589844592, [25, 1]], [1, '00:00:00:01']), ('boundary control', [0, 45000, [25, 1]], None), ('boundary control', [100, 8589931092, [25, 1]], [1, '00:00:00:01']), ('normal control', [129754, 126000, [25, 1]], [1, '00:00:00:01']), ('normal control', [7776000000, 0, [24000, 1001]], [2071528, '23:58:33:16']), ('normal control', [8586460592, 126000, [30000, 1001]], [2859252, '02:28:28:12'])], [('regression: nearest frame', [35999, 126000, [24000, 1001]], [2288337, '02:29:07:09']), ('regression variant: nearest frame', [809999, 900000, [25, 1]], [2386068, '02:30:42:18']), ('partial repair probe: nearest frame', [127800, 126000, [25, 1]], [1, '00:00:00:01']), ('partial repair variant: nearest frame', [901800, 900000, [25, 1]], [1, '00:00:00:01']), ('boundary control', [100, 8589931092, [25, 1]], [1, '00:00:00:01']), ('boundary control', [0, 45000, [25, 1]], None), ('normal control', [810001, 900000, [24000, 1001]], None), ('normal control', [4294966296, 8589933592, [24000, 1001]], [1144180, '13:14:34:04']), ('normal control', [127502, 126000, [25, 1]], [0, '00:00:00:00'])]]\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":"924be05df8a75d9889ee235f7e13789d3e717b8335692f85e481ebd8f8fd710d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(pts, first_pts, fps):\n    WRAP=1<<33\n    raw=pts-first_pts\n    if -90000<raw<0:\n        return None\n    d=raw%WRAP\n    num,den=fps\n    n=d*num//(90000*den)\n    nominal=-(-num//den)\n    return [n,'%02d:%02d:%02d:%02d'%(n//(3600*nominal)%24,n//(60*nominal)%60,n//nominal%60,n%nominal)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[('regression: nearest frame', [1800, 0, [25, 1]], [1, '00:00:00:01']), ('regression variant: nearest frame', [877, 8589933592, [24000, 1001]], [1, '00:00:00:01']), ('partial repair probe: nearest frame', [8589846392, 8589844592, [25, 1]], [1, '00:00:00:01']), ('partial repair variant: nearest frame', [800, 8589933592, [25, 1]], [1, '00:00:00:01']), ('boundary control', [100, 8589931092, [25, 1]], [1, '00:00:00:01']), ('boundary control', [0, 45000, [25, 1]], None), ('normal control', [901502, 900000, [24000, 1001]], [0, '00:00:00:00']), ('normal control', [7775999000, 8589933592, [50, 1]], [4320000, '00:00:00:00']), ('normal control', [1801, 0, [50, 1]], [1, '00:00:00:01'])], [('regression: nearest frame', [1502, 0, [30000, 1001]], [1, '00:00:00:01']), ('regression variant: nearest frame', [36000, 126000, [24000, 1001]], [2288337, '02:29:07:09']), ('partial repair probe: nearest frame', [901800, 900000, [25, 1]], [1, '00:00:00:01']), ('partial repair variant: nearest frame', [1800, 0, [25, 1]], [1, '00:00:00:01']), ('boundary control', [0, 45000, [25, 1]], None), ('boundary control', [100, 8589931092, [25, 1]], [1, '00:00:00:01']), ('normal control', [900001, 900000, [50, 1]], [0, '00:00:00:00']), ('normal control', [8589846093, 8589844592, [25, 1]], [0, '00:00:00:00']), ('normal control', [3754, 0, [24000, 1001]], [1, '00:00:00:01'])], [('regression: nearest frame', [0, 90000, [25, 1]], [2386068, '02:30:42:18']), ('regression variant: nearest frame', [324126000, 126000, [24000, 1001]], [86314, '00:59:56:10']), ('partial repair probe: nearest frame', [800, 8589933592, [25, 1]], [1, '00:00:00:01']), ('partial repair variant: nearest frame', [127800, 126000, [25, 1]], [1, '00:00:00:01']), ('boundary control', [100, 8589931092, [25, 1]], [1, '00:00:00:01']), ('boundary control', [0, 45000, [25, 1]], None), ('normal control', [126000, 126000, [25, 1]], [0, '00:00:00:00']), ('normal control', [0, 0, [50, 1]], [0, '00:00:00:00']), ('normal control', [3753, 0, [50, 1]], [2, '00:00:00:02'])], [('regression: nearest frame', [127800, 126000, [25, 1]], [1, '00:00:00:01']), ('regression variant: nearest frame', [8586244592, 8589844592, [25, 1]], [2385093, '02:30:03:18']), ('partial repair probe: nearest frame', [1800, 0, [25, 1]], [1, '00:00:00:01']), ('partial repair variant: nearest frame', [8589846392, 8589844592, [25, 1]], [1, '00:00:00:01']), ('boundary control', [0, 45000, [25, 1]], None), ('boundary control', [100, 8589931092, [25, 1]], [1, '00:00:00:01']), ('normal control', [129754, 126000, [25, 1]], [1, '00:00:00:01']), ('normal control', [7776000000, 0, [24000, 1001]], [2071528, '23:58:33:16']), ('normal control', [8586460592, 126000, [30000, 1001]], [2859252, '02:28:28:12'])], [('regression: nearest frame', [35999, 126000, [24000, 1001]], [2288337, '02:29:07:09']), ('regression variant: nearest frame', [809999, 900000, [25, 1]], [2386068, '02:30:42:18']), ('partial repair probe: nearest frame', [127800, 126000, [25, 1]], [1, '00:00:00:01']), ('partial repair variant: nearest frame', [901800, 900000, [25, 1]], [1, '00:00:00:01']), ('boundary control', [100, 8589931092, [25, 1]], [1, '00:00:00:01']), ('boundary control', [0, 45000, [25, 1]], None), ('normal control', [810001, 900000, [24000, 1001]], None), ('normal control', [4294966296, 8589933592, [24000, 1001]], [1144180, '13:14:34:04']), ('normal control', [127502, 126000, [25, 1]], [0, '00:00:00:00'])]]\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 SMPTE or any broadcast 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-broadcast-timecode-arithmetic-pts-to-frame-nearest-frame","generated_at":"2026-09-29T14:49:39.007854+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Timecode arithmetic errors misplace edits, commercial breaks and captions against the broadcast clock.","root_cause":"The frame index is floored.","sha256":"d0ffe0be2c66449204f356d373d6c05601543d0d0bc1fed4237d2c61787ae8f9","title":"90 kHz presentation timestamp to frame label: nearest frame · 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":39.228,"exit_code":1,"observations":[{"actual":[0,"00:00:00:00"],"check":"regression: nearest frame","expected":[1,"00:00:00:01"],"passed":false},{"actual":[1,"00:00:00:01"],"check":"regression variant: nearest frame","expected":[1,"00:00:00:01"],"passed":true},{"actual":[0,"00:00:00:00"],"check":"partial repair probe: nearest frame","expected":[1,"00:00:00:01"],"passed":false},{"actual":[0,"00:00:00:00"],"check":"partial repair variant: nearest frame","expected":[1,"00:00:00:01"],"passed":false},{"actual":[1,"00:00:00:01"],"check":"boundary control","expected":[1,"00:00:00:01"],"passed":true},{"actual":null,"check":"boundary control","expected":null,"passed":true},{"actual":[0,"00:00:00:00"],"check":"normal control","expected":[0,"00:00:00:00"],"passed":true},{"actual":[4320000,"00:00:00:00"],"check":"normal control","expected":[4320000,"00:00:00:00"],"passed":true},{"actual":[1,"00:00:00:01"],"check":"normal control","expected":[1,"00:00:00:01"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: nearest frame\", \"actual\": [0, \"00:00:00:00\"], \"expected\": [1, \"00:00:00:01\"], \"passed\": false}, {\"check\": \"regression variant: nearest frame\", \"actual\": [1, \"00:00:00:01\"], \"expected\": [1, \"00:00:00:01\"], \"passed\": true}, {\"check\": \"partial repair probe: nearest frame\", \"actual\": [0, \"00:00:00:00\"], \"expected\": [1, \"00:00:00:01\"], \"passed\": false}, {\"check\": \"partial repair variant: nearest frame\", \"actual\": [0, \"00:00:00:00\"], \"expected\": [1, \"00:00:00:01\"], \"passed\": false}, {\"check\": \"boundary control\", \"actual\": [1, \"00:00:00:01\"], \"expected\": [1, \"00:00:00:01\"], \"passed\": true}, {\"check\": \"boundary control\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"normal control\", \"actual\": [0, \"00:00:00:00\"], \"expected\": [0, \"00:00:00:00\"], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [4320000, \"00:00:00:00\"], \"expected\": [4320000, \"00:00:00:00\"], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [1, \"00:00:00:01\"], \"expected\": [1, \"00:00:00:01\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.113,"exit_code":1,"observations":[{"actual":[0,"00:00:00:00"],"check":"regression: nearest frame","expected":[1,"00:00:00:01"],"passed":false},{"actual":[0,"00:00:00:00"],"check":"regression variant: nearest frame","expected":[1,"00:00:00:01"],"passed":false},{"actual":[0,"00:00:00:00"],"check":"partial repair probe: nearest frame","expected":[1,"00:00:00:01"],"passed":false},{"actual":[0,"00:00:00:00"],"check":"partial repair variant: nearest frame","expected":[1,"00:00:00:01"],"passed":false},{"actual":[1,"00:00:00:01"],"check":"boundary control","expected":[1,"00:00:00:01"],"passed":true},{"actual":null,"check":"boundary control","expected":null,"passed":true},{"actual":[0,"00:00:00:00"],"check":"normal control","expected":[0,"00:00:00:00"],"passed":true},{"actual":[4320000,"00:00:00:00"],"check":"normal control","expected":[4320000,"00:00:00:00"],"passed":true},{"actual":[1,"00:00:00:01"],"check":"normal control","expected":[1,"00:00:00:01"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: nearest frame\", \"actual\": [0, \"00:00:00:00\"], \"expected\": [1, \"00:00:00:01\"], \"passed\": false}, {\"check\": \"regression variant: nearest frame\", \"actual\": [0, \"00:00:00:00\"], \"expected\": [1, \"00:00:00:01\"], \"passed\": false}, {\"check\": \"partial repair probe: nearest frame\", \"actual\": [0, \"00:00:00:00\"], \"expected\": [1, \"00:00:00:01\"], \"passed\": false}, {\"check\": \"partial repair variant: nearest frame\", \"actual\": [0, \"00:00:00:00\"], \"expected\": [1, \"00:00:00:01\"], \"passed\": false}, {\"check\": \"boundary control\", \"actual\": [1, \"00:00:00:01\"], \"expected\": [1, \"00:00:00:01\"], \"passed\": true}, {\"check\": \"boundary control\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"normal control\", \"actual\": [0, \"00:00:00:00\"], \"expected\": [0, \"00:00:00:00\"], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [4320000, \"00:00:00:00\"], \"expected\": [4320000, \"00:00:00:00\"], \"passed\": true}, {\"check\": \"normal control\", \"actual\": [1, \"00:00:00:01\"], \"expected\": [1, \"00:00:00:01\"], \"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."}}