# -*- coding: utf-8 -*- """票 10 收工:更新交接档(插入 3.5 节 + 表格行 + 计数行)。""" import io, sys sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') BASE = r'd:\code\crm-backend-matt\.scratch\customer-module' target = BASE + r'\HANDOFF-2026-09-03.md' patch_path = BASE + r'\_t10_patch.md' txt = open(target, 'r', encoding='utf-8').read() patch = open(patch_path, 'r', encoding='utf-8').read().rstrip() + '\n' # 1) 表格行 10 状态 old_row = '| 10 saved-view 接入 | ⏳ | — | 3 scope_key + CustomerSavedViewFilter |' new_row = '| **10 saved-view 接入** | ✅ 第三会话完成 | **+22**(14 单测 + 8 集成) | scope_key 三值 + CustomerSavedViewFilter + savedViewId 落基类;见 3.5 节 |' assert old_row in txt, 'row10 not found' txt = txt.replace(old_row, new_row, 1) # 2) 测试计数现状(crm-customer 121) old_cnt = '**测试计数现状**:crm-customer **99 全绿**(90 + Job 集成测试 9,第三会话全模块回归确认)。' new_cnt = '**测试计数现状**:crm-customer **121 全绿**(99 + 票 10 新增 22,第三会话全模块回归确认)。' assert old_cnt in txt, 'cnt not found' txt = txt.replace(old_cnt, new_cnt, 1) # 3) 在 '## 4. 踩坑记录' 前插入 3.5 节 anchor = '## 4. 踩坑记录' assert anchor in txt, 'anchor not found' txt = txt.replace(anchor, patch + '\n' + anchor, 1) open(target, 'w', encoding='utf-8', newline='').write(txt) print('HANDOFF updated OK') # 清理 patch 文件 import os os.remove(patch_path) print('patch file removed')