Skip to content

Fixes 38699: Never give an approval back to its requester - #38708

Merged
yan-3005 merged 4 commits into
mainfrom
fix/38699-approval-never-to-requester
Nov 26, 2026
Merged

yan-3005 merged 4 commits into
mainfrom
fix/38699-approval-never-to-requester

Conversation

@yan-3005

@yan-3005 yan-3005 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #38699

An approval node removes the requester (the editor whose change started the run) from its assignees. For workflows not managed by a task workflow, an emptied list was handed back to the requester under the default none empty-assignee strategy. That task is filed by the requester, and TaskAuthorPolicy-FilerCannotResolveOwnTask denies a filer ResolveTask, so the only assignee got 403 and the run stayed RUNNING until an admin noticed it.

The requester is now never an assignee. When removing them leaves nobody, the node's emptyAssigneeStrategy decides: none approves automatically (the documented meaning of none, and what change requests already did), assignAdmins assigns the other admins, wait opens the task unassigned.

The give-back was introduced together with the workflow-managed self-approval fix in #28269 and kept since. Its reason, "avoid an unassigned task nobody can act on", only ever applied to workflow-managed tasks, which keep their own path. Data access requests and lifecycle playbooks are unaffected: they use assignAdmins, whose admin pool already excludes the requester.

Upgrade note: an existing workflow under none stops opening these tasks. An edit by the entity's only approver is approved automatically instead of waiting for an admin. A workflow that wants the old wait sets the node to wait or assignAdmins. Recorded in ADR:2026-11-25-an-approval-never-goes-to-its-requester.

Type of change:

  • Bug fix

High-level design:

N/A — small change: one branch removed from SetApprovalAssigneesImpl, plus tests and a decision record.

Tests:

Use cases covered

  • The editor is the only approver (owners / reviewers / owners+reviewers):
    • none: the workflow finishes and no task is opened;
    • assignAdmins: the task goes to admins, never the editor;
    • wait: the task is open with no assignee.
  • Someone else can approve (same 9 combinations): only the other approver is assigned.

Unit tests

  • SetApprovalAssigneesImplTest:
    • flipped testSelfApprovalPrevention_eventDrivenSoleRequester_keptWhenNoOneElse (it locked in the bug) to ..._neverAssignedAndAutoApproved;
    • added ..._routedToOtherAdmins.
  • mvn ... -Dtest=SetApprovalAssigneesImplTest: Tests run: 34, Failures: 0, Errors: 0.

Backend integration tests

  • Added to WorkflowDefinitionResourceIT:
    • test_editorWhoIsTheOnlyApproverIsNeverAskedToApprove, 9 cases;
    • test_editorIsLeftOffTheApprovalWhenSomeoneElseCanApprove, 9 cases.
  • Targeted run, mysql-elasticsearch, global-state lane: the new methods plus test_approvalWithOnlyTheRequesterToAskGoesToAdmins gave Tests run: 19, Failures: 0, Errors: 0.
  • RED before the fix, on main with the fix reverted:
    • the none case timed out with the instance still RUNNING;
    • a probe showed the task assigned only to the editor, filed by the editor, and the editor's resolve returning 403 TaskAuthorPolicy-FilerCannotResolveOwnTask.
    • Reproduced the same way on 2.0.

Local Java test run: PASSED

  • Commit: ef5cd7aa01f4 (base origin/main)
  • Finished: 2026-11-25 14:31 UTC · 15.4 min
  • Scope: focused; merge readiness is not established. Broader steps deferred: 4 (run --scope full).
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (1 class) 1 34 0 0 1.3 passed
integration mysql-elasticsearch · isolated 1 176 0 0 14.1 passed
  • Impacted, not run locally: 1 class (listed in the details)

Ingestion integration tests

Not applicable — no ingestion changes.

Playwright (UI) tests

Not applicable — no UI changes.

Manual testing performed

Local server built from this branch (ef5cd7aa) with MySQL 8.3 and Elasticsearch 9.3, and the UI served by the server.

  1. As admin, created the user steward (not an admin) and two data contracts, orders_contract and customers_contract. Each is owned and reviewed only by steward.
  2. Created one reviewers-only approval workflow per contract on Updated: none on orders and assignAdmins on customers.
  3. Logged in as steward and edited both contracts' descriptions.

Results:

  • orders (none): the run is "Success — Auto-approved: no one to assign". The edit is applied (v0.2) and steward gets no task.
  • customers (assignAdmins): TASK-00001 is created by Data Steward and assigned to admin only. steward is not an assignee.
Contract edited by its only reviewer none: auto-approved, no task assignAdmins: task goes to admin
contract runs task

UI screen recording:

Not applicable — backend-only fix.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable, no schema change.
  • For a UI feature or feature task: not applicable, backend-only.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
    • Reviewed 7ce953bf9cd: no 🔴. Two 🟡:
      • Fixed in ef5cd7aa01f: the rationale wrongly said nobody could act on the old task (admins bypass the policy); added the upgrade note.
      • Kept the 9 "someone else can approve" cases rather than 3: the strategy matrix is the requested coverage, and the class runs them in under a minute.
  • Decision check: adds docs/decisions/2026-11-25-an-approval-never-goes-to-its-requester.md.
  • I have added a test that covers the exact scenario we are fixing.

🤖 Generated with Claude Code

An approval node removes the requester (the editor whose change started the
run) from its assignees. For workflows not managed by a task workflow, an
emptied list was given back to the requester under the default "none"
empty-assignee strategy. The task is filed by the requester and
TaskAuthorPolicy denies a filer ResolveTask, so the only assignee could not
approve it and the run never finished.

The requester is now never an assignee. An emptied list goes to the node's
empty-assignee strategy: none approves automatically, assignAdmins assigns the
other admins, wait opens the task unassigned.

Tests: SetApprovalAssigneesImplTest flips the case that locked in the
give-back and adds the assignAdmins case; WorkflowDefinitionResourceIT covers
owners / reviewers / owners+reviewers x none / assignAdmins / wait, both when
the editor is the only approver and when someone else can approve.
@yan-3005
yan-3005 requested a review from a team as a code owner November 25, 2026 14:31
@yan-3005
yan-3005 requested review from IceS2 and a balanced review from Copilot November 25, 2026 14:31
@yan-3005

Copy link
Copy Markdown
Contributor Author

Local Java test run: PASSED — details

  • Commit: ef5cd7aa01f4 (base origin/main)
  • The summary is in the PR description.

Tests run locally

  • unit · openmetadata-service (1 class): SetApprovalAssigneesImplTest (34 passed)
  • integration · mysql-elasticsearch · isolated: WorkflowDefinitionResourceIT (176 passed)

Broader coverage not executed by this focused run

  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<48 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=ChangeRequestAdmissionIT,ChangeRequestApplyIT,ChangeRequestDecisionIT,ChangeRequestImportAndBulkIT,ChangeRequestLifecycleIT,ChangeRequestResourceIT,DataContractValidationAppIT,WorkflowDefinitionResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=rdf -Dit.test=RdfGovernanceRulesIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Psearch-it -DdatabaseType=postgres -DsearchType=opensearch -Djpw.data.mode=ingest -Dit.test=SearchAccessRulesIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
Impacted, not run locally (1)
  • IncidentGroupTrendScaleIT → nightly: openmetadata-nightly k8s-java-it (scale-it)
Commands
mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=SetApprovalAssigneesImplTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=WorkflowDefinitionResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

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.

Copilot AI balanced review requested due to automatic review settings November 25, 2026 15:15

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.

@yan-3005 yan-3005 added the To release Will cherry-pick this PR into the release branch label Nov 25, 2026
@yan-3005

Copy link
Copy Markdown
Contributor Author

Guard tests of the amended ADR:2026-10-22-agent-glossary-proposals-are-decided-through-the-approval-workflow, run locally on this branch (mysql-elasticsearch):

Suite Tests Failures
GlossaryApprovalWorkflowReviewTest, AutomationProposalsTest, GlossaryAutomationReviewMigrationTest, GlossaryTermRepositoryStageDecisionTest, WorkflowEventConsumerTest, SetApprovalAssigneesImplTest (unit) 130 0
ContextMemoryDerivationIT (global-state) 5 0
ChangeRequestApplyIT (global-state) 11 0
GlossaryTermAutomationDraftIT (parallel) 13 0

The seeded event workflows (Glossary, Metric, AI asset) send a reviewer's own edit to CheckIf…UpdatedByIsReviewer → Approved before their approval nodes, so they never reached the removed give-back. The seeded task workflows (noOp trigger) are workflow-managed, and the give-back never applied to them.

