This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/devlake.git
The following commit(s) were added to refs/heads/main by this push:
new fdca8966a fix(zentao): store bug severity as its decimal string (#9382)
fdca8966a is described below
commit fdca8966a182e210b84cc1d760e2c08a50d0e167
Author: Shivam Sharma <[email protected]>
AuthorDate: Thu Nov 12 08:05:59 2026 +0530
fix(zentao): store bug severity as its decimal string (#9382)
The bug converter set issues.severity with string(rune(severity)),
which turns severity 3 into the control character U+0003 instead of
"3". Format it with strconv.Itoa through a getSeverity helper next to
getPriority, and fix the \x03 bytes in the e2e snapshots.
Closes #9380
Generated-by: Claude Code (Claude Opus 5.5)
Signed-off-by: Shivam Sharma
<[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../plugins/zentao/e2e/snapshot_tables/issues_bug.csv | 12 ++++++------
.../e2e/snapshot_tables/issues_bug_for_due_date.csv | 2 +-
backend/plugins/zentao/tasks/bug_convertor.go | 2 +-
backend/plugins/zentao/tasks/shared.go | 6 ++++++
backend/plugins/zentao/tasks/shared_test.go | 17 +++++++++++++++++
5 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/backend/plugins/zentao/e2e/snapshot_tables/issues_bug.csv
b/backend/plugins/zentao/e2e/snapshot_tables/issues_bug.csv
index d15bec1c8..76843f1d3 100644
--- a/backend/plugins/zentao/e2e/snapshot_tables/issues_bug.csv
+++ b/backend/plugins/zentao/e2e/snapshot_tables/issues_bug.csv
@@ -1,7 +1,7 @@
id,url,icon_url,issue_key,title,description,epic_key,type,original_type,status,original_status,story_point,resolution_date,created_date,updated_date,lead_time_minutes,original_estimate_minutes,time_spent_minutes,time_remaining_minutes,creator_id,creator_name,assignee_id,assignee_name,parent_issue_id,priority,severity,urgency,component,is_subtask,due_date
-zentao:ZentaoBug:1:1,http://iwater.red:8000/bug-view-1.html,,1,首页页面问题,,,BUG,bug,DONE,active,,,2012-06-05T02:56:11.000+00:00,2021-04-28T03:09:08.000+00:00,,,,,zentao:ZentaoAccount:1:7,测试甲,zentao:ZentaoAccount:1:4,开发甲,zentao:ZentaoStory:1:1,1,,,,0,
-zentao:ZentaoBug:1:2,http://iwater.red:8000/bug-view-2.html,,2,新闻中心页面问题,,,BUG,bug,DONE,active,,,2012-06-05T02:57:11.000+00:00,2022-10-05T04:19:22.000+00:00,,,,,zentao:ZentaoAccount:1:7,测试甲,,,zentao:ZentaoStory:1:2,2,,,,0,2022-10-05T16:00:00.000+00:00
-zentao:ZentaoBug:1:3,http://iwater.red:8000/bug-view-3.html,,3,成果展示页面问题,,,BUG,bug,DONE,active,,,2012-06-05T02:58:22.000+00:00,2021-04-28T03:09:08.000+00:00,,,,,zentao:ZentaoAccount:1:8,测试乙,zentao:ZentaoAccount:1:4,开发甲,zentao:ZentaoStory:1:3,1,,,,0,
-zentao:ZentaoBug:1:4,http://iwater.red:8000/bug-view-4.html,,4,售后服务页面问题,,,BUG,bug,resolved,resolved,,,2012-06-05T03:00:19.000+00:00,2022-10-05T04:10:08.000+00:00,,,,,zentao:ZentaoAccount:1:9,测试丙,zentao:ZentaoAccount:1:9,测试丙,zentao:ZentaoStory:1:4,1,,,,0,
-zentao:ZentaoBug:1:5,http://iwater.red:8000/bug-view-5.html,,5,首页页面问题,,,BUG,bug,DONE,active,,,2012-06-05T02:56:11.000+00:00,2021-04-28T03:09:08.000+00:00,,,,,zentao:ZentaoAccount:1:7,测试甲,zentao:ZentaoAccount:1:4,开发甲,zentao:ZentaoStory:1:1,1,,,,0,
-zentao:ZentaoBug:1:6,http://iwater.red:8000/bug-view-6.html,,6,新闻中心页面问题,,,BUG,bug,DONE,active,,,2012-06-05T02:57:11.000+00:00,2022-10-05T04:19:22.000+00:00,,,,,zentao:ZentaoAccount:1:7,测试甲,,,zentao:ZentaoStory:1:2,2,,,,0,2022-10-05T16:00:00.000+00:00
+zentao:ZentaoBug:1:1,http://iwater.red:8000/bug-view-1.html,,1,首页页面问题,,,BUG,bug,DONE,active,,,2012-06-05T02:56:11.000+00:00,2021-04-28T03:09:08.000+00:00,,,,,zentao:ZentaoAccount:1:7,测试甲,zentao:ZentaoAccount:1:4,开发甲,zentao:ZentaoStory:1:1,1,3,,,0,
+zentao:ZentaoBug:1:2,http://iwater.red:8000/bug-view-2.html,,2,新闻中心页面问题,,,BUG,bug,DONE,active,,,2012-06-05T02:57:11.000+00:00,2022-10-05T04:19:22.000+00:00,,,,,zentao:ZentaoAccount:1:7,测试甲,,,zentao:ZentaoStory:1:2,2,3,,,0,2022-10-05T16:00:00.000+00:00
+zentao:ZentaoBug:1:3,http://iwater.red:8000/bug-view-3.html,,3,成果展示页面问题,,,BUG,bug,DONE,active,,,2012-06-05T02:58:22.000+00:00,2021-04-28T03:09:08.000+00:00,,,,,zentao:ZentaoAccount:1:8,测试乙,zentao:ZentaoAccount:1:4,开发甲,zentao:ZentaoStory:1:3,1,3,,,0,
+zentao:ZentaoBug:1:4,http://iwater.red:8000/bug-view-4.html,,4,售后服务页面问题,,,BUG,bug,resolved,resolved,,,2012-06-05T03:00:19.000+00:00,2022-10-05T04:10:08.000+00:00,,,,,zentao:ZentaoAccount:1:9,测试丙,zentao:ZentaoAccount:1:9,测试丙,zentao:ZentaoStory:1:4,1,3,,,0,
+zentao:ZentaoBug:1:5,http://iwater.red:8000/bug-view-5.html,,5,首页页面问题,,,BUG,bug,DONE,active,,,2012-06-05T02:56:11.000+00:00,2021-04-28T03:09:08.000+00:00,,,,,zentao:ZentaoAccount:1:7,测试甲,zentao:ZentaoAccount:1:4,开发甲,zentao:ZentaoStory:1:1,1,3,,,0,
+zentao:ZentaoBug:1:6,http://iwater.red:8000/bug-view-6.html,,6,新闻中心页面问题,,,BUG,bug,DONE,active,,,2012-06-05T02:57:11.000+00:00,2022-10-05T04:19:22.000+00:00,,,,,zentao:ZentaoAccount:1:7,测试甲,,,zentao:ZentaoStory:1:2,2,3,,,0,2022-10-05T16:00:00.000+00:00
diff --git
a/backend/plugins/zentao/e2e/snapshot_tables/issues_bug_for_due_date.csv
b/backend/plugins/zentao/e2e/snapshot_tables/issues_bug_for_due_date.csv
index 3192e753b..e33e7b7a0 100644
--- a/backend/plugins/zentao/e2e/snapshot_tables/issues_bug_for_due_date.csv
+++ b/backend/plugins/zentao/e2e/snapshot_tables/issues_bug_for_due_date.csv
@@ -1,2 +1,2 @@
id,url,icon_url,issue_key,title,description,epic_key,type,original_type,status,original_status,story_point,resolution_date,created_date,updated_date,lead_time_minutes,original_estimate_minutes,time_spent_minutes,time_remaining_minutes,creator_id,creator_name,assignee_id,assignee_name,parent_issue_id,priority,severity,urgency,component,is_subtask,due_date
-zentao:ZentaoBug:1:4,http://iwater.red:8000/bug-view-4.html,,4,售后服务页面问题,,,BUG,bug,resolved,resolved,,2022-10-05T04:09:59.000+00:00,2012-06-05T03:00:19.000+00:00,2022-10-05T04:10:08.000+00:00,5434629,,,,zentao:ZentaoAccount:1:9,测试丙,zentao:ZentaoAccount:1:9,测试丙,zentao:ZentaoStory:1:4,1,,,,0,2022-10-05T04:09:59.000+00:00
+zentao:ZentaoBug:1:4,http://iwater.red:8000/bug-view-4.html,,4,售后服务页面问题,,,BUG,bug,resolved,resolved,,2022-10-05T04:09:59.000+00:00,2012-06-05T03:00:19.000+00:00,2022-10-05T04:10:08.000+00:00,5434629,,,,zentao:ZentaoAccount:1:9,测试丙,zentao:ZentaoAccount:1:9,测试丙,zentao:ZentaoStory:1:4,1,3,,,0,2022-10-05T04:09:59.000+00:00
diff --git a/backend/plugins/zentao/tasks/bug_convertor.go
b/backend/plugins/zentao/tasks/bug_convertor.go
index a1af838ff..1d2f6ca75 100644
--- a/backend/plugins/zentao/tasks/bug_convertor.go
+++ b/backend/plugins/zentao/tasks/bug_convertor.go
@@ -88,7 +88,7 @@ func ConvertBug(taskCtx plugin.SubTaskContext) errors.Error {
Priority: getPriority(toolEntity.Pri),
CreatorName: toolEntity.OpenedByName,
AssigneeName: toolEntity.AssignedToName,
- Severity:
string(rune(toolEntity.Severity)),
+ Severity:
getSeverity(toolEntity.Severity),
Url:
convertIssueURL(toolEntity.Url, "bug", toolEntity.ID),
OriginalProject: getOriginalProject(data),
Status: toolEntity.StdStatus,
diff --git a/backend/plugins/zentao/tasks/shared.go
b/backend/plugins/zentao/tasks/shared.go
index 751093e7d..ad55219e9 100644
--- a/backend/plugins/zentao/tasks/shared.go
+++ b/backend/plugins/zentao/tasks/shared.go
@@ -24,6 +24,7 @@ import (
"path"
"reflect"
"regexp"
+ "strconv"
"strings"
"github.com/apache/devlake/core/dal"
@@ -80,6 +81,11 @@ func getPriority(pri int) string {
*/
}
+// getSeverity formats the numeric zentao bug severity (e.g. 3) as its decimal
string ("3")
+func getSeverity(severity int) string {
+ return strconv.Itoa(severity)
+}
+
func getOriginalProject(data *ZentaoTaskData) string {
if data.Options.ProjectId != 0 {
return data.ProjectName
diff --git a/backend/plugins/zentao/tasks/shared_test.go
b/backend/plugins/zentao/tasks/shared_test.go
index 3bec1ca23..d34475900 100644
--- a/backend/plugins/zentao/tasks/shared_test.go
+++ b/backend/plugins/zentao/tasks/shared_test.go
@@ -195,3 +195,20 @@ func Test_getZentaoWebURL(t *testing.T) {
})
}
}
+
+func Test_getSeverity(t *testing.T) {
+ tests := []struct {
+ severity int
+ want string
+ }{
+ {1, "1"},
+ {3, "3"},
+ {4, "4"},
+ {10, "10"},
+ }
+ for _, tt := range tests {
+ if got := getSeverity(tt.severity); got != tt.want {
+ t.Errorf("getSeverity(%d) = %q, want %q", tt.severity,
got, tt.want)
+ }
+ }
+}