agent-Specialization/test
JOJO 77be044c44 fix(versioning): 修复首改文件 diff 基准丢失导致全文件计新增
根因:track_edit 在编辑前备份的 v1(修改前内容)只存在于该消息的
中间行,make_snapshot 用最终行(v2 修改后内容)整体替换该行后,
v1 不再被任何快照引用。对会话中首次被跟踪的文件,diff 配对找不到
上一条消息里的基准,按 added 处理并把全文件计为新增(+479 -0)。
26f31a09 修的是重复行配对,未覆盖这一数据丢失路径,故跨平台复现。

修复(不改数据模型,纯读取侧恢复):
- 新增 _resolve_diff_base_backup:优先用上一条消息快照里的备份;
  缺失时利用备份名确定性(sha256(绝对路径)@vN)与版本逐文件连续的
  不变量,回退到 v(N-1) 作为消息前状态(新建文件 v1 不落盘,自然
  仍判 added);首次出现即 v1 说明消息未改动该文件,与自身比较得 0。
- get_diff_stats / get_file_diff_stats / get_file_patch_lines 三处
  统一走该解析;旧 state 数据(v1 备份文件仍在)透明愈合,亦兼容
  MAX_SNAPSHOTS 逐出旧行的场景。
- 新增 5 个回归测试(生产顺序:track_edit 先于写入);修正 2 个旧
  测试的模拟顺序使其与生产一致(原顺序先写后 track,把新建文件
  误模拟成 v1 首现)。

验证:11/11 通过;旧代码跑新测试 4/5 失败(复现);用事故对话
conv_20260731_114736_581 真实数据只读复算,#1 由 +479/-0 added
修正为 +4/-1 modified(与实际编辑一致),#2 保持 +0/-0;全量测试
失败/错误数与 HEAD 基线完全相同(2+10,均为预存在/环境问题)。
2026-07-31 04:39:35 +00:00
..
test_api_client_multimodal_sanitize.py refactor(naming): 移除代码中的第三方产品名 2026-07-28 18:43:03 +08:00
test_config_paths_resolution.py refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间 2026-07-10 00:35:15 +08:00
test_conversation_model_persistence.py fix(web_terminal): 程序启动自动恢复最近对话时不恢复模型,避免 /new 页面显示旧对话模型;显式加载对话时仍恢复保存的模型 2026-07-13 21:43:51 +08:00
test_conversation_workspace_storage.py feat(memory): refactor proactive memory and conversation recall 2026-05-27 03:09:42 +08:00
test_file_manager_read_empty_file.py feat(host-security+ui): unify host execution/approval behavior, runtime notices, and approval overlay UX 2026-05-12 19:16:38 +08:00
test_host_workspace_manager.py feat: add host workspace manager, mcp-tool-config skill, and UI enhancements 2026-04-28 13:04:51 +08:00
test_media_store_and_mcp_content.py fix: avoid fake MCP completion text for empty results 2026-04-27 13:17:22 +08:00
test_server_refactor_smoke.py feat: 移除实验性间隔思考模式,推理强度前置到前端 2026-07-21 13:47:53 +08:00
test_shallow_versioning.py fix(versioning): 修复首改文件 diff 基准丢失导致全文件计新增 2026-07-31 04:39:35 +00:00
test_skills_manager.py refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间 2026-07-10 00:35:15 +08:00
test_sub_agent_regression.py refactor(naming): 移除代码中的第三方产品名 2026-07-28 18:43:03 +08:00
test_token_usage_extractor.py refactor(models): use dynamic api model registry 2026-05-29 00:20:54 +08:00
test_tool_result_formatter.py refactor(paths): 统一迁移运行态数据路径到 Astrion 命名空间 2026-07-10 00:35:15 +08:00