🟡 [M9] 非字符串类型的 timestamp/level 字段被静默丢弃 #19
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
文件:
core/parser/json.rs:127-158分类: 解析 / 数据丢失
问题:
fields.remove(key)先移除字段,再检查值类型。如果值不是字符串(如{"level":30}),字段已从fields中移除,既不在level也不在fields中 → 静默数据丢失。建议修复: 先检查类型,只有成功提取才移除;非字符串值保留在
fields中。已修复,提交 8e9600d。
根因: parse_line 中 fields.remove(key) 在类型检查之前执行,非字符串值(如 {"level":30})被移除后 as_str() 返回 None,导致字段既不在提取结果中也不在 fields 中 → 静默数据丢失。
修复方案:
行为变更: