Repository navigation
fix(zentao): link child tasks to their parent task - #9428
Open
ShivamSharma43 wants to merge 1 commit into
Open
ShivamSharma43 wants to merge 1 commit into
ShivamSharma43 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Zentao
convertTasksubtask links child tasks to the wrong parent, and bothconvertTaskandconvertStorygive parent tasks/stories a parent that doesn't exist.In ZenTao,
task.parentis the id of the parent task. When a task or a story is split, ZenTao setsparentof the split one to-1("I am a parent"). See for example ZenTao 18.12module/task/model.phpandmodule/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_idwas built like this:task_convertor.go:storyIdGen.Generate(connectionId, Parent)wheneverParent != 0. A child of task 3 gotzentao:ZentaoStory:1:3, an unrelated story (or none), instead ofzentao:ZentaoTask:1:3. A parent task gotzentao:ZentaoStory:1:-1. That value is visible in the currentissues_task.csvsnapshot.story_convertor.go: the generator is right, but a parent story gotzentao:ZentaoStory:1:-1too.Changes:
tasks/task_convertor.go: use the task id generator, and only whenParent > 0.tasks/story_convertor.go: only set the parent whenParent > 0.parent: -1). In the raw stories, story 2 is now a parent (-1) and story 8 its child. The tool-layer andissuessnapshots are updated to match; only theparent/parent_issue_idvalues 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/withE2E_DB_URLon 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"),TestZentaoTaskCustomizeDueDateandTestZentaoStoryDataFlowfail. With this change they pass.TestZentaoDbGetDataFlowfails 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,gofmtandgolangci-lint run --tests=false ./plugins/zentao/...: clean.board_issues_*.csv. This PR doesn't touch those files.pr-type/bug-fix.Co-Authored-By:trailer.🤖 Generated with Claude Code