import json
from pathlib import Path
p = Path(__file__).parent
b, c = [json.loads((p / f'terminal-get-{lane}.json').read_text()) for lane in 'BC']
for r in (b, c):
    assert r['case_count'] == 41 and r['error'] is None
    assert r['cleanup'] == {'token_absent': True, 'full_natural_table_unchanged': True, 'framework_dml_observed': 0, 'fixture_db_rows_created': 0}
def index(r):
    return {(x['method'], x['path'], x['input_label']): x for x in r['cases']}
bi, ci = index(b), index(c)
assert set(bi) == set(ci) and len(bi) == 41
for key, x in bi.items():
    y = ci[key]
    assert key[:2] == ('GET', '/terminal/Enum/all')
    assert x['complete_wire_sha_without_trace'] == y['complete_wire_sha_without_trace'], key
    assert x['raw_json_shape'] == y['raw_json_shape'], key
    if key[2] == 'NULL':
        # GET serialization omits null, so this is an actual missing-parameter rejection.
        assert x['business_status'] == y['business_status'] == 500
    else:
        assert x['http_status'] == y['http_status'] == 200
        assert x['business_status'] == y['business_status'] == 200
        assert x['full_source_projection_equal'] and y['full_source_projection_equal']
        assert x['projected_source_sha'] == y['projected_source_sha']
        assert x['source_error'] is None and y['source_error'] is None
print('PASS: actual terminal GET 41 scenarios each engine; 17 positive projections; complete wire/source equal; distinct from supplemental POST evidence')
