# -*- coding: utf-8 -*- """票 05 前置侦查:(b) 退化端点 specimen 丰富度 + 二进制端点 + 双节差集。""" from __future__ import annotations import io import json import sys from pathlib import Path sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') SP = Path('.scratch/customer-integration-ready') A4 = Path('D:/code/crm-api-docs/A4 客户管理') merged = {} for name in ['specimens-core-r3.json', 'specimens-heavy-r3.json', 'specimens-incr-r3.json', 'specimens-graph-r3.json', 'specimens-doc-truth.json']: for k, v in json.loads((SP / name).read_text(encoding='utf-8')).items(): merged.setdefault(k, {'src': [], 'v': v})['src'].append(name.replace('specimens-', '').replace('-r3.json', '').replace('.json', '')) # (b) 退化端点 + 二进制端点 + 大列表端点 PROBE = [ 'POST /api/customer/transfer/assign', # failures=[] 'GET /api/customer/import/failures', # data=[] 'POST /api/customer/contact/quickAdd', # failedRows=[] 'POST /api/customer/contact/batchEdit', # failedRows=[] 'GET /api/customer/contact/graph/detail', # nodes/edges=[] 'POST /api/customer/quick-create', # needConfirm/similarHits=null 'GET /api/customer/import/template', # binary 'GET /api/customer/contact/import/template', # binary 'POST /api/customer/contact/export', # binary? 'GET /api/customer/transfer/assignable', # 6047 行大列表 'POST /api/customer/workspace/page', # 现有真值带注记 ] for k in PROBE: if k not in merged: print(f'--- {k} : ❌ 无 specimen') continue e = merged[k] v = e['v'] resp = v.get('response') if isinstance(resp, str): body = resp else: body = json.dumps(resp, ensure_ascii=False) print(f"--- {k} : src={e['src']} resp_len={len(body)}") print(' head:', body[:220].replace('\n', ' ')) # 双节 vs both 差集 lines = (SP / 'audit_t05_out.txt').read_text(encoding='utf-8').splitlines() dual = {l[5:] for l in lines if l.startswith('DUAL:')} ph = {l[3:] for l in lines if l.startswith('PH:')} tv = {l[3:] for l in lines if l.startswith('TV:')} print('\n[DUAL] 双节但非「占位+真值」文件:') for f in sorted(dual - (ph & tv)): flag = '有占位无真值' if f in ph else ('无占位有真值' if f in tv else '??') print(f' {f} ({flag})')