Skip to content

[2.1] Fixes #35456: Approval tasks preview and undo the whole cycle, and finish after their workflow is suspended - #39845

Open
gh-bot-collate[bot] wants to merge 1 commit into
2.1from
backport/2.1/pr-38857
Open

gh-bot-collate[bot] wants to merge 1 commit into
2.1from
backport/2.1/pr-38857

Conversation

@gh-bot-collate

@gh-bot-collate gh-bot-collate Bot commented Dec 4, 2026

Copy link
Copy Markdown

Automated backport of #38857 to 2.1.

Source PR #38857
Author @Vamsi-klu
Merge commit 8df1410f4cfa3247df68504df6d30f1ad7c86f05
Method Clean cherry-pick — identical to the commit on main.

Opened from openmetadata-collate, which holds the credentials needed to open a PR here. It merges itself once this branch's required checks pass — no review needed. If a check fails it stays open and the author of #38857 is asked to look.

resolver run

…nish after their workflow is suspended (#38857)

* Add integration tests for the approval task preview across a cycle

* Record the version an approval cycle began from in the glossary approval payload schema

* Move the approved baseline check out of RollbackEntityImpl so other workflow code can share it

* Recompute the approval task preview from the version history at every task write

* Add the decision record for the approval preview and mark the one it supersedes

* Read the approval cycle history inside the preview guard so a failed read keeps the task's payload

* Record an approval preview that could not read its whole cycle in the glossary approval payload schema

* Compare the cycle's base version with the current one when the history walk cannot reach it, and mark a preview that still cannot

* Warn on the Proposed Changes card when the approval preview could not read the whole cycle

* Add integration tests for an approval preview whose cycle has a version missing from the history

* Record the comparison fallback, the incomplete marker and the guarded read in the approval preview decision

* Cover inherited references in approval history previews

VersionDiff delegates list comparisons to MutationPlanner, which filters inherited references. Exercise a historical snapshot with inherited owners, reviewers and domains alongside a real edit.

* Fix incomplete approval previews and opening baselines

* Use governed approval history for preview and rejection

* Include triggeringBots in approval history preview and rollback

* Keep approval previews incomplete when prior ranges are unreadable

* Restore unreviewed gaps on reject, let open tasks finish after suspend, preview CSV imports

Incomplete cycle history: when the walk to the cycle base stops at a missing
version or the 200 version cap and the base version is readable, preview and
rejection now restore every reviewed field that differs between the base and
the end of the gap, as a snapshot rollback would. A rejected task no longer
leaves unreviewed content in place under a restored approval.

Suspended or soft deleted workflows: suspending only stops new runs. The
Flowable trigger definitions stay active, because a child run cannot complete
while its parent definition is suspended; new runs are gated in FilterEntityImpl
and FetchEntitiesImpl instead. A soft delete suspends instead of removing the
deployment, a restore resumes it, and the lookups an open run uses to record
stages and create or resolve its tasks include soft deleted workflows. Open
tasks can be approved and rejected, rollbacks run, and later stages open.

CSV import: an imported row records the fields it changed in the version
change description, so version history, change events, trigger filters and
the approval preview see it. Change request previews resolve references
stored as id and type to the entity name.

ADR 2026-11-27 decision 4 updated; ADR 2026-12-03 added.

* Refuse manual starts and record no run while a workflow is suspended

The suspend change keeps the trigger definitions active so open runs can
finish. That left two gaps: triggerWorkflow started a run without the
suspend check triggerByKey has, and every event or timer tick on a suspended
workflow started a trigger run that did nothing but was still recorded as a
run of the workflow.

triggerWorkflow now refuses a suspended workflow, the triggerByKey check also
covers a periodic trigger's per entity type process key, and
WorkflowInstanceListener records no run for a trigger start while the
workflow is suspended. Trigger process keys map to their main workflow
through one TriggerFactory helper, which also keeps workflow names that
contain a hyphen intact.

* Keep a trigger run that started while its workflow was suspended stopped after a resume

The start listener records no run for a trigger start while the workflow is
suspended. The fetch and filter steps run later as their own jobs and checked
the suspend state again, so a resume in between could start main runs that
were never recorded. Both steps now honour the start listener's decision.

* Stub the workflow definition lookup with Include.ALL in resolver and assignee tests

The lifecycle resolver now reads workflow definitions with Include.ALL so a soft deleted
workflow still resolves for its open tasks. These tests stubbed Include.NON_DELETED, so the
lookup returned null: three cases failed and three passed only through the null fallback.

* Address review: suspended workflow delivery, pre-upgrade priors, CSV import preview

- Signal delivery and the change request listener count treat a start of a suspended
  workflow's trigger as suspended, so entity events start no trigger run and a change
  request delivered after a suspend is retried and requeued on resume. The filter checks
  suspension before reading the entity.
- A soft delete with no open run undeploys as before; with open runs it still suspends.
- A prior approval task whose run recorded no reviewed range carries the predecessor of its
  run's triggering edit, so a chain open at upgrade time keeps the earlier edit in review.
- A CSV import stores the change description main records again; the approval cycle reads an
  import version against the version before it instead.
- The trigger key maps to its workflow by stripping only a known entity type suffix.
- WorkflowSuspendOpenTasksIT uses an active workflow as the sync point for the absence check.
- ADR 2026-12-03 v3 and ADR 2026-11-27 v2 record these choices.

* Check the workflow's main definition only for an active start subscription

takesSignal now reads the process key only when the definition is active and the subscription
starts a run, so a suspended definition or an open run's catch signal needs no key lookup.
WorkflowSignalIsolationTest gives its active start definition a trigger key.

* Mark the preview incomplete when a prior task's cycle start is unknown

A task opened on 1.13 recorded neither a reviewed range nor its triggering edit, so the next
task cannot see where the earlier cycle began. Its preview now shows its own cycle and is marked
proposedChangesIncomplete. Change request runs record neither by design and are not counted.
ADR 2026-11-27 decision 4 notes the case.

---------

Co-authored-by: Ram Narayan Balaji <[email protected]>
Co-authored-by: Ram Narayan Balaji <[email protected]>
(cherry picked from commit 8df1410)
@gh-bot-collate
gh-bot-collate Bot requested review from a team as code owners December 4, 2026 13:34
@gh-bot-collate
gh-bot-collate Bot requested review from manerow and sweta1308 and removed request for a team December 4, 2026 13:34
@gh-bot-collate gh-bot-collate Bot added the safe to test Add this label to run secure Github workflows on PRs label Dec 4, 2026
@gh-bot-collate

gh-bot-collate Bot commented Dec 4, 2026

Copy link
Copy Markdown
Author

🤖 This backport will not merge itself: 2.1 has no required status checks, so there is nothing for auto-merge to wait on. Merge it by hand once CI is green.

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

Clean cherry-pick of #38857, same 75 files.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

🤖 This backport is red, so it will not merge itself. @Vamsi-klu

Failing: Compatibility checks

The change is not on 2.1 yet. You raised the PR this was backported from, so please take a look. Push a fix to this branch and it merges automatically once the checks go green.

run log

This branch has not been deployed

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

Labels

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.

3 participants