Skip to content

Fixes 38297: Route suggestions on unowned assets through every owner to the admins - #38307

Merged
pmbrull merged 6 commits into
mainfrom
feat/suggestion-tasks-owner-cascade-admin-fallback
Nov 23, 2026
Merged

pmbrull merged 6 commits into
mainfrom
feat/suggestion-tasks-owner-cascade-admin-fallback

Conversation

@Shreyansh100704

@Shreyansh100704 Shreyansh100704 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #38297

A suggestion task on an asset with no owner was created with no assignee and reached nobody. A new opt-in assignee option, cascadeOwners, makes an approval task fall back to the asset's service owners, then its domain owners, before emptyAssigneeStrategy runs. SuggestionTaskWorkflow turns it on together with assignAdmins, so a suggestion nobody owns goes to the admins except its requester. A 2.1.1 migration applies the same settings to the stored workflow and redeploys it.

Type of change:

  • Bug fix

High-level design:

  • Assignee order (SetApprovalAssigneesImpl, new OwnerCascade): task assignees, then reviewers or owners (own and inherited), then, only when cascadeOwners is on and nothing resolved, service owners, then domain owners, then emptyAssigneeStrategy. A step is empty when it yields no user after team expansion. Owner auto-assignment turned off for the workflow skips the cascade too.
  • Schema: cascadeOwners (boolean, no default) on userApprovalTask.config.assignees; UserApprovalTask.transformAssigneesForFlowable passes it into the BPMN. Other workflows are unchanged unless a node sets it.
  • Seed: SuggestionTaskWorkflow TaskReview sets cascadeOwners: true and emptyAssigneeStrategy: assignAdmins.
  • Migration 2.1.1 (SuggestionTaskOwnerFallbackMigration): seeding never updates a stored workflow, and the deployed BPMN keeps the old assignee config until redeployed. The step edits the row as JSON (sets cascadeOwners; replaces a missing or none strategy with assignAdmins, keeps wait and assignAdmins), then redeploys. A stored workflow without a TaskReview node with assignees fails the migration, as ADR:2026-11-11-a-data-migration-carries-its-own-logic asks of an exception.
  • Domains field: requested only when the entity type supports domains, so a suggestion on a data contract or an ontology type no longer fails with Invalid field name domains.
  • 2.1.1 folder shared with Fixes 38163: Count historical open incidents in group trends #38164: that PR also adds v211/Migration.java and 2.1.1 SQL. Whichever merges second keeps both runOnce calls and the other PR's SQL.
  • Decision record: docs/decisions/2026-11-20-suggestion-tasks-fall-back-through-every-owner-to-the-admins.md.
  • Known risk, accepted: a suggestion on an unowned asset now goes to the admins, a pool shared across ITs. When a concurrent IT deletes an admin it created, TaskAssigneeCleanup.removeAssignee rewrites the tasks assigned to it, and a suggestion resolved in that sub-second window gets a 412 from TaskRepository.resolveTask. GlossaryTermAutomationDraftIT.anAutomationTermWithoutReviewersOrOwnersGoesToTheAdmins has the same exposure on main; this widens it to suggestion tests. The new IT creates no admin.

Tests:

Use cases covered

  • Suggestion on an unowned table whose service has an owner goes to the service owner.
  • Suggestion on an unowned table whose service has none goes to the domain owner, including when the service owner is a team with no members.
  • Suggestion with no owner anywhere goes to the admins, never its requester.
  • On an asset with no direct owner, an owner who is also the requester (the service owner, or an inherited schema/database owner, filing through Collate AI chat) is skipped, so the next owner in the cascade gets the task.
  • Not changed: a suggestion on an asset its requester directly owns is created assigned to that owner, as on main for every task type (TaskRepository.setDefaultAssigneesFromEntityOwners, kept by CreateTask.resolveExistingTaskAssignees).
  • An owned table keeps going to its owner; owner auto-assignment off and cascadeOwners off skip the cascade.
  • A suggestion on an entity type without domains still reaches its owners.
  • Migration: a stored workflow gains both settings from a missing or none strategy, keeps wait, is left alone when up to date, and fails when TaskReview is missing.

Unit tests

  • SetApprovalAssigneesImplTest: 7 new cases.
  • SuggestionTaskOwnerFallbackMigrationTest: new, 4 cases (5 runs).
  • MigrationArchitectureTest: the step and the two 2.1.1 Migration classes listed as exceptions.
  • Coverage: not measured.

Backend integration tests

  • WorkflowTaskAssigneesIT: aSuggestionOnAnUnownedTableGoesToItsServiceOwner, aSuggestionWithNoOwnerAnywhereGoesToTheAdmins (both time out on main; the first also fails without the transformAssigneesForFlowable line).

Local Java test run: PASSED

  • Commit: c807899b60a1 (base origin/main). dbf2df7208e after it changes only MigrationArchitectureTest (2/2 passed) and the decision record.
  • Finished: 2026-11-20 13:15 UTC · 27.6 min
  • Scope: the unit tests plus the ITs that can reach the change (approval-node workflows, tasks, incidents, change requests, workflow definitions, the migration runner and seeds). The planner's full list also picks migration-step ITs that test only their own step, smoke tests, and ITs matched by the class name Migration; those were not run.
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (14 classes) 14 175 0 0 1.5 passed
integration mysql-elasticsearch · parallel 32 1126 0 80 8.5 passed
integration mysql-elasticsearch · isolated 7 221 0 0 17.6 passed

The 80 skipped are BaseEntityIT$ListEntityHistoryByTimestampPaginationTest, which skips itself on this engine.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes; generated TS types gain one optional field).

Manual testing performed

Local Collate on Postgres, openmetadata_db at 2.1.0, backed up first.

  1. Before the change: one suggestion task each on an owned table, an unowned table under an owned service, an unowned table in an owned domain, and a table with no owner anywhere. Only the owned table's task had an assignee; the other three were Open at stage review with none.
  2. Ran the 2.1.1 migration: the stored TaskReview gained cascadeOwners: true and assignAdmins, Flowable SuggestionTaskWorkflow went from version 9 to 10, and the step marker was recorded.
  3. Same four suggestions: table owner, service owner, domain owner, and every admin except the requester.
  4. An AI Automation (Documentation Agent) over the same four tables: its suggestions went to the same people (all admins for the unowned one, the bot being the requester), and the task showed in an admin's GET /v1/tasks/assigned.
  5. Requester is an owner: a suggestion filed by the service owner on an unowned table went to the domain owner, and one filed by the schema owner (inherited by the table) went to the service owner.
  6. Migration run again (its log rows deleted): the stored row stayed byte-identical and the workflow was deployed again.
  7. MySQL 8.4: the step's exact SELECT and UPDATE against the real workflow_definition_entity DDL, on the pre-2.1.1 row: a soft-deleted row is not selected; the live row is updated once, its generated columns intact, to JSON identical to the Postgres result. The redeploy is engine-independent and was verified on Postgres.

UI screen recording:

Not applicable: backend-only change.

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: I updated the migration scripts or explained why it is not needed.

  • 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 and fixed every 🔴 finding, or answered it on the line below.

    • Reviewed dbf2df7208e: no 🔴. Answered, not changed:
      • A requester who directly owns the asset gets the task: existing behaviour on main for every task type, out of scope here.
      • The migration's SQL and redeploy are verified by hand (real upgrade on Postgres, exact SQL on MySQL), not by an automated test.
      • The migration stops when TaskReview is missing, as ADR:2026-11-11-a-data-migration-carries-its-own-logic asks of an exception; REVIEW.md would rather leave a customized row alone.
    • MigrationArchitectureTest: the rule is unchanged; the step and the two 2.1.1 Migration classes that run it are listed as exceptions.
  • Decision check: adds docs/decisions/2026-11-20-suggestion-tasks-fall-back-through-every-owner-to-the-admins.md.

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

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new blocking issue was found.

Summary

Adds optional owner fallback for approval tasks and enables it for suggestions: service owners, then domain owners, then admins. The 2.1.1 migration updates and redeploys the stored workflow.

  • Unowned suggestions move from asset owners to service owners, domains, then admins.
  • Existing suggestion workflows pick up the new owner fallback during upgrade.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Existing task assignees] --> B{Anyone assigned?}
  B -->|Yes| C[Keep existing assignment path]
  B -->|No| D[Resolve configured reviewers and owners]
  D --> E{Eligible user found?}
  E -->|Yes| F[Assign task]
  E -->|No, cascade enabled| G[Service owners]
  G --> H{Eligible user found?}
  H -->|Yes| F
  H -->|No| I[Domain owners]
  I --> J[Apply empty-assignee strategy if needed]
  J --> K[Suggestions fall back to admins]
