Fixes #31692: remove reviewer→approval-task assignee sync from repositories - #32912
Fixes #31692: remove reviewer→approval-task assignee sync from repositories#32912karanh37 wants to merge 6 commits into
Conversation
GlossaryTermRepository.updateTaskWithNewReviewers() existed but had no caller, unlike the five sibling repositories (Tag, TestCase, DataProduct, DataContract, Metric) that invoke it from an updateReviewers() override. Reviewer/assignee consistency relied solely on the seeded Glossary Approval Workflow re-triggering, which supersedes the open approval task with a new one (new task id) rather than patching it in place, orphaning comment history and coupling the guarantee to workflow configuration. Add an updateReviewers() override in GlossaryTermUpdater following the TagRepository pattern: when the reviewer list changes it patches the existing open approval task's assignees in place. updateApprovalTaskAssignees returns early when no open task exists, so terms without an approval workflow are unaffected. Add GlossaryTermReviewerTaskSyncIT: creates a term with one reviewer, waits for its open approval task, adds a second reviewer, and asserts the original task (fetched by id) is patched to include the new reviewer. Because the repository patch is synchronous within the PATCH transaction and the workflow safety net can only open a new task, this isolates the repository mechanism from the workflow without disabling the seeded workflow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
✅ Playwright Results — workflow succeededValidated commit ✅ 4475 passed · ❌ 0 failed · 🟡 8 flaky · ⏭️ 1 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 46m 32s ⏱️ Max setup 4m 7s · max shard execution 21m 55s · max shard-job elapsed before upload 26m 6s · reporting 16s 🌐 217.11 requests/attempt · 2.31 app boots/UI scenario · 37.72% common-shard skew Optimization targets still in progress:
🟡 8 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…tories updateTaskWithNewReviewers / TaskRepository.updateApprovalTaskAssignees overwrote an open approval task's assignees with the entity's reviewers whenever the reviewer list changed. That is wrong: a userApprovalTask chooses its assignees by rule (owners, reviewers, individual users or teams), so forcing the reviewer list onto the task corrupts any task not configured to assign reviewers. Task assignees are a point-in-time snapshot owned by the workflow, not by the repository. Remove the mechanism everywhere: - updateReviewers() overrides in Tag, TestCase, DataProduct, DataContract, Metric (were live) - dead updateTaskWithNewReviewers in GlossaryTerm and KnowledgePage (never called) plus GlossaryTerm's now-unused resolveEffectiveReviewers - TaskRepository.updateApprovalTaskAssignees (no remaining callers) This also reverts the wiring added earlier on this branch. Behavior note: Tag/TestCase/DataProduct/DataContract/Metric have no seeded approval workflow, so for a custom approval workflow this sync was the only thing that moved an open task's assignees on a reviewer change. After this change, changing reviewers leaves an existing open approval task's assignees untouched — the intended semantics. GlossaryTerm and AI assets have seeded workflows that already supersede the open task with a fresh one assigned to the current reviewers, so their user-facing behavior is unchanged. Replace the prior in-place-patch IT with GlossaryTermReviewerChangeApprovalIT, which asserts the acceptance criterion: adding a reviewer to an in-review term leaves exactly one open approval task assigned to the new reviewers.
Require the settled open approval task to be a NEW task (id != original) assigned to the added reviewer, and fail fast with diagnostics if the approval workflow settles terminally without producing it, instead of a bare Awaitility timeout.
Replace the glossary supersession IT (which passed both before and after the removal) with tests that target the invariant directly: - SetApprovalAssigneesImplTest: an owners-only and an explicit-users userApprovalTask rule must not pull the entity's reviewers into the task's assignees — the principle the removed repository sync violated. - WorkflowDefinitionResourceIT#test_reviewerChangeDoesNotOverwriteOwnerAssignedApprovalTask: a custom approval workflow assigns its task to owners on a tag (Group-2 entity), triggered on Created only so a reviewer change cannot re-trigger it. Changing the tag's reviewers must leave the owner-assigned task's assignees untouched. This fails without the removal: the repository overwrote the open task's assignees with the reviewer list in the PATCH.
Code Review ✅ ApprovedRemoves the reviewer→approval-task assignee sync from repositories, fixing incorrect overwrites of task assignees with entity reviewers. The sync corrupted approval tasks whose assignee rule was not "reviewers" (e.g., owners-only); task assignees are workflow-owned snapshots, not repository-driven. Behavior is unchanged for OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes
Supersedes the original direction of this PR. Instead of wiring
updateTaskWithNewReviewersontoGlossaryTermRepository, this removes the reviewer→approval-task assignee sync entirely, per discussion with @manerow (issue author) and the maintainer review.Why removal, not wiring
updateTaskWithNewReviewers→TaskRepository.updateApprovalTaskAssigneesoverwrote an open approval task's assignees with the entity's reviewers whenever the reviewer list changed. That is incorrect: auserApprovalTaskchooses its assignees by rule — owners, reviewers, individual users, or teams (SetApprovalAssignees:addReviewers/addOwners/users/teams). Forcing the reviewer list onto the task corrupts any task whose rule is not "reviewers" (e.g. an owners-only approval). Task assignees are a point-in-time snapshot owned by the workflow, not by the repository. Old tasks keep their assignees; a new run produces a new task with the new reviewers.What is removed
TagRepository,TestCaseRepository,DataProductRepository,DataContractRepository,MetricRepositoryupdateReviewers()override +updateTaskWithNewReviewershelper (were live)GlossaryTermRepositoryupdateTaskWithNewReviewers+ now-unusedresolveEffectiveReviewers(and the wiring added earlier on this branch)KnowledgePageRepositoryupdateTaskWithNewReviewersTaskRepositoryupdateApprovalTaskAssignees(no remaining callers)Kept:
closeApprovalTaskForEntity/findOpenTaskByEntityAndCategory— task closure on Draft/Approve is correct and unaffected.Behavior impact (stated explicitly, per Adrià's review)
GlossaryTerm,KnowledgePage: the helper was dead (no caller). Removing it changes zero behavior. Glossary is doubly safe: the seededGlossaryTermApprovalWorkflowre-triggers on a reviewer change and supersedes the open task with a fresh one assigned to the current reviewers.Tag,TestCase,DataProduct,DataContract,Metric: the helper was live, but these entity types have no seeded approval workflow. For a user-defined approval workflow this sync was the only thing that moved an open task's assignees on a reviewer change. After this PR, changing reviewers leaves an existing open approval task's assignees untouched — the intended semantics (assignees ≠ reviewers). This is a deliberate, agreed behavior change, not a pure cleanup.No Collate change is needed. The Knowledge Center page feature now lives upstream in OSS as
KnowledgePageRepository(thepageentity) — whose deadupdateTaskWithNewReviewersthis PR removes. Collate's oldio.collate.repository.KnowledgeCenterRepositoryno longer exists onopenmetadata-collatemain, and nocollate-servicecode (checked across all branches) references the removed methods, so the downstream build is unaffected. The submodule pointer bump is handled separately after this PR merges.Closes #31692
Type of change
How was this patch tested?
Two layers, both targeting the invariant directly (assignees follow the
userApprovalTaskrule, reviewers do not leak in):SetApprovalAssigneesImplTest(+2):testOwnersOnlyRule_ignoresReviewersandtestExplicitUsersRule_ignoresReviewersassert that an owners-only / explicit-users approval rule does not pull the entity's reviewers into the task's assignees. Fast, deterministic. Ran green: 16 tests, 0 failures.WorkflowDefinitionResourceIT#test_reviewerChangeDoesNotOverwriteOwnerAssignedApprovalTask: creates a custom approval workflow whose task is assigned to owners on atag(a Group-2 entity), triggered on Created only so a reviewer change cannot re-trigger it. Creates a tag owned by USER1 with USER2 as reviewer, waits for the owner-assigned approval task, changes the reviewers, and asserts the task's assignees are unchanged (still the owner, the added reviewer never injected). This fails without the removal — the repository overwrote the open task's assignees with the reviewer list inside the PATCH transaction. Ran green: Tests run: 1, Failures: 0, Errors: 0 (Testcontainers, MySQL/Postgres + ES).The prior in-place-patch IT was removed.
openmetadata-serviceandopenmetadata-integration-testscompile and passspotless:apply.Checklist: