broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    identity = r['source'] == r['trusted_source']
    version = r['version'] >= r['minimum_version']
    published = r['now'] >= r['published']
    live = r['now'] < r['expires']
    covered = r['start'] <= r['query'] < r['end']
    status = 'identity' if not identity else ('version' if not version else ('future' if not published else ('expired' if not live else ('uncovered' if not covered else 'ok'))))
    shifted = r['query'] + r['offset'] if status == 'ok' else None
    remaining = r['expires'] - r['now']
    left_margin = r['query'] - r['start']
    right_margin = r['end'] - r['query']
    return [status,shifted,remaining,[left_margin,right_margin] if covered else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 100, 'offset': 7}), ['ok', 107, 10, [0, 100]])
check('fixture 2', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 3, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['ok', 157, 5, [50, 50]])
check('fixture 3', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 1, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['version', None, 5, [50, 50]])
check('fixture 4', solve({'source': 'clock2', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['identity', None, 5, [50, 50]])
check('fixture 5', solve({'source': 'other', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['identity', None, 5, [50, 50]])
check('fixture 6', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 9, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['future', None, 11, [50, 50]])
check('fixture 7', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 20, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['expired', None, 0, [50, 50]])
check('fixture 8', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 21, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['expired', None, 0, [50, 50]])
check('fixture 9', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 200, 'offset': 7}), ['uncovered', None, 5, None])
check('fixture 10', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 99, 'offset': 7}), ['uncovered', None, 5, None])
check('fixture 11', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 199, 'offset': 7}), ['ok', 206, 5, [99, 1]])
check('fixture 12', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 100, 'offset': 7}), ['ok', 107, 5, [0, 100]])
variant = [({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 101, 'offset': 7}, ['ok', 108, 10, [1, 99]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 102, 'offset': 7}, ['ok', 109, 10, [2, 98]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 103, 'offset': 7}, ['ok', 110, 10, [3, 97]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 104, 'offset': 7}, ['ok', 111, 10, [4, 96]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 105, 'offset': 7}, ['ok', 112, 10, [5, 95]])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    identity = r['source'] == r['trusted_source']
    version = r['version'] >= r['minimum_version']
    published = r['now'] >= r['published']
    live = r['now'] < r['expires']
    covered = r['start'] <= r['query'] < r['end']
    status = 'identity' if not identity else ('version' if not version else ('future' if not published else ('expired' if not live else ('uncovered' if not covered else 'ok'))))
    shifted = r['query'] + r['offset'] if status == 'ok' else None
    remaining = max(0,r['expires'] - r['query'])
    left_margin = r['query'] - r['start']
    right_margin = r['end'] - r['query']
    return [status,shifted,remaining,[left_margin,right_margin] if covered else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 100, 'offset': 7}), ['ok', 107, 10, [0, 100]])
check('fixture 2', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 3, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['ok', 157, 5, [50, 50]])
check('fixture 3', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 1, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['version', None, 5, [50, 50]])
check('fixture 4', solve({'source': 'clock2', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['identity', None, 5, [50, 50]])
check('fixture 5', solve({'source': 'other', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['identity', None, 5, [50, 50]])
check('fixture 6', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 9, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['future', None, 11, [50, 50]])
check('fixture 7', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 20, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['expired', None, 0, [50, 50]])
check('fixture 8', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 21, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['expired', None, 0, [50, 50]])
check('fixture 9', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 200, 'offset': 7}), ['uncovered', None, 5, None])
check('fixture 10', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 99, 'offset': 7}), ['uncovered', None, 5, None])
check('fixture 11', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 199, 'offset': 7}), ['ok', 206, 5, [99, 1]])
check('fixture 12', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 100, 'offset': 7}), ['ok', 107, 5, [0, 100]])
variant = [({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 101, 'offset': 7}, ['ok', 108, 10, [1, 99]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 102, 'offset': 7}, ['ok', 109, 10, [2, 98]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 103, 'offset': 7}, ['ok', 110, 10, [3, 97]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 104, 'offset': 7}, ['ok', 111, 10, [4, 96]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 105, 'offset': 7}, ['ok', 112, 10, [5, 95]])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for remaining.

A timescale offset certificate declares coverage [start,end), publication instant, expiry instant, version and source identity. A query may use offset only inside coverage with a currently valid certificate and minimum accepted version. Query time and validation wall time are independent. Return status precedence identity/version/publication/expiry/coverage, admitted shifted coordinate, remaining validity and coverage margin.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    identity = r['source'] == r['trusted_source']
    version = r['version'] >= r['minimum_version']
    published = r['now'] >= r['published']
    live = r['now'] < r['expires']
    covered = r['start'] <= r['query'] < r['end']
    status = 'identity' if not identity else ('version' if not version else ('future' if not published else ('expired' if not live else ('uncovered' if not covered else 'ok'))))
    shifted = r['query'] + r['offset'] if status == 'ok' else None
    remaining = max(0,r['expires'] - r['now'])
    left_margin = r['query'] - r['published']
    right_margin = r['end'] - r['query']
    return [status,shifted,remaining,[left_margin,right_margin] if covered else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 100, 'offset': 7}), ['ok', 107, 10, [0, 100]])