Copilot AI balanced review requested due to automatic review settings November 26, 2026 09:11
@yan-3005
yan-3005 enabled auto-merge (squash) November 26, 2026 09:11

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.

@gitar-bot

gitar-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk 1 closed / 1 findings

Removing the requester fallback makes sole-approver edits auto-approve under none, potentially allowing unreviewed entity changes through approval workflows.

Removes the requester from approval task assignees so an editor's own change is never routed back to them, with none now auto-approving when no one else can approve. Resolved the finding that the change contradicted Accepted ADR 2026-10-22 without superseding it. No open issues found.

✅ 1 closed
✅ Quality: Contradicts Accepted ADR 2026-10-22 without superseding it

📄 docs/decisions/2026-11-25-an-approval-never-goes-to-its-requester.md:3-9 📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/userTask/impl/SetApprovalAssigneesImpl.java:211-223
The Accepted record docs/decisions/2026-10-22-agent-glossary-proposals-are-decided-through-the-approval-workflow.md (Consequences, lines 55-57) says: "The editor of a change is left off its assignees while another of its reviewers (or owners, when it has none) remains, and a sole one keeps it". This PR removes the give-back at SetApprovalAssigneesImpl.java:223, so a sole reviewer or owner no longer keeps their own approval under none. The step now auto-approves instead. The new record 2026-11-25-an-approval-never-goes-to-its-requester.md states the opposite rule. It does not mark itself as superseding or amending that clause, and the older record's Status still reads Accepted with nothing pointing to its successor. Per the repo's decision-record rules, either amend the 2026-10-22 record (add a revision that withdraws the "a sole one keeps it" clause and points to ADR:2026-11-25-an-approval-never-goes-to-its-requester) or list it under the new record's Related/supersedes line.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@yan-3005
yan-3005 merged commit f6b7cf2 into main Nov 26, 2026
40 checks passed
@yan-3005
yan-3005 deleted the fix/38699-approval-never-to-requester branch November 26, 2026 09:23
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Backport to 2.0 is under way. It is built from openmetadata-collate, which holds the credentials needed to open a PR here, and it will comment again with the result — nothing is needed from you unless it reports otherwise.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Backport to 2.1 is under way. It is built from openmetadata-collate, which holds the credentials needed to open a PR here, and it will comment again with the result — nothing is needed from you unless it reports otherwise.

@gh-bot-collate

Copy link
Copy Markdown

🤖 Backport to 2.1 opened as #38816 (clean cherry-pick). It merges itself once the checks pass.

@gh-bot-collate

Copy link
Copy Markdown

🤖 Backport to 2.0 failed. The conflict could not be resolved, so this change is not on that branch. Resolver run.

yan-3005 added a commit that referenced this pull request Nov 26, 2026
…38816)

* Fixes #38699: never give an approval back to its requester

An approval node removes the requester (the editor whose change started the
run) from its assignees. For workflows not managed by a task workflow, an
emptied list was given back to the requester under the default "none"
empty-assignee strategy. The task is filed by the requester and
TaskAuthorPolicy denies a filer ResolveTask, so the only assignee could not
approve it and the run never finished.

The requester is now never an assignee. An emptied list goes to the node's
empty-assignee strategy: none approves automatically, assignAdmins assigns the
other admins, wait opens the task unassigned.

Tests: SetApprovalAssigneesImplTest flips the case that locked in the
give-back and adds the assignAdmins case; WorkflowDefinitionResourceIT covers
owners / reviewers / owners+reviewers x none / assignAdmins / wait, both when
the editor is the only approver and when someone else can approve.

* Correct the self-approval rationale and add the upgrade note

* Amend the glossary-proposals record: a sole editor no longer keeps their approval

(cherry picked from commit f6b7cf2)

Co-authored-by: Ram Narayan Balaji <81347100+yan-3005@users.noreply.github.com>
yan-3005 added a commit that referenced this pull request Nov 26, 2026
…) (#38829)

Backport of #38708, ported by hand: 2.0 has no "wait" empty-assignee
strategy and gave the requester back under every strategy, so the
assignAdmins fallback never ran for an event-driven approval.

The requester is now never an assignee of an approval their own edit
started. An emptied list goes to the node's empty-assignee strategy: none
approves automatically, assignAdmins assigns the other admins and, as on
main since #35740, keeps the task open when the requester is the only
admin instead of approving it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

To release Will cherry-pick this PR into the release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Approval task is given back to its requester, who cannot resolve it

3 participants