import json
from pathlib import Path
p = Path(__file__).parent
b, c = [json.loads((p / f'result-{lane}.json').read_text()) for lane in 'BC']
for report in (b, c):
    assert report['failure'] == '' and report['source_unchanged']
    assert report['database_writes'] == 0 and report['original_debug'] is False
    assert set(report['routes']) == {'order_list', 'order_detail', 'order_detail_missing'}
    for key in ('order_list', 'order_detail'):
        r = report['routes'][key]
        assert r['status'] == 200 and r['code'] == 0 and r['source_match']
    d = report['routes']['order_detail']
    assert d['all_root_source_fields_checked'] == 109
    assert d['root_field_set_match'] and d['root_source_mismatch_fields'] == []
    assert d['bank_user_name_present'] and d['bank_user_name_source_equal'] and d['goods_source_match']
    assert report['routes']['order_detail_missing']['code'] == '2'
for key in ('order_detail', 'order_detail_missing'):
    assert b['routes'][key]['wire_shape'] == c['routes'][key]['wire_shape']
assert b['routes']['order_list']['selected_order_wire_shape'] == c['routes']['order_list']['selected_order_wire_shape']
prior = json.loads((p.parent / 'parallel-store-mobile-readonly3-20261010/green-B.json').read_text())
for key in b['routes']:
    assert b['routes'][key]['wire_response_sha256'] == prior['routes'][key]['wire_response_sha256']
print('PASS: 3 GET scenarios each engine; 109 root source fields; bank field and goods; complete wire types; B frozen-request wire SHA unchanged')