check('fixture 2', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 3, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['ok', 157, 5, [50, 50]])
check('fixture 3', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 1, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['version', None, 5, [50, 50]])
check('fixture 4', solve({'source': 'clock2', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['identity', None, 5, [50, 50]])
check('fixture 5', solve({'source': 'other', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['identity', None, 5, [50, 50]])
check('fixture 6', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 9, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['future', None, 11, [50, 50]])
check('fixture 7', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 20, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['expired', None, 0, [50, 50]])
check('fixture 8', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 21, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['expired', None, 0, [50, 50]])
check('fixture 9', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 200, 'offset': 7}), ['uncovered', None, 5, None])
check('fixture 10', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 99, 'offset': 7}), ['uncovered', None, 5, None])
check('fixture 11', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 199, 'offset': 7}), ['ok', 206, 5, [99, 1]])
check('fixture 12', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 100, 'offset': 7}), ['ok', 107, 5, [0, 100]])
variant = [({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 101, 'offset': 7}, ['ok', 108, 10, [1, 99]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 102, 'offset': 7}, ['ok', 109, 10, [2, 98]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 103, 'offset': 7}, ['ok', 110, 10, [3, 97]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 104, 'offset': 7}, ['ok', 111, 10, [4, 96]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 105, 'offset': 7}, ['ok', 112, 10, [5, 95]])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    identity = r['source'] == r['trusted_source']
    version = r['version'] >= r['minimum_version']
    published = r['now'] >= r['published']
    live = r['now'] < r['expires']
    covered = r['start'] <= r['query'] < r['end']
    status = 'identity' if not identity else ('version' if not version else ('future' if not published else ('expired' if not live else ('uncovered' if not covered else 'ok'))))
    shifted = r['query'] + r['offset'] if status == 'ok' else None
    remaining = max(0,r['expires'] - r['now'])
    left_margin = r['start'] - r['query']
    right_margin = r['end'] - r['query']
    return [status,shifted,remaining,[left_margin,right_margin] if covered else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 100, 'offset': 7}), ['ok', 107, 10, [0, 100]])
check('fixture 2', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 3, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['ok', 157, 5, [50, 50]])
check('fixture 3', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 1, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['version', None, 5, [50, 50]])
check('fixture 4', solve({'source': 'clock2', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['identity', None, 5, [50, 50]])
check('fixture 5', solve({'source': 'other', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['identity', None, 5, [50, 50]])
check('fixture 6', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 9, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['future', None, 11, [50, 50]])
check('fixture 7', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 20, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['expired', None, 0, [50, 50]])
check('fixture 8', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 21, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['expired', None, 0, [50, 50]])
check('fixture 9', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 200, 'offset': 7}), ['uncovered', None, 5, None])
check('fixture 10', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 99, 'offset': 7}), ['uncovered', None, 5, None])
check('fixture 11', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 199, 'offset': 7}), ['ok', 206, 5, [99, 1]])
check('fixture 12', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 100, 'offset': 7}), ['ok', 107, 5, [0, 100]])
variant = [({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 101, 'offset': 7}, ['ok', 108, 10, [1, 99]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 102, 'offset': 7}, ['ok', 109, 10, [2, 98]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 103, 'offset': 7}, ['ok', 110, 10, [3, 97]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 104, 'offset': 7}, ['ok', 111, 10, [4, 96]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 105, 'offset': 7}, ['ok', 112, 10, [5, 95]])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for left_margin.

A timescale offset certificate declares coverage [start,end), publication instant, expiry instant, version and source identity. A query may use offset only inside coverage with a currently valid certificate and minimum accepted version. Query time and validation wall time are independent. Return status precedence identity/version/publication/expiry/coverage, admitted shifted coordinate, remaining validity and coverage margin.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    identity = r['source'] == r['trusted_source']
    version = r['version'] >= r['minimum_version']
    published = r['now'] >= r['published']
    live = r['now'] < r['expires']
    covered = r['start'] <= r['query'] < r['end']
    status = 'identity' if not identity else ('version' if not version else ('future' if not published else ('expired' if not live else ('uncovered' if not covered else 'ok'))))
    shifted = r['query'] + r['offset'] if status == 'ok' else None
    remaining = max(0,r['expires'] - r['now'])
    left_margin = r['query'] - r['start']
    right_margin = r['expires'] - r['query']
    return [status,shifted,remaining,[left_margin,right_margin] if covered else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 100, 'offset': 7}), ['ok', 107, 10, [0, 100]])
