Skip to content

fix(zentao): link child tasks to their parent task - #9428

Open
ShivamSharma43 wants to merge 1 commit into
apache:mainfrom
ShivamSharma43:fix/zentao-parent-issue
Open

ShivamSharma43 wants to merge 1 commit into
apache:mainfrom
ShivamSharma43:fix/zentao-parent-issue

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Summary

The Zentao convertTask subtask links child tasks to the wrong parent, and both convertTask and convertStory give parent tasks/stories a parent that doesn't exist.

In ZenTao, task.parent is the id of the parent task. When a task or a story is split, ZenTao sets parent of the split one to -1 ("I am a parent"). See for example ZenTao 18.12 module/task/model.php and module/story/model.php. The task convertor already relies on this a few lines further down: "Parent < 0 means that this is a parent task, not a subtask".

But issues.parent_issue_id was built like this:

  • task_convertor.go: storyIdGen.Generate(connectionId, Parent) whenever Parent != 0. A child of task 3 got zentao:ZentaoStory:1:3, an unrelated story (or none), instead of zentao:ZentaoTask:1:3. A parent task got zentao:ZentaoStory:1:-1. That value is visible in the current issues_task.csv snapshot.
  • story_convertor.go: the generator is right, but a parent story got zentao:ZentaoStory:1:-1 too.

Changes:

  • tasks/task_convertor.go: use the task id generator, and only when Parent > 0.
  • tasks/story_convertor.go: only set the parent when Parent > 0.
  • e2e fixtures: in the raw tasks, task 2 is now a child of task 3 (which already had parent: -1). In the raw stories, story 2 is now a parent (-1) and story 8 its child. The tool-layer and issues snapshots are updated to match; only the parent / parent_issue_id values change.

No migration: rows are rewritten on the next conversion.

Does this close any open issues?

No issue is open for this. The bug is described above.

Screenshots

N/A

Other Information

  • go test ./plugins/zentao/e2e/ with E2E_DB_URL on a local PostgreSQL 18. With the new fixtures and the old convertors, TestZentaoTaskDataFlow (expected: "zentao:ZentaoTask:1:3", actual: "zentao:ZentaoStory:1:3", and "" vs "zentao:ZentaoStory:1:-1"), TestZentaoTaskCustomizeDueDate and TestZentaoStoryDataFlow fail. With this change they pass. TestZentaoDbGetDataFlow fails with and without this change on that machine: its changelog times are off by the machine's local UTC offset (+05:30). All other tests in the package pass. Not run on MySQL.
  • go test ./plugins/zentao/tasks/, go vet, gofmt and golangci-lint run --tests=false ./plugins/zentao/...: clean.
  • The only open PR touching the zentao plugin is feat(dora): per-project DORA isolation for Jira boards shared by several projects #9216, which edits board_issues_*.csv. This PR doesn't touch those files.
  • Suggested label: pr-type/bug-fix.
  • This PR was prepared with AI assistance (Claude Code). The commit carries a Co-Authored-By: trailer.

🤖 Generated with Claude Code

ZenTao's task.parent is the id of the parent task, and both tasks and
stories store parent = -1 when they are a parent themselves. convertTask
built parent_issue_id with the story id generator, and both convertTask
and convertStory treated -1 as a parent id. Use the task generator and
only set parent_issue_id for a positive parent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 22, 2026 10:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants