Skip to content

Fixes #34693: support lifecycle gates, metadata tasks and metric intake - #34694

Merged
harshach merged 43 commits into
mainfrom
agent/users-harsha-downloads-colla
Oct 16, 2026
Merged

harshach merged 43 commits into
mainfrom
agent/users-harsha-downloads-colla

Conversation

@harshach

@harshach harshach commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #34693

Add the shared schema, workflow-engine and intake-form support needed by guided lifecycle workflows. The executable graph remains authoritative; optional lifecycle metadata preserves field checks and guidance, metadata collection creates ordinary tasks, and approval steps can explicitly wait for an assignee. Metric creation now uses the shared intake form without preventing older metrics from updating when new requirements are enabled.

Based on the two commits in this branch:

  • 0edb073f3e — persist lifecycle gates, collect metadata tasks, resolve current domain owners/immutable candidate IDs, handle empty assignments, preserve literal custom-property values, and isolate workflow event delivery.
  • 8bb1648217 — reuse shared Metric intake forms, preserve zero/false custom values, cancel stale query-builder requests, and add creation/intake regression coverage.

This builds on the merged lifecycle API in #34541. Draft pending review, CI, direct OSS UI evidence and the remaining validation noted below.

Type of change:

  • New feature

High-level design:

  • Extend workflow schemas with optional config.lifecycle presentation metadata and a collectMetadataTask node. Register the node through the existing factory and preserve metadata through WorkflowDefinitionMapper; Java models and committed TypeScript models derive from the schemas.
  • MetadataCollectionService uses the shared task repository and a deterministic entity/workflow/stage/field identity. Repeated edits reuse tasks; satisfied requirements complete, inapplicable requirements cancel, and returning requirements reopen. Task completion alone does not satisfy a missing field. Existing manual assignments are preserved.
  • Approval configuration adds current domain-owner resolution and an explicit empty-assignee waiting strategy. Existing workflows retain their prior behavior unless they select this option. Immutable candidate IDs avoid FQN drift. Suspended subscribers no longer interrupt event delivery to other workflows.
  • Metric intake validation applies at creation; existing assets remain editable so lifecycle status changes are not blocked by newly required intake fields. Metric and glossary creation share custom-value handling, including 0 and false. Intake-designer proposals stay unsaved until Save.
  • Reuse ordinary workflow nodes, tasks and intake forms instead of introducing another lifecycle engine or form store. Existing graphs remain valid. The additions are optional JSON properties/node types and need no database migration or backfill. Removing a workflow/check does not delete historical metadata tasks.
  • No additional status vocabulary, AI/lineage autofill or data-quality assessment is introduced.

Tests:

Use cases covered

Persist/reload lifecycle metadata; conditional metadata tasks that reuse, complete, cancel and reopen; missing/empty approvers that wait; current domain ownership and immutable candidate IDs; suspended workflow event isolation; dotted custom properties and zero/false values; required Metric creation fields; legacy Metric updates; glossary custom-field regressions; and stale query-builder request cancellation.

Unit tests

  • Added/updated unit tests for changed behavior.
  • Java: 208 passed across 15 classes in the scoped regression run, including WorkflowSignalIsolationTest, WorkflowDefinitionMapperTest, DataCompletenessImplTest, SetApprovalAssigneesImplTest, IntakeFormValidatorTest and shared task regressions.
  • UI: 357 distinct tests passed across 26 suites, including useMetricIntakeForm.test.tsx, AddMetricForm.utils.test.ts and AdvanceSearchProvider.test.tsx, plus shared intake/query-builder regression suites.
  • Java changed-class JaCoCo coverage has not been measured; no 90% backend coverage claim is made.

Backend integration tests

  • Added LifecycleWorkflowConfigurationIT and LifecycleMetadataTasksIT; expanded IntakeFormResourceIT.
  • Scoped integration verification: 85 passed, 12 inherited fixture checks conditionally skipped. Includes existing entity-status ownership, four entity types and approval regressions. Two new task fixtures initially used the wrong PATCH media type; after correction both passed on a focused rerun, while the other 83 passing cases were unchanged.

Ingestion integration tests

Not applicable: no connector or ingestion-runtime changes. Pydantic regeneration/ingestion compatibility is still to be checked before marking ready.

Playwright (UI) tests

39 distinct scenarios passed without retries against these backend changes through the consuming lifecycle UI, covering all four entity types, stage transitions, three rejection paths, task reuse/cancellation, approval waits, multiple approvals, conflict pauses and shared intake forms. The browser spec belongs to the companion UI repository; this PR does not add an OSS Playwright file. The recorded total combines a 35-scenario full run and an eight-scenario focused run with four overlapping scenarios.

Manual testing performed

A local test server and browser exercised the template drawer, stage editor, conditional check details, approvals, shared intake-form configuration, publish/reload and generated canvas. Seven consuming-UI screenshots were inspected with no page errors. Backend build/install, scoped Spotless, changed-file UI ESLint/Prettier and whitespace checks passed. Full-workspace TypeScript still reports repository/dependency errors, including unresolved core-component icon declarations; a full-repository green build is not claimed.

UI screen recording / screenshots:

TODO before marking ready: attach a direct OpenMetadata Metric intake-form recording/screenshots. Keeping this PR as a draft; the consuming UI's evidence is included with its separate PR.

Checklist:

  • Read the CONTRIBUTING document.
  • PR title identifies the linked issue and change.
  • Linked the issue through Fixes #34693.
  • Commented non-obvious workflow/task behavior.
  • Explained why a database migration is not needed.
  • Attach direct OSS UI recording/screenshots before marking ready.
  • Added unit/integration tests and listed executed browser coverage.
  • Measure Java changed-class coverage and verify Pydantic regeneration before marking ready.

Summary by Gitar

  • Workflow UI:
    • Added WorkflowList page section and a footer slot on WorkflowCard for downstream builds
    • Glossary term workflow history now shows the newest run of a stage-setting workflow via getLatestWorkflowRun
    • Shows a Suspended badge beside a suspended workflow's title in WorkflowHeader
  • Query builder:
    • Rule rows stack their controls in narrow panels using container queries in QueryBuilderRuleRow
    • Operators that take no value show a note through QueryBuilderValueCell
  • Glossary intake:
    • Glossary creation renders intake extension fields and required-field messages in AddGlossary
  • Embedded workflow builder:
    • Added EmbeddedWorkflowBuilder to show the builder tabs in a host page without the page header
    • Workflow header manage menu groups Suspend/Resume with Delete in WorkflowHeader
  • Domain lifecycle:
    • A domain's lifecycle stage appears beside its name in DomainDetails

This will update automatically on new commits.

RetriggerView in GreptileConfidence Score: 4/5

The remaining Java guide violations must be addressed before merging.

Findings

  1. P2 Old-stage requests stay open ▶
  2. P2 Approval history disappears ▶
  3. P2 Tests exceed required method size ▶
  4. P2 Unexpected errors look routine ▶

Summary

Adds shared support for guided lifecycle workflows:

  • Lifecycle stages can create a task that lists missing fields.
  • Approval steps can name and wait for a lifecycle stage move.
  • Metric and Glossary forms can use shared intake fields.
  • A failing workflow subscriber no longer blocks other subscribers.
  • Workflow pages show lifecycle status and support stage-focused navigation.

No new findings were accepted in this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Asset change] --> B[Workflow graph]
  B --> C[Check required metadata]
  C -->|Missing| D[Open or refresh metadata task]
  C -->|Complete| E[Approval when required]
  D --> F[User fills asset fields]
  F --> A
  E --> G[Move asset to next stage]
Loading

Reviews (8) · Last reviewed commit: "fix(lifecycle): address review on intake..." · Reviewed by Greptile

Add durable lifecycle configuration, conditional metadata collection tasks, current domain-owner approval resolution and explicit waiting for empty assignments. Preserve literal custom-property values and isolate event delivery when another workflow is suspended. Cover the engine changes with unit and API integration tests.
Validate required intake fields on Metric creation while allowing existing metrics to update and advance through workflows. Reuse the intake designer and preserve false and zero custom values. Cancel stale query-builder requests and add intake and creation regression coverage.
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 5, 2026
@harshach
harshach marked this pull request as ready for review October 5, 2026 23:40
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

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

harshach and others added 2 commits October 5, 2026 16:44
Apply the same organize-imports, ESLint and Prettier order used by UI Checkstyle for the glossary and shared intake extension helpers.
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

✅ Generated Sources Auto-Updated

The generated TypeScript types (src/generated/) and dereferenced JSON
schemas (src/jsons/, public/jsons/) have been automatically updated
based on JSON schema changes in this PR.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 78%
78.16% (128590/164509) 64.84% (81571/125794) 66.14% (27241/41181)

…rkflow list heading

