Skip to content

Fixes #38921: choose what happens when no one else can approve a step - #38923

Merged
yan-3005 merged 5 commits into
mainfrom
feat/approval-empty-assignee-strategy-ui
Nov 27, 2026
Merged

yan-3005 merged 5 commits into
mainfrom
feat/approval-empty-assignee-strategy-ui

Conversation

@yan-3005

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

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #38921

The approval step in the workflow builder already loaded and saved emptyAssigneeStrategy, but it had no control for it, so changing it meant editing the workflow definition through the API. This adds a select, If no one else can approve, and fixes two backend paths that could still hand a task to the person whose change started it.

Option Value Hint
Approve automatically (default) none The change is approved automatically, with no task.
Assign to admins assignAdmins The task goes to the admins other than the person who made the change. If there are none, it goes to the asset's owners.

A note under the select says the setting applies when the step finds no approver, or when its only approver is the person who made the change. That is the case behind #38699 / #38708.

UI

  • wait is not offered. A task nobody is asked to act on helps no one. A step that already stores wait (set through the API, or an older Collate lifecycle playbook) still shows it as Keep open, unassigned, so its value never goes blank or changes silently.
  • Task workflows show their real outcome. A task workflow (noOp trigger) never approves on its own. Its task stays open and goes to the asset's owners, so its read-only step shows the default as Go to the asset's owners.
  • Save keeps the stored value. A step with no stored value shows and saves none, which is the backend default (Assignees__1 defaults to NONE).
  • Types follow the schema. The hand-written 'none' | 'assignAdmins' type is now the generated EmptyAssigneeStrategy (form, WorkflowTypes.interface.ts, WorkflowNodeConfigUtils.ts). A future schema value will fail the TypeScript build until it gets a label.
  • Spacing. The doubled margin above the select is gone. The Approvers block and the Additional approvers field each added tw:mb-6.

Backend

  • The owner fallback never assigns the task's creator (TaskRepository.setDefaultAssigneesFromEntityOwners). A task created with no assignee falls back to the asset's owners unless its step chose wait. Under assignAdmins, with the requester as the only admin, that fallback could assign the requester, who as filer cannot resolve it. This applies to every task, not only approvals: a filer can never resolve their own task, so assigning them helped no one.
  • A later approval step can approve on its own (SetApprovalAssigneesImpl). The first step's CreateTask leaves taskEntityId at process scope, and any taskEntityId marked the step as a task workflow's. So a second step with nobody to ask opened a task under none instead of approving. Now a taskEntityId whose task belongs to an entity-event workflow no longer counts. Task workflows, whose start sets taskWorkflowManaged and their own taskEntityId, behave as before.

No migration. No schema or SQL change, and existing definitions keep their stored value. ADR:2026-11-25-an-approval-never-goes-to-its-requester gets a v2 amendment for both backend paths.

Type of change:

  • Bug fix

High-level design:

  • UI: one core Select in UserApprovalForm.tsx, on the same pattern as ApprovalModeSection. The options map (label and hint key per value), the task-workflow label for none and the offered choices live in the sibling UserApprovalForm.constants.ts. Ten i18n keys, translated in all 20 non-English locales.
  • Backend: two narrow changes. TaskRepository.setDefaultAssigneesFromEntityOwners drops the creator from the owner list. SetApprovalAssigneesImpl.isTaskWorkflowStep loads the task behind taskEntityId and ignores it when its workflow is entity-event; the same check resolveCurrentTaskAssignees and CreateTask already make.

Tests:

Use cases covered

  • Every stored strategy shows with its hint, and no stored value shows Approve automatically.
  • The builder offers Approve automatically (first) and Assign to admins. A step that stores wait also lists Keep open, unassigned.
  • A task workflow shows Go to the asset's owners.
  • Picking Assign to admins is saved, and reopening the step shows it. The select is disabled in view mode.
  • A task created with no assignee never falls back to its creator; it goes to the other owners.
  • In an entity workflow, a second approval step with nobody to ask approves on its own after the first step is approved.
  • The existing matrix (owners / reviewers / both × each strategy, editor as only approver and with someone else) still holds.

Unit tests

  • UI: yarn test src/components/WorkflowDefinitions src/utils/WorkflowNodeConfigUtils.test.ts src/hooks/useWorkflowMode.test.ts: 235/235 passed.
  • Backend: SetApprovalAssigneesImplTest, TaskRepositoryAssigneesTest, UserApprovalTaskTest: 58 run, 0 failures, 0 errors. The 3 new backend tests fail on the code without the fix (checked).

