Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# A data product port change is held as a list field of the data product, gated only by its workflow

- **Status:** Accepted
- **Revisions:** v1 2026-10-19 (initial)
- **Deciders:** Ram Narayan Balaji
- **Guard:** `WorkflowDefinitionResourceIT` (`test_dataProductPortAddIsHeldUntilApproved`, `test_dataProductPortRemovalIsHeldAndARejectionKeepsThePort`, `test_botPortEditIsNotHeld`, `test_heldDescriptionAndPortChangesApplyTogether`, `test_dataProductPortCannotBecomeBothKindsThroughOneRequest`, `test_heldPortToAnAssetDeletedBeforeApprovalIsNotAdded`)
- **Related:** open-metadata/OpenMetadata#35740

## Context

A data product's input and output ports are `INPUT_PORT` / `OUTPUT_PORT` relationships, not fields of
the data product's JSON. The approval gate only holds edits it can express as a change of entity JSON,
and a change request is applied as a JSON Patch, so a port change was written immediately even when an
Enforce approval workflow covered data products. `inputPorts` and `outputPorts` were already trigger
fields of `dataProduct` (`workflowTriggerFields.json`), so a workflow could name them and do nothing.

A port also relates two entities, so it has to be decided whose workflow gates it.

## Decision

- A relation the entity JSON does not carry is held as a **list field of the owning entity**, named by
`EntityRepository.getStagedRelationFields()`. For a data product these are `inputPorts` and
`outputPorts`; each element is the port's entity reference and its identity is the reference id, so a
change request holds `add` / `remove` ops with `key` = reference id and `value` = the reference JSON.
- The gate judges the owning entity's JSON with those list fields added (`addStagedRelations`), through
the same staging as a PATCH (`ApprovalGate.admitRelations`).
- On approval, these ops are published by `applyStagedRelations`, in the same transaction as the request's
field ops, which still go through the JSON Patch path. Before publishing, every added relation is checked
again against the relations as published and the other additions of the same request
(`validateStagedRelations`); a relation that can no longer be made leaves the request unapplied.
- **Only the owning entity's workflow gates the relation.** Adding a port does not change the port's asset,
so the asset's workflow is not asked. One gate per change: two workflows never decide one edit.
- Adding assets to a domain or data product is unchanged: it edits each asset's `domains` / `dataProducts`
field, so each asset's workflow gates it.

## Consequences

- An Enforce workflow on data products holds port changes made by people; bots write through, as for any
gated field.
- Another relation that should be gated follows the same hooks: name it in `getStagedRelationFields`,
render it in `addStagedRelations`, and validate and write it in `validateStagedRelations` /
`applyStagedRelations`.
- A UI or change-request consumer reads port ops like any other list op of the data product.
- Revisit if ports become fields of the data product entity again; then the JSON Patch path holds them and
these hooks can go.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# A rejected lifecycle approval asks for a revision, and the next edit resubmits it

- **Status:** Accepted
- **Revisions:** v1 2026-10-21 (initial)
- **Deciders:** Ram Narayan Balaji
- **Guard:** `MetadataCollectionServiceTest`, `TaskWorkflowHandlerTest`, `WorkflowDefinitionResourceIT` (`test_rejectedApprovalAsksForARevisionAndTheNextEditResubmitsIt`)
- **Related:** open-metadata/OpenMetadata#35740, ADR:2026-10-15-a-lifecycle-stage-asks-for-its-missing-metadata-in-one-task

## Context

A lifecycle approval that was rejected could only move the asset to another stage (back to Draft, or
to a terminal Rejected) or leave it where it was. Left where it was, nobody was told the approval had
been rejected or why, and the approval opened again on the next edit whether or not the edit
addressed anything. The reviewer's comment was stored on the approval task but never reached the
workflow: the resolve path passed Flowable only the result, the user and the transition.

## Decision

- When an approval task is rejected, the resolve path sets two **global** workflow variables before
completing the Flowable task: `rejectionComment` (the reviewer's comment, or empty) and `rejectedBy`
(the user). They are global so any step after the approval can read them without the approval node
declaring them as outputs. A rejection that carries no comment of its own (the task page's Reject
asks for none) takes the reviewer's latest comment on the task thread.
- A `collectMetadataTask` with `revision: request` asks the stage's assignees to revise the asset: it
opens a **Revise and resubmit** task of type `MetadataCompletion`, whose payload carries
`revision.comment` and `revision.requestedBy` and lists no missing fields. There is one such task per
asset, workflow and stage (`revisionTaskId`); a later rejection reopens it with the new comment.
- A `collectMetadataTask` with `revision: resubmit`, placed before the stage's approval, completes that
task ("Resubmitted for approval") when the approval opens again. The next edit to the asset is the
resubmission: the lifecycle runs on edits and reaches the approval again once the stage's checks
pass. A Revise and resubmit task offers no transition of its own.
- The task also closes, like every Metadata Completion task, when the asset leaves the stage.
- A revision task is a `MetadataCompletion` task rather than a new task type, so it reuses its
assignment (the stage's group, the admins when the group is empty), its stage scoping and its
rendering; the UI tells the two apart by the presence of `revision`, and shows a revision task
without action buttons.

## Consequences

- A reviewer's rejection comment reaches the people who have to act on it, and the approval is asked
again only after the asset is edited.
- Any workflow can read `rejectionComment` and `rejectedBy` after a rejection; an approval that is
approved leaves them unset, and a rejection with no comment, on the decision or in the task
thread, leaves the comment empty.
- An edit that does not address the comment still resubmits; the reviewer decides again on the new
version. Requiring an explicit "Resubmit" action would need a task transition that advances the
workflow, which Metadata Completion tasks do not have.
Loading
Loading