check('fixture 2', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 3, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['ok', 157, 5, [50, 50]])
check('fixture 3', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 1, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['version', None, 5, [50, 50]])
check('fixture 4', solve({'source': 'clock2', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['identity', None, 5, [50, 50]])
check('fixture 5', solve({'source': 'other', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['identity', None, 5, [50, 50]])
check('fixture 6', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 9, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['future', None, 11, [50, 50]])
check('fixture 7', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 20, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['expired', None, 0, [50, 50]])
check('fixture 8', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 21, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['expired', None, 0, [50, 50]])
check('fixture 9', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 200, 'offset': 7}), ['uncovered', None, 5, None])
check('fixture 10', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 99, 'offset': 7}), ['uncovered', None, 5, None])
check('fixture 11', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 199, 'offset': 7}), ['ok', 206, 5, [99, 1]])
check('fixture 12', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 100, 'offset': 7}), ['ok', 107, 5, [0, 100]])
variant = [({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 101, 'offset': 7}, ['ok', 108, 10, [1, 99]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 102, 'offset': 7}, ['ok', 109, 10, [2, 98]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 103, 'offset': 7}, ['ok', 110, 10, [3, 97]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 104, 'offset': 7}, ['ok', 111, 10, [4, 96]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 105, 'offset': 7}, ['ok', 112, 10, [5, 95]])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    identity = r['source'] == r['trusted_source']
    version = r['version'] >= r['minimum_version']
    published = r['now'] >= r['published']
    live = r['now'] < r['expires']
    covered = r['start'] <= r['query'] < r['end']
    status = 'identity' if not identity else ('version' if not version else ('future' if not published else ('expired' if not live else ('uncovered' if not covered else 'ok'))))
    shifted = r['query'] + r['offset'] if status == 'ok' else None
    remaining = max(0,r['expires'] - r['now'])
    left_margin = r['query'] - r['start']
    right_margin = r['query'] - r['end']
    return [status,shifted,remaining,[left_margin,right_margin] if covered else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 100, 'offset': 7}), ['ok', 107, 10, [0, 100]])
check('fixture 2', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 3, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['ok', 157, 5, [50, 50]])
check('fixture 3', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 1, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['version', None, 5, [50, 50]])
check('fixture 4', solve({'source': 'clock2', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['identity', None, 5, [50, 50]])
check('fixture 5', solve({'source': 'other', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['identity', None, 5, [50, 50]])
check('fixture 6', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 9, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['future', None, 11, [50, 50]])
check('fixture 7', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 20, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['expired', None, 0, [50, 50]])
check('fixture 8', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 21, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 150, 'offset': 7}), ['expired', None, 0, [50, 50]])
check('fixture 9', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 200, 'offset': 7}), ['uncovered', None, 5, None])
check('fixture 10', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 99, 'offset': 7}), ['uncovered', None, 5, None])
check('fixture 11', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 199, 'offset': 7}), ['ok', 206, 5, [99, 1]])
check('fixture 12', solve({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 15, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 100, 'offset': 7}), ['ok', 107, 5, [0, 100]])
variant = [({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 101, 'offset': 7}, ['ok', 108, 10, [1, 99]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 102, 'offset': 7}, ['ok', 109, 10, [2, 98]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 103, 'offset': 7}, ['ok', 110, 10, [3, 97]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 104, 'offset': 7}, ['ok', 111, 10, [4, 96]]), ({'source': 'clock', 'trusted_source': 'clock', 'version': 2, 'minimum_version': 2, 'now': 10, 'published': 10, 'expires': 20, 'start': 100, 'end': 200, 'query': 105, 'offset': 7}, ['ok', 112, 10, [5, 95]])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for right_margin.

A timescale offset certificate declares coverage [start,end), publication instant, expiry instant, version and source identity. A query may use offset only inside coverage with a currently valid certificate and minimum accepted version. Query time and validation wall time are independent. Return status precedence identity/version/publication/expiry/coverage, admitted shifted coordinate, remaining validity and coverage margin.

split: open-access