fix(push): 完善厂商推送排障日志 #198
Reference in New Issue
Block a user
Delete Branch "fix-pushlog"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
🤖 review-pr 深审结论
🟡 需关注(置信度 0.85)— 排障日志改得扎实、35 项 push 测试全过;但有一处厂商鉴权凭据明文入日志。
实跑(worktree 合并最新 main)
pytest tests/test_push_center.py tests/test_device_push.py→ 35 passed;ruff 干净time/hashlib/json均已导入(无 NameError);10 个_request_json/_request_form调用点都补齐了必填vendor=/operation=问题
accesstoken/authtoken等键,但响应侧走_raw_log_summary(不脱敏),而 honor/huawei/vivo/oppo 的 authenticate 响应体正好带access_token/authToken/auth_token。本 PR 自带的test_vendor_http_logs_device_token_raw_response_and_elapsed就断言"raw-access-token" in messages→ 厂商 bearer token 会以 INFO 落盘。虽短期、仅推送权限,但与本 PR「不暴露服务端鉴权凭据」目标不一致。建议 authenticate 类响应改走_log_summary(已能脱敏 accesstoken/authtoken 键)或给响应摘要加一层脱敏。正面:vendor/operation/endpoint/elapsed_ms 结构化、单条长度上限、递归深度/键数护栏都到位;device token 刻意保留用于排障投递,内部日志可接受。
⚠️ 合并级冲突(与 #199,必看):#198 把
_request_json/_request_form的vendor/operation改成必填;#199 新增的_send_honor_data/_send_huawei_data/_send_xiaomi_data+vivo 10089 回退调用时没传这两参。git 能干净自动合并、无文本冲突,但实跑证实合并后调用_send_xiaomi_data抛TypeError: _request_form() missing 2 required keyword-only arguments: 'vendor' and 'operation'。谁后合谁必须给这些新 data 调用补vendor=/operation=,rebase 后重跑pytest tests/test_push_center.py。只读深审 · worktree 合并最新 main · 已实跑