Repository navigation
fix(tracker): keep sub-issue parent info in sync when an issue tree is moved - #11074
Open
MichaelUray wants to merge 2 commits into
Open
MichaelUray wants to merge 2 commits into
MichaelUray wants to merge 2 commits into
Conversation
…s moved Sub-issues store a denormalised copy of their ancestors (parents: title, identifier, space). hcengineering#5816 already renumbers the moved sub-issues; this change completes it by re-syncing their stored parent info. The issue update trigger only patched the parent title on rename and the chain on re-parenting, so after a move descendants kept the old project's identifier and space at every depth. When a sub-issue was moved without its parent (and detached from it in the same update) the stale chain could also win over the re-parenting patch, leaving the old parent in the chain. Sub-issues were in addition looked up via 'parents.parentId', a field nested in a JSON array that the Postgres/CockroachDB adapter cannot match. The trigger now collects all issues of a batch whose title, identifier, space or attachedTo changed, collects their descendants by walking the attachedTo links, and rebuilds the parents info of these issues from storage by walking attachedTo upwards. The result does not depend on the order of the transactions in the batch, works on every storage backend, and an issue is only updated when its chain actually changed. The re-parenting branch keeps its estimation/childInfo handling but no longer writes parents itself. Fixes hcengineering#5714 Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>
Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>
This branch has not been deployed
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.
Fixes #5714
Problem
Sub-issues store a denormalised copy of their ancestors (
parents: id, title, identifier, space). #5816 renumbers the moved sub-issues, but theirparentsentries kept the old project's identifier and space at every depth, so breadcrumbs and parent links pointed to the old identifiers.Two related defects in the same trigger:
{ 'parents.parentId': ... }. On the Postgres/CockroachDB adapter this becomesdata#>>'{parents,parentId}', which does not match inside a JSON array, so the existing title propagation to sub-issues did not work there either.Changes
OnIssueUpdatecollects the issues of a batch whosetitle,identifier,spaceorattachedTochanged, walks their descendants viaattachedTo($inqueries, indexed column), loads missing ancestors by_id, and rebuildsparentswith a pure helperbuildParentInfoby walkingattachedToupwards. Writes only when the chain differs; no queries for other updates; cycle-safe.childInfohandling but no longer writesparents;updateSubIssuesis removed.Note: the
TxRemoveDocbranch still queries'childInfo.childId', which has the same Postgres limitation; left for a separate change.Tests
sub-issue-parents.test.ts(8 tests). The fake storage only supports_id/attachedToqueries, so a nested-array lookup would fail the suite. Covers a three-level move, moving a sub-issue without its parent, re-parenting, rename and a no-op.