Repository navigation
[2.1] Fixes #35913: remove tags a resolved TagUpdate leaves out - #37720
Conversation
* Fixes #35913: remove tags a resolved TagUpdate leaves out * Keep tags added after the task when a TagUpdate replace is resolved * Read the TagUpdate snapshot from the action's currentTagsField * Also drop live tags from the same mutually exclusive classification * Keep a TagUpdate's other tags when the task has no currentTags snapshot Resolving with newValue fell back to the target's live tags when the task carried no currentTags, so an API-filed Add task resolved with newValue removed every other tag on the column. Without a snapshot, only tagsToRemove (and a tag a mutually exclusive newValue tag displaces) is removed now. Move the removal set into tagsReplacedBy and share the reflective tag read with patchFieldTags. Add TaskResourceIT cases that resolve TagUpdate tasks the way the UI does: Replace within a mutually exclusive classification, Remove with a tag added after the task, a concurrent swap, and an Add without a snapshot. --------- Co-authored-by: IceS2 <[email protected]> Co-authored-by: Ram Narayan Balaji <[email protected]> Co-authored-by: Ram Narayan Balaji <[email protected]> (cherry picked from commit 7f84d27)
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
| snapshot = readTagLabels(payloadNode, action.currentTagsField(), "currentTags", null); | ||
| } | ||
|
|
||
| // A non-empty resolver-supplied newValue is the final desired tag set (reviewer-edited), | ||
| // so treat it as a full replace instead of merging with payload's add/remove split. | ||
| if (newValue != null && !newValue.isEmpty()) { | ||
| List<TagLabel> newTags = | ||
| JsonUtils.readValue(newValue, new TypeReference<List<TagLabel>>() {}); | ||
| if (newTags != null && !newTags.isEmpty()) { | ||
| tagsToAdd = newTags; | ||
| tagsToRemove = null; | ||
| } | ||
| EntityFieldPath path = fieldPathOf(task, fieldPath, FieldProperty.TAGS); | ||
| List<TagLabel> resolvedTags = readResolvedTags(newValue); | ||
| if (!resolvedTags.isEmpty()) { | ||
| tagsToRemove = | ||
| tagsReplacedBy(resolvedTags, snapshot, tagsToRemove, targetTags(entity, path)); | ||
| tagsToAdd = resolvedTags; | ||
| } |
There was a problem hiding this comment.
⚠️ Quality: New TagUpdate newValue resolution contract has no decision record
This PR changes what a resolver's newValue means for a TagUpdate. That meaning is a contract the UI (TaskFormSchemaUtils.mergeResolutionTags) and the server both have to follow. Before, the server treated newValue as tags to add. Now it treats newValue as the approved final list, and it replaces the task's currentTags snapshot plus tagsToRemove. The description gives the rule: "the approved list replaces what the task saw (its currentTags snapshot plus tagsToRemove). Tags added to the target after the task was filed stay, unless an approved tag from the same mutually exclusive classification displaces them. A task without a snapshot only removes its tagsToRemove." Nothing in docs/decisions/ records this; a search for TagUpdate, tagsToRemove and currentTags returns nothing. The only place the rule lives is a private Javadoc on tagsReplacedBy. The record should say: "An approved TagUpdate's newValue is the final tag list built from the task's currentTags snapshot. On approval it replaces snapshot ∪ tagsToRemove on the target. Tags added to the target after the task was filed are kept unless a newValue tag of the same mutually exclusive classification displaces them. Without a snapshot, only tagsToRemove is removed. An empty newValue falls back to the payload's tagsToAdd/tagsToRemove." Add that record under docs/decisions/ and cite it as ADR:<date>-<slug> from tagsReplacedBy.
Add docs/decisions/2026-11-xx-tagupdate-newvalue-replaces-the-tasks-snapshot.md stating the rule above, and cite it from tagsReplacedBy.:
/**
* A resolver's newValue is the final tag list the reviewer approved ... (see
* ADR:2026-11-xx-tagupdate-newvalue-replaces-the-tasks-snapshot).
*/
Was this helpful? React with 👍 / 👎
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source
Describe your changes:
Fixes #35913
Backport of #36008 to
2.1. A clean cherry-pick of 7f84d27.When a TagUpdate task is approved, the UI sends
newValue= the task'scurrentTagsminustagsToRemoveplustagsToAdd. The server droppedtagsToRemoveand only added. As a result:Now the approved list replaces what the task saw (its
currentTagssnapshot plustagsToRemove). Tags added to the target after the task was filed stay, unless an approved tag from the same mutually exclusive classification displaces them. A task without a snapshot only removes itstagsToRemove.Type of change:
Tests:
TaskResourceIT#testApproveColumnTag*: 4 ITs that resolve TagUpdate tasks the way the UI does. They cover a Replace within a mutually exclusive classification, a Remove with a tag added after the task, a concurrent swap, and an Add without a snapshot.TaskWorkflowHandlerTest: the 5 unit tests from Fixes #35913: remove tags a resolved TagUpdate leaves out #36008.TaskWorkflowHandlerTest31/31;TaskResourceIT#testApproveColumnTag*4/4 on mysql-elasticsearch and 4/4 on postgres-opensearch; spotless clean.Checklist:
Fixes <issue-number>: <short explanation>🤖 Generated with Claude Code