job51-gitlab-cr-node-jt-1 2.6.4 → 2.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  # GitLab Code Review AI Tool 技术文档
2
2
 
3
3
  **项目名称**: job51-gitlab-cr-node
4
- **当前版本**: 2.6.4
4
+ **当前版本**: 2.6.5
5
5
  **作者**: tao.jing
6
6
  **最后更新**: 2026-04-16
7
7
  **项目地址**: https://gitdev.51job.com/51jobweb/ai-agent
@@ -27,6 +27,14 @@
27
27
 
28
28
  ## 版本历史
29
29
 
30
+ ### v2.6.5 (2026-04-16)
31
+
32
+ **Bug 修复**:
33
+ - **移除无效的 position_type 字段**:GitLab API 不接受 `position_type: 'new'` 或 `position_type: 'old'` 参数
34
+ - 问题现象:`400 Bad request - {"error":"position[position_type] does not have a valid value"}`,所有评论降级为一般讨论
35
+ - 修复方案:移除 `targetLine` 对象中的 `position_type` 字段,GitLab API 自动根据 `new_path/new_line` 或 `old_path/old_line` 判断评论类型
36
+ - 修复文件:`index.js:601-631`
37
+
30
38
  ### v2.6.4 (2026-04-16)
31
39
 
32
40
  **Bug 修复**:
package/index.js CHANGED
@@ -600,8 +600,7 @@ ${diffObject.diff}`;
600
600
  } else {
601
601
  targetLine = {
602
602
  old_path: problemInfo.old_path || diff_info.old_path,
603
- old_line: problemInfo.old_line,
604
- position_type: 'old'
603
+ old_line: problemInfo.old_line
605
604
  };
606
605
  }
607
606
  } else if (problemInfo.new_line) {
@@ -614,8 +613,7 @@ ${diffObject.diff}`;
614
613
  } else {
615
614
  targetLine = {
616
615
  old_path: problemInfo.new_path || diff_info.old_path,
617
- old_line: problemInfo.new_line,
618
- position_type: 'old'
616
+ old_line: problemInfo.new_line
619
617
  };
620
618
  }
621
619
  } else if (newCount === 0) {
@@ -623,11 +621,10 @@ ${diffObject.diff}`;
623
621
  } else if (problemInfo.new_line < newStart || problemInfo.new_line > newEnd) {
624
622
  skipReason = `new_line=${problemInfo.new_line} 超出 diff 块范围 [${newStart}, ${newEnd}]`;
625
623
  } else {
626
- // 新增文件/新增行:使用 position_type: 'new',GitLab API 需要这个字段
624
+ // 新增文件/新增行:使用 new_path + new_line
627
625
  targetLine = {
628
626
  new_path: problemInfo.new_path || diff_info.new_path,
629
- new_line: problemInfo.new_line,
630
- position_type: 'new'
627
+ new_line: problemInfo.new_line
631
628
  };
632
629
  }
633
630
  }