Loading

Reviews (2) · Last reviewed commit: "test(migrations): list the 2.1.1 Migrati..." · Reviewed by Greptile

@Shreyansh100704
Shreyansh100704 requested a review from a team as a code owner November 20, 2026 12:56
@Shreyansh100704
Shreyansh100704 requested review from sonika-shah and a balanced review from Copilot November 20, 2026 12:56

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 20, 2026 13:38

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

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findings

Updating and redeploying SuggestionTaskWorkflow adds owner/admin fallback, so unowned-asset suggestions may reach broader groups and increase their task load.

Routes suggestion tasks on unowned assets through service owners, then domain owners, then admins (excluding the requester), via a new opt-in cascadeOwners assignee option and a 2.1.1 migration that updates the stored SuggestionTaskWorkflow. The guard that let any checked step call exceptions, contrary to the ADR, was resolved. No open issues remain.

✅ 1 closed
✅ Quality: Guard now lets any checked step call exceptions, contrary to ADR item 3

📄 openmetadata-service/src/test/java/org/openmetadata/service/migration/MigrationArchitectureTest.java:69-70 📄 openmetadata-service/src/test/java/org/openmetadata/service/migration/MigrationArchitectureTest.java:112-115 📄 docs/decisions/2026-11-20-suggestion-tasks-fall-back-through-every-owner-to-the-admins.md:32-37
ADR:2026-11-11-a-data-migration-carries-its-own-logic is Accepted. Its item 3 limits what a step may depend on: libraries, the runner classes, the contracts, and "other steps the rule checks". Named exceptions are left out of the rule's check, so under that item no step may call one. This PR changes the guard to onlyDependOnClassesThat(CHECKED_STEPS.or(EXCEPTIONS)...) so that mysql/v211/Migration and postgres/v211/Migration can call SuggestionTaskOwnerFallbackMigration. That change affects every later release too: any future checked step can call any listed exception, and through it reach WorkflowHandler, generated classes and so on, without becoming an exception itself.

The new ADR (2026-11-20) records only this one exception. It does not record the change to the guard. The PR description notes that @manerow may want it narrower. Either list the two v211 Migration classes as exceptions too, and keep the rule as it is, or add a revision to the 2026-11-11 record that says "A versioned step may call a step listed in MigrationArchitectureTest's exceptions".

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

@pmbrull
pmbrull merged commit b19c2d2 into main Nov 23, 2026
67 of 69 checks passed
@pmbrull
pmbrull deleted the feat/suggestion-tasks-owner-cascade-admin-fallback branch November 23, 2026 06:43
Shreyansh100704 added a commit that referenced this pull request Nov 24, 2026
… owner to the admins (backport 2.1 #38307, #38475) (#38560)

* Fixes 38297: Route suggestions on unowned assets through every owner to the admins (#38307)

* feat(governance): let an approval task fall back to service and domain owners

* feat(governance): route unowned suggestion tasks through every owner to the admins

* test(governance): suggestion tasks reach service owners, then admins

* fix(governance): look past owners who are the requester in the owner cascade

* fix(governance): drop an unworkable remedy from the v211 migration error

* test(migrations): list the 2.1.1 Migration classes as exceptions instead of widening the rule

(cherry picked from commit b19c2d2)

* Fixes 38297: Move the 2.1.1 migration's workflow redeploy to server start (#38475)

* fix(governance): deploy changed workflows on server start, not in migrations

* fix(governance): build the same workflow BPMN in every JVM

* docs(decisions): note the one extra deploy after a save that reorders map keys

* fix(governance): skip an unreadable workflow instead of deploying none on start

* fix(governance): name the workflow skipped as unreadable

* fix(governance): log the skipped workflow by its name

(cherry picked from commit 3cdf00c)

* docs: drop references to the migration architecture test, absent on 2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggestion tasks on assets with no owner are created with no assignee

3 participants