A rule whose container is narrower than the md container width lays its Field,
Operator and Value controls one under another instead of squeezing Operator to
an ellipsis. The workflow list heading is a plain h2, since Typography styles
headings through its prose wrapper.
Comment on lines +188 to +194
Task open = repository.findOpenTaskByEntityAndType(entity.getFullyQualifiedName(), TASK_TYPE);
int closed = 0;
while (open != null && !current.equals(open.getId()) && closed < MAX_STALE_TASKS) {
final MetadataCompletionPayload payload =
JsonUtils.convertValue(open.getPayload(), MetadataCompletionPayload.class);
if (isInStage(entity, payload.getStage())) {
open = null;

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.

P2 Old-stage requests stay open

closeTasksOfOtherStages can leave old-stage tasks open permanently. With twelve collection nodes in the previous stage, the first run closes ten tasks and opens the new stage's task. That newer task then wins the createdAt DESC LIMIT 1 lookup. Later runs stop at that task, so they never visit the remaining two stale tasks. Fetch tasks from other stages directly, or page through all open tasks without stopping at the first current-stage task.

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.

Fixed in d074e48: the reconcile now lists all open MetadataCompletion tasks for the asset (bounded) and closes every one from a stage the asset has left, so a newer current-stage task no longer hides older stale ones.

Comment on lines +79 to +85
const { data } = await getWorkflowInstancesForApplication({
...timeRange,
entityLink,
limit: RECENT_INSTANCES_LIMIT,
});
const instances = orderBy(data ?? [], getInstanceStart, 'desc');
const definitions = await getReadableDefinitions(instances);

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.

P2 Approval history disappears

getLatestWorkflowRun searches only the first 25 runs across all workflows. If a term has an approval run followed by 25 runs of a workflow that does not set its stage, the approval run falls outside this page. The card then shows no workflow history even though approval history exists. Follow the returned pages until a relevant run is found, or filter for stage-setting workflows before applying the limit.

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.

Fixed in d074e48: getLatestWorkflowRun pages through the runs (up to 8 pages of 25) until it finds a stage-setting workflow. Added a test with 25 runs of another workflow ahead of the approval run.

yan-3005 and others added 3 commits October 16, 2026 13:08
…ted wording

A footer element carrying data-workflow-card-flag gives its workflow card the
error border. German, French and Hebrew lifecycle strings are reworded without
hyphens.
…p is empty

A refresh asks the stage's group once it has someone. While it is empty the
task keeps whoever it already has, so a reassignment survives the next edit,
and the admins are asked only when the task has nobody.
karanh37 and others added 4 commits October 16, 2026 17:44
Export EmbeddedWorkflowBuilder: the builder's Workflow Builder and
Execution History tabs, canvas, palette and edit controls for a saved
workflow, without the page layout, breadcrumb and title header, so a
host page with its own header (the Collate lifecycle editor) can show
them in place. onSaved lets the host reload after a save.

- WorkflowExecutionHistory takes the workflow's fqn as a prop, falling
  back to the route's.
- WorkflowHeader gains an `actions` variant that renders only the run,
  test, save, cancel and edit controls.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…he status in version history

- A workflow approval (a lifecycle stage move or a held change) is decided by its
  assignees only. An assignee can approve even when the asset also has reviewers;
  anyone else, admins and owners included, gets "User 'x' is not an assignee of this
  approval, so they cannot approve or reject it."
- Version history reads "Status changed to Approved." for an entityStatus change.
- Data Product and Domain pages reload once a task on them is decided from the
  Activity tab, so the status in the header is current.
The workflow page header gets a three-dot menu after Edit Workflow holding
Suspend (Resume once suspended) and a red Delete, replacing the standalone
Delete Workflow button. The menu shows wherever deletion is allowed.
Comment on lines +15667 to +15670
void test_sameOwnerApprovesConsecutiveGates(TestNamespace ns) throws Exception {
OpenMetadataClient admin = SdkClients.adminClient();
OpenMetadataClient ownerClient = SdkClients.user1Client();
EntityReference owner = admin.users().getByName("shared_user1").getEntityReference();

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.

P2 Tests exceed required method size

The added test_sameOwnerApprovesConsecutiveGates spans over 60 lines and mixes entity setup, workflow deployment, two approvals, and polling. The Java guide requires methods to stay around 15 lines and do one nameable thing. Extract setup and approval helpers so the test reads as a short sequence of outcomes. The same pattern appears in LifecycleMetadataTasksIT and LifecycleWorkflowConfigurationIT. This repository requirement must be satisfied before merging.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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.

Done in d074e48: test_sameOwnerApprovesConsecutiveGates and the long tests in LifecycleMetadataTasksIT and LifecycleWorkflowConfigurationIT now read as named steps with helpers.

The manage menu hid Suspend and Resume whenever deletion was disabled, and
OpenMetadata disables deletion, so neither was reachable there. Suspend now
follows view mode, like Edit Workflow; only Delete follows the delete capability.
…d or resume

The stage lock reads the active stage-owning workflows from a cache that a
workflow change clears with invalidateAll(). Caffeine leaves an entry still
loading during invalidateAll() undefined, so a load that read the workflows
just before a suspend or resume could cache the old list for the 30s expiry:
the lock stayed on after a suspend, or stayed off after a resume. The cache
is now keyed by a generation that invalidation moves on, stranding such a
load under a key no lookup reads again.
final var variables = new WorkflowVariableHandler(execution);
try {
collect(execution, variables);
} catch (Exception failure) {

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.

P2 Unexpected errors look routine

CollectMetadataImpl.execute catches every Exception and converts it to BpmnError. The Java guide explicitly requires catching specific exception types. Catch the failures this delegate expects so unrelated coding errors are not treated as ordinary workflow failures. This repository requirement must be satisfied before merging.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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.

Done in d074e48: it now catches RuntimeException. collect() declares no checked exceptions, and any failure still has to become a BpmnError so the stage's error boundary handles it, as in the other delegates.

… history and tests

- Glossary intake is checked when a glossary is created, including a PUT that
  creates one, and skipped for bots, as for Metric; later edits to a glossary
  created before a required field are accepted.
- A stage's metadata reconcile closes every open task of another stage the
  asset has left, not only those newer than the current stage's task.
- Workflow history pages through an entity's runs until one of a stage-setting
  workflow is found, so runs of other workflows cannot hide it.
- CollectMetadataImpl catches RuntimeException; collect() declares no checked
  exceptions and failures still reach the stage's error boundary.
- Tests use the imported ResolveTask and read as named steps.
@gitar-bot

gitar-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 4 closed / 4 findings

🔴 High risk · Changing approval-assignee resolution and empty-assignee behavior could permit unintended lifecycle stage changes or leave valid transitions blocked.

Adds guided lifecycle workflow support, including metadata collection tasks, approval steps that wait for assignees, and shared Metric intake forms. Resolved NPE when collectMetadataTask omits inputNamespaceMap, workflow tasks no longer falling back to entity owners for every strategy, signal subscriber failures no longer aborting delivery to later workflows, and admin fallback no longer overwriting manual reassignment on reconcile. No open issues remain.

✅ 4 closed
✅ Bug: NPE when collectMetadataTask omits inputNamespaceMap

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/nodes/automatedTask/CollectMetadataTask.java:54-58
inputNamespaceMap is optional in collectMetadataTask.json, and JsonUtils.pojoToJson(null) returns null. Map.of throws a NullPointerException on a null value, so building the BPMN model fails for any workflow whose node leaves the map out. That workflow then can't be deployed. Every other node falls back to an empty map with != null ? ... : new HashMap<>(), and this one should do the same.

✅ Bug: Workflow tasks no longer fall back to entity owners for every strategy

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TaskRepository.java:455-457
setDefaultAssigneesFromEntityOwners now returns early for any task with a workflowInstanceId, and CreateTask always sets one. Before this change, a workflow task whose assignees came back empty (e.g. a workflow-managed task with strategy none) was assigned to the entity owners. Now it is created with no assignees and nobody can act on it. This applies to existing workflows, not just ones that pick the new wait option, which contradicts the PR's claim that existing workflows keep their behavior. Skip the owner fallback only when the approval node explicitly chose wait, for example by passing that intent through to the task rather than keying on workflowInstanceId.

✅ Bug: One failing signal subscriber still aborts delivery to later workflows

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowHandler.java:802-807 📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/WorkflowSignalDispatcher.java:54-56
triggerWithSignal now goes through WorkflowSignalDispatcher.dispatch, which delivers each subscription in its own transaction. But a non-transient exception from one subscriber (for example a start-event listener or the first service task throwing) escapes the loop. Every subscriber after it is skipped, so one broken workflow still blocks event delivery to unrelated workflows. That is the isolation this change is supposed to provide.

There is a second problem. Before, RuntimeService.signalEventReceived ran as a single command, so a failure rolled back all deliveries. Now the subscribers before the failing one have already committed. WorkflowEventConsumer.sendMessage turns the exception into an EventPublisherException for the event, so any redelivery of that event starts duplicate process instances for the workflows that already succeeded.

Fix: catch the error for each subscription after retries are used up, log it with the process definition and subscription id, and continue the loop. If the caller needs to know about failures, collect them and report them without throwing for subscribers that already succeeded.

✅ Bug: Admin fallback overwrites manual reassignment on every reconcile

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/metadata/MetadataCollectionService.java:275-289 📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/metadata/MetadataCollectionService.java:320-334
assignees() now always returns a non-empty list (the asked group, or else every admin), so the !assignees.isEmpty() guard in refresh (lines 281, 290) is effectively dead. Before this change, that guard kept the task's current assignees when the asked group was empty. Now, if an admin hands the fallback task to a steward, the next asset edit that triggers a reconcile (for example filling in one of the missing fields) patches the assignees back to the full admin list. The same thing happens when an asset loses its owners: the task is taken from the previous owners and given to the admins. The PR description says existing manual assignments are preserved, which no longer holds here. A fix is to keep the current assignees whenever the asked group is empty and the task already has someone, and fall back to the admins only on create or when the task has no assignees.

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

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support lifecycle workflow configuration, metadata tasks and metric intake forms

4 participants