Backend integration tests

  • I added integration tests for the changed behaviour.
  • Files: WorkflowDefinitionResourceIT, which adds test_secondApprovalStepWithNobodyToAskApprovesOnItsOwn and test_taskWithoutAssigneesNeverFallsBackToItsCreator.
  • Run locally, MySQL + Elasticsearch, on the final code:
    • WorkflowDefinitionResourceIT (whole class, isolated lane): 178 run, 0 failures, 0 errors.
    • WorkflowTaskAssigneesIT, TaskResourceIT, IndependentOntologyReviewRuleIT, UserHardDeleteWithSoftDeletedTaskIT, DataAccessRequestValidationIT (parallel lane): 339 run, 0 failures, 0 errors, 31 skipped. The skips are in TaskResourceIT and predate this change.
    • test_secondApprovalStepWithNobodyToAskApprovesOnItsOwn with the old task-workflow detection put back: fails. The second step opens a task and the run never ends.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • playwright/e2e/Features/Workflows/WorkflowOssRestrictions.spec.ts (OSS lane): the edit-mode test picks Assign to admins with chooseSelectOption, asserts the PUT body, then reopens the step and checks the saved value. The spec's trigger now excludes every table, so other workers' tables never open admin tasks while it is deployed.
  • Run locally against an OSS server built from this branch, serving the production UI build:
    • WorkflowOssRestrictions.spec.ts + NoOpWorkflowNodeConfig.spec.ts: 9 passed on the final code.
    • Earlier on this branch, the whole Features/Workflows folder: 32 passed, 1 failed. The failure was ChangeRequestReviewLifecycle.spec.ts:363, a timeout under 3 workers, which passed 10/10 alone.
  • Collate counterpart: one assertion in UserApprovalWorkflow.spec.ts (the select is visible and defaults to Approve automatically). It passed (4/4) against a Collate build carrying this OSS change, and lands with the submodule bump after this merges.

Manual testing performed

  1. Started the OSS server from this branch with the production UI build on localhost:8585, and signed in as admin.
  2. Created a workflow with an approval step (owners + reviewers) through the API, opened it in the builder, entered edit mode and clicked the step.
  3. The select showed Approve automatically with its hint. The dropdown listed Approve automatically and Assign to admins.
  4. Picked Assign to admins: the hint mentioned the owner fallback. Saved the step and the workflow, reopened the step, and Assign to admins was still selected.
  5. Opened the seeded DescriptionUpdateTaskWorkflow. Its read-only approval step showed Go to the asset's owners.

UI screen recording:

Screenshots from the local server built from this branch (commit 224c714e578; 0a25497c1d6 changes only the ADR text and a test comment):

Default:
Default: Approve automatically

The choices:
The two choices

Assign to admins selected:
Assign to admins selected

A seeded task workflow (read-only):
Task workflow default

Checklist:

  • I have read CONTRIBUTING.md (the pre-review gate) and the contributor docs.

  • 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: screenshots from a local build of this branch are above; no Docker recording.

  • 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.

    • Four fresh-context passes against REVIEW.md. The last, on 224c714e578, found one 🔴: the ADR amendment overstated the task-workflow rule. It is fixed in 0a25497c1d6 by making the ADR state exactly what the code does, along with a 🟡 comment wrap; both are doc and comment changes only.
    • Out of scope, recorded in the ADR: in a periodic-batch workflow, a later approval step still reads the earlier step's task id, as before this PR.
  • Decision check: ADR:2026-11-25-an-approval-never-goes-to-its-requester v2 records the owner-fallback and later-step rules.

  • I have added a test that covers the exact scenario we are fixing.

🤖 Generated with Claude Code

The approval step form saved emptyAssigneeStrategy but showed no control for it,
so switching a step to assignAdmins or wait needed an API edit. Add a Select with
all three schema values, each with a hint, and a note that the setting also
covers an approver who made the change. The form's hand-written 'none' |
'assignAdmins' types become the generated EmptyAssigneeStrategy, so a step
saved with wait shows it instead of a blank select.

The OSS restrictions spec now picks Assign to admins and asserts the PUT; its
workflow skips every real table so other workers' tables never open admin tasks.
Under assignAdmins, when the requester is the only admin, the owner fallback can
still route the task to the asset's owners, so "never to the person who made the
change" overpromised; "no one is asked to approve their own change" did too, and
the none hint's "task stays unassigned" ignored the same fallback. List the
default option first, check the saved strategy after reopening the step, and
name the trigger filter for what it does (it excludes every table).
A task workflow (noOp trigger) never approves on its own: SetApprovalAssigneesImpl
keeps hasAssignees true for workflow-managed tasks, and the owner fallback sends
the open task to the asset's owners. Its read-only approval step showed "Approve
automatically" for the default; it now shows "Go to the asset's owners" with a
matching hint.
@yan-3005
yan-3005 requested a review from a team as a code owner November 27, 2026 06:10
@yan-3005
yan-3005 requested a review from Rohit0301 November 27, 2026 06:10
@yan-3005 yan-3005 added the To release Will cherry-pick this PR into the release branch label Nov 27, 2026
Copilot AI balanced review requested due to automatic review settings November 27, 2026 06:10
@github-actions

github-actions Bot commented Nov 27, 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.

…s own

Owner fallback: a task created with no assignee fell back to all the asset's
owners, so under assignAdmins with the requester as the only admin it could
assign the requester, who as filer cannot resolve it. The fallback now skips
the task's creator.

Later approval steps: the first step's CreateTask leaves taskEntityId at process
scope, and a step read any taskEntityId as a task workflow's, so a second step
with nobody to ask opened a task under none instead of approving. A taskEntityId
whose task belongs to an entity-event workflow no longer counts.

UI: the builder offers Approve automatically and Assign to admins; a step that
already stores wait still shows it. The Assign to admins hint names the owner
fallback, and the doubled margin above the select is gone. ADR 2026-11-25 gets a
v2 amendment.
@yan-3005
yan-3005 requested a review from a team as a code owner November 27, 2026 07:44
@yan-3005
yan-3005 requested review from IceS2 and a balanced review from Copilot November 27, 2026 07:44

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 27, 2026 07:52

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 27, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

Exposing automatic approval when no eligible approver exists, including at later steps, could let workflow changes bypass human review.

Adds an If no one else can approve select to the approval step with none (approve automatically) and assignAdmins options, and stops the owner fallback and later approval steps from assigning a task to its own creator. No issues found.

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 52d2fd2 into main Nov 27, 2026
51 of 52 checks passed
@yan-3005
yan-3005 deleted the feat/approval-empty-assignee-strategy-ui branch November 27, 2026 11:18
@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.

@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.

@gh-bot-collate

Copy link
Copy Markdown

🤖 Backport to 2.1 opened as #38968 (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 27, 2026
…#38923) (#38968)

* Fixes #38921: choose what happens when no one else can approve a step

The approval step form saved emptyAssigneeStrategy but showed no control for it,
so switching a step to assignAdmins or wait needed an API edit. Add a Select with
all three schema values, each with a hint, and a note that the setting also
covers an approver who made the change. The form's hand-written 'none' |
'assignAdmins' types become the generated EmptyAssigneeStrategy, so a step
saved with wait shows it instead of a blank select.

The OSS restrictions spec now picks Assign to admins and asserts the PUT; its
workflow skips every real table so other workers' tables never open admin tasks.

* Word the no-approver hints to match what the backend does

Under assignAdmins, when the requester is the only admin, the owner fallback can
still route the task to the asset's owners, so "never to the person who made the
change" overpromised; "no one is asked to approve their own change" did too, and
the none hint's "task stays unassigned" ignored the same fallback. List the
default option first, check the saved strategy after reopening the step, and
name the trigger filter for what it does (it excludes every table).

* Show the task-workflow outcome for none on noOp workflows

A task workflow (noOp trigger) never approves on its own: SetApprovalAssigneesImpl
keeps hasAssignees true for workflow-managed tasks, and the owner fallback sends
the open task to the asset's owners. Its read-only approval step showed "Approve
automatically" for the default; it now shows "Go to the asset's owners" with a
matching hint.

* Never hand a task back to its creator; let a later step approve on its own

Owner fallback: a task created with no assignee fell back to all the asset's
owners, so under assignAdmins with the requester as the only admin it could
assign the requester, who as filer cannot resolve it. The fallback now skips
the task's creator.

Later approval steps: the first step's CreateTask leaves taskEntityId at process
scope, and a step read any taskEntityId as a task workflow's, so a second step
with nobody to ask opened a task under none instead of approving. A taskEntityId
whose task belongs to an entity-event workflow no longer counts.

UI: the builder offers Approve automatically and Assign to admins; a step that
already stores wait still shows it. The Assign to admins hint names the owner
fallback, and the doubled margin above the select is gone. ADR 2026-11-25 gets a
v2 amendment.

* Regenerate the Playwright impact map

(cherry picked from commit 52d2fd2)

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

Hand port of #38923 to 2.0.

The workflow builder's approval step gets an "If no one else can approve" select
for emptyAssigneeStrategy: Approve automatically (none, default) or Assign to
admins. On a task workflow (noOp trigger) the default reads "Go to the asset's
owners", since a task workflow never approves on its own. The doubled margin above
the select is gone.

The owner fallback for a task created with no assignee never assigns the task's
creator: under assignAdmins with the requester as the only admin, it could hand
the requester their own task, which as filer they cannot resolve.

Differences from main: 2.0 has no wait strategy, so it is neither offered nor
labelled. The later-approval-step fix is not ported: on 2.0 a later step also
reuses the earlier step's task in CreateTask, which needs the lifecycle-gate
changes (#34693) that 2.0 lacks.
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.

Workflow builder: choose what happens when no one else can approve a step

5 participants