# -*- coding: utf-8 -*- """stats-incr.py — incr 套件 checks JSON 结构探测与统计""" import json, io, sys sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') data = json.load(open('.scratch/customer-e2e-r2/e2e-incr-checks.json', encoding='utf-8')) print('top type =', type(data).__name__) if isinstance(data, dict): print('top keys =', list(data.keys())) checks = data.get('checks') else: checks = data print('checks type =', type(checks).__name__, 'len =', len(checks) if checks else 0) if checks: first = checks[0] print('item type =', type(first).__name__) if isinstance(first, dict): print('item keys =', list(first.keys())) n = {} for c in checks: v = c.get('verdict') n[v] = n.get(v, 0) + 1 print('verdict counts =', n) print('\n--- 非 ✅ 项 ---') for c in checks: if c.get('verdict') != '✅': print(f"{c.get('verdict')} [{c.get('flow')}] {c.get('case')}\n {str(c.get('detail'))[:220]}") else: print('sample =', str(checks[:3])[:400])