#!/usr/bin/env python3
"""Recheck frozen literal-only PDO option probe, no network/DB activity."""
import hashlib
import json
from pathlib import Path

PRIVATE = Path('/Users/wiscourper/Documents/workspace/local/dm8-batch116-20261012.S1TtvG')


def verify():
    for name, digest in [
        ('dm-stringify-probe-20261012.php', '9e27e6d6f9adcfe384abc845226f11b2fc6445d05cb1c30dd7d77901337a2ea1'),
        ('dm-stringify-result-20261012.json', '26bb761ad1dfc870e1682b5ae98c180e9297831b5f9cc80a40c9e57fcef6f069'),
    ]:
        assert hashlib.sha256((PRIVATE / name).read_bytes()).hexdigest() == digest
    r = json.loads((PRIVATE / 'dm-stringify-result-20261012.json').read_text())
    assert r['literal_select_count'] == 6 and r['business_sql'] == r['dml_ddl'] == 0
    assert not r['application_configuration_changed'] and set(r['schemas']) == {'store', 'ai_api'}
    for connection in r['schemas'].values():
        for name in ['stringify_true', 'stringify_false']:
            assert connection['settings'][name]['set_result'] is True
        for mode in ['baseline', 'stringify_true', 'stringify_false']:
            sample = connection['queries'][mode]
            assert sample['fields']['w']['php_type'] == ('string' if mode == 'stringify_true' else 'double')
            assert sample['fields']['w']['string_value'] == '1234567890.1235'
            assert not sample['wide_is_exact_string'] and sample['server_text_exact']
            assert sample['fields']['exact_w']['value'] == '1234567890.12345678'
    return {'status': 'verified', 'http_coverage_delta': 0, 'global_stringify_not_a_precision_fix': True}


if __name__ == '__main__':
    print(json.dumps(verify()))
