Repository navigation
Fixes #35456: Approval tasks preview and undo the whole cycle, and finish after their workflow is suspended - #38857
Conversation
…val payload schema
…orkflow code can share it
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Local test results for this branch. PR CI runs only the Java unit tests, so here is what I ran on my machine against MySQL and Elasticsearch. RED, the new IT on main (1971feb plus only the test commit)
Unit tests with the fix 196 tests in 9 classes, 0 failures: GREEN, integration tests with the fix
Not run locally: the rest of |
pmbrull
left a comment
There was a problem hiding this comment.
❌ Changes needed · 2 🔴 · 0 🟡
| Blockers | ❌ 2 🔴 |
| Nits | ✅ none |
| Tests | ❌ gaps in history-read failure and incomplete-cycle coverage |
| Cross-repo | ✅ checked the task payload consumer and available Collate callers |
| Trade-off | ❌ reading history is bounded, and the preview needs to surface partial results |
| Auto-approved | ➖ changes needed and a maintainer decision on the superseding ADR |
Thanks for covering edits that happen between approval tasks and for providing main and branch test results.
- 🔴
CreateTask.java:1342— A failed history read can abort task creation. Move the read inside the guarded preview path and test that the task still opens after a history read fails. Existing inline finding - 🔴
ApprovalCycleHistory.java:78— A missing version or the 200-version cap can leave the preview showing only the most recent part of the cycle. Compute the complete diff or show reviewers explicitly that the preview is incomplete. Add coverage for both a missing version and the cap.
The PR adds an ADR that supersedes the accepted approval-preview rule. Confirm the new rule with the original decider. The linked issue also needs a maintainer to add it to Shipping and rerun the metadata check. Metadata check details
What I checked
Traced workflow task creation, the history walk, and the Proposed Changes consumer. The original two issue scenarios already pass on main. The new integration tests cover residual cases involving older or skipped edits. The author reports 196 unit tests and 37 MySQL and Elasticsearch integration tests passed. Backend CI passed. Metadata and Collate Compatibility are red. The Compatibility status did not provide a job log.
claude-verdict {"sha":"5f77e8a900098650061f1f9dcc44661a42d1d579","recommendation":"request_changes","blocking":2,"nits_to_fix":0,"human_decision":true,"tradeoff":"does_not_hold","cross_repo":"checked","tests_ok":false}
…read keeps the task's payload
… glossary approval payload schema
…y walk cannot reach it, and mark a preview that still cannot
… read the whole cycle
…on missing from the history
… read in the approval preview decision
|
@pmbrull thanks for the review. Both blockers are fixed in 9c09aa4 through 2894227, and I replied in each thread with the details. @yan-3005 this PR adds ADR:2026-11-26-an-approval-preview-lists-the-change-since-its-cycle-began, which supersedes your 2026-11-03 record about the preview opening with the edit that started the cycle. Instead of carrying the preview forward and folding in each hop, every task write now rebuilds it from the version history since the cycle's base. Could you take a look and let me know if you're OK with that rule? The record shows your agreement as pending until then. What I ran locally on the new head: 190 unit tests across the 7 preview classes (including the new The linked issue still needs a maintainer to add it to Shipping and rerun the metadata check. Nothing to change in the code for that one. |
VersionDiff delegates list comparisons to MutationPlanner, which filters inherited references. Exercise a historical snapshot with inherited owners, reviewers and domains alongside a real edit.
pmbrull
left a comment
There was a problem hiding this comment.
❌ Changes needed · 2 🔴 · 0 🟡
| Blockers | ❌ 2 🔴 |
| Nits | ✅ none |
| Tests | ❌ gaps in the history-exception fallback and nested field diffs |
| Cross-repo | ✅ checked the task payload, approval UI and notification consumer |
| Trade-off | ❌ the snapshot fallback can hide edits while reporting a complete preview |
| Auto-approved | ➖ changes needed and maintainer agreement on the superseding ADR |
Thanks for fixing task creation when history is unavailable and adding the incomplete-preview warning. Two paths can still present an incomplete preview as complete.
- 🔴
ChangePreviewUtils.java:334— When the history lookup throws, the task opens with the existing payload. A superseded task can supply a stale preview, and a first task can have no preview at all. Set the incomplete flag in this path and show the warning in the task-created notification as well as the task page. Cover a failed fresh read with a carried preview. - 🔴
VersionDiff.java:50— With a missing history hop, a table column’s description or tag can change without changing its name. The snapshot diff emits a whole-list change that the preview reduces to the same column names. Show the nested edit or mark this result incomplete. Add a regression with a missing hop and an edit to a field on an existing column.
The superseding ADR still needs agreement from the original decider. The linked issue needs to go into Shipping, and the Compatibility check is red. Metadata check
What I checked
Read the guarded history lookup, snapshot comparison, task payload, task page and notification template. The new tests cover a missing history row, but the failure test accepts the original payload without a warning and the snapshot tests do not exercise changed values inside a column. Backend, UI checks and generated types pass. The author reports 190 unit tests, 15 MySQL and Elasticsearch integration tests, and 52 task UI tests passed. PostgreSQL and OpenSearch are outstanding.
claude-verdict {"sha":"b489552bc0c4dbaf93952176f6d1bc368a37377b","recommendation":"request_changes","blocking":2,"nits_to_fix":0,"human_decision":true,"tradeoff":"does_not_hold","cross_repo":"checked","tests_ok":false}
|
@Vamsi-klu reviewed at b489552 and ran the tests locally (MySQL + ES). Tests
Still open before merge
Not run: Postgres + OpenSearch lane, full |
|
@Vamsi-klu I ran scenario tests on main and on 7cfe7c1 (MySQL + ES): the seeded glossary workflow, glossary and table workflows with other shapes, and the consolidation cases. Edits merged into one version and edits taken back inside a cycle both preview correctly. Three things still need fixing in this PR. 1. Starting from the last
Repro: a glossary workflow whose reject edge sets status Rejected, with no rollback. Task 2 lists edit 1 again, even though it was already rejected. Bot edits also come out differently depending on the workflow, because the result depends on where an Approved status happens to sit:
2. Bot edits stay out of the preview Bot edits skip governance on purpose ( 3. Rollback (pre-existing on main; fix it here so the preview and reject agree) a. Reject does nothing on entities without reviewers (tables).
b. Rejecting an edit on a term that was already Rejected keeps the edit.
c. Rollback wipes bot edits.
Changes needed Preview:
Rollback:
Tests (ITs, MySQL and Postgres):
|
|
@Vamsi-klu thanks for the last round. I checked 5194276 and the branch update on top of it. The behaviour matches the decision records, the ITs pass on MySQL and Postgres, and the live checks for listed triggering bots pass as well. A few things are left. Docs
Gitar finding on prior task ranges Please take a look at the open Gitar finding in #38857 (comment) and fix it if you agree it is relevant. From the code it looks real to me. Screenshots If it is feasible, could you add as many screenshots as you can to the PR description, covering the scenarios this PR changes? For example:
It would make the review much easier. |
|
Thanks, @yan-3005. I updated the workflow builder and both decision records so they describe what rejection restores and which listed bot edits it covers. |
|
@Vamsi-klu thanks for the updates. The docs and the Flowable fallback look good to me. One gentle reminder on the screenshots. When you get a chance, could you add before and after screenshots to the PR description, with main as the before and this branch as the after? Seeing the same scenario side by side would show that the fix works in the product, not only in the tests. The scenarios from my earlier comment are a good list to cover, especially these:
Thanks again. |
|
Thanks for the reminder, @yan-3005. I ran all five scenarios against live builds of |
|
@Vamsi-klu thank you for the screenshots, and for working through all the rounds on this. I know it has been a lot of back and forth. There is one last case I want to raise, and it only affects the incomplete history path. In scenario 5 the description edit is hidden from task 2 because its history row is missing, which is fine with the warning shown. Reading the reject path, though, When the history is incomplete but the base version row is readable, could reject restore the fields that differ between the base and the current version, as main does? One IT that drops a version row in the middle of a cycle, rejects the task, and checks the edit is reverted would cover it. |
|
@Vamsi-klu a quick heads up so we do not both work on the same thing. I will take the last item from my previous comment, the reject path when the cycle history is incomplete, and push it to this branch as a separate commit with tests. Everything else in the PR stays as you have it. If you already started on it, just let me know and I will hold off. |
…d, 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.
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.
…ped 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.
…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.
| passesFilter | ||
| && !Boolean.TRUE.equals( | ||
| execution.getVariable(WorkflowInstanceListener.SUSPENDED_START_VARIABLE)) | ||
| && !WorkflowHandler.stopsNewRuns(mainWorkflowName(execution)); |
There was a problem hiding this comment.
Since the trigger definitions now stay active while the workflow is suspended, activeSignalListeners in WorkflowHandler counts them as live listeners. A change request delivered while the workflow is suspended (or a new revision of it) would be marked delivered, its trigger run would stop here, and the request would stay open with no review task, even after resume. Before, delivery threw and retried until resume. Could activeSignalListeners (and the dispatcher) skip start subscriptions whose main workflow stopsNewRuns, so delivery keeps retrying?
There was a problem hiding this comment.
Right, the change request start lives on the trigger, so with the trigger left active it counted as a listener. takesSignal now treats a start subscription as suspended when the workflow's main definition is suspended. activeSignalListeners uses it, so delivery fails and retries, and the resume requeues it through redeliverStuck. Covered by ChangeRequestResourceIT.aChangeRequestSignalFindsNoListenerWhileItsWorkflowIsSuspended.
| } | ||
| } | ||
|
|
||
| activateTriggers(triggers); |
There was a problem hiding this comment.
With the triggers active, WorkflowSignalDispatcher.deliver no longer skips a suspended workflow, so every matching entity event starts a full trigger process. FilterEntityImpl also loads the entity with all fields before it checks suspension. For soft-deleted workflows this now lasts until a hard delete, so a busy table workflow that was soft-deleted adds one Flowable run per table update. Could the dispatcher skip start subscriptions when the main definition is suspended, with the suspension check moved first in the filter, and could a soft delete with no open runs undeploy as before?
There was a problem hiding this comment.
Fixed with the same check in WorkflowSignalDispatcher.deliver, so a suspended workflow starts no trigger run for entity events. The suspended check is now the first branch in FilterEntityImpl, before any entity read. A soft delete with no open run undeploys as before, and a restore deploys it again (aSoftDeleteWithNoOpenRunUndeploysAndARestoreDeploysAgain). With open runs it still suspends so they can finish.
| .map( | ||
| prior -> | ||
| WorkflowHandler.getInstance() | ||
| .reviewedApprovalRange(prior.getId(), entityId)) |
There was a problem hiding this comment.
A prior task opened by the pre-upgrade server has no approvalCycleReviewedRange, so the new task's cycle starts at its own triggering edit. The earlier edit is then neither previewed nor marked incomplete, and a reject restores Approved with that edit still in place. Could a prior without a recorded range fall back to the predecessor of its run's triggeringVersion (runtime state, not the payload), or at least mark the preview incomplete?
There was a problem hiding this comment.
A prior with no recorded range now falls back to the version before its run's triggeringVersion, read from the run's variables. 2.0 and 2.1 runs carry that variable. ApprovalTaskPreviewIT.aPriorTaskWithoutARecordedRangeStillCarriesItsEditIntoTheNextTask removes the range from the old run and checks the next task still previews the earlier edit. ADR 2026-11-27 is updated to v2, since it had accepted this gap for chains open at upgrade time.
| carryCreationAudit(original, updated); | ||
| updated.setVersion(nextVersion(original.getVersion())); | ||
| updated.setChangeDescription(importChangeDescription(original)); | ||
| updated.setChangeDescription(importChangeDescription(original, updated)); |
There was a problem hiding this comment.
This changes the change description of every batched CSV update, for all entity types, not just the approval preview. List fields without element identity (e.g. columns) come out as a top-level SET of the whole list, while EntityUpdater records columns.<name>.description. That affects version history, alerts, the activity feed and nested include filters. Could this go in its own PR with an ADR and a test on a non-glossary type?
There was a problem hiding this comment.
Agreed, reverted. The batched import change description is back to what main records. The approval cycle now reads an import version's changes against the version before it while walking the history, so the stored row, version history, alerts and the feed are unchanged and the preview still shows the CSV edit (GlossaryCsvImportApprovalPreviewIT, ApprovalCycleHistoryTest.anImportRowIsReadAgainstTheVersionBeforeIt).
| */ | ||
| public static String getMainWorkflowDefinitionNameFromTriggerProcess(String processKey) { | ||
| return getMainWorkflowDefinitionNameFromTrigger( | ||
| processKey.replaceFirst("Trigger-[^-]+$", "Trigger")); |
There was a problem hiding this comment.
Small edge case: a workflow named with Trigger-<x> (e.g. OnTrigger-v2) has trigger key OnTrigger-v2Trigger, which this regex maps to On, so the suspended check is skipped for it. Could we strip only a known entity-type suffix here?
There was a problem hiding this comment.
Fixed. Only a known entity type is stripped as the suffix now. TriggerFactoryTest covers OnTrigger-v2Trigger, its periodic key and xTrigger-tableTrigger.
| patchDescription(glossary.getId(), "second edit while suspended"); | ||
|
|
||
| Awaitility.await("no run recorded while " + workflow.getName() + " is suspended") | ||
| .during(Duration.ofSeconds(10)) |
There was a problem hiding this comment.
This absence check also passes if the event consumer hasn't processed the edits within 10s, which can happen under CI load. Could we add a positive sync point, e.g. resume, make one more edit, wait for its run, and then assert the count is runs + 1?
There was a problem hiding this comment.
Changed. A second active workflow on the same events is the sync point. Each event goes to both, so once it has runs for both edits the suspended one has had them too, and the count is checked after that.
| stopNewRuns(entity); | ||
| } | ||
| GovernanceApprovalRegistry.invalidate(); | ||
| ChangeRequestService.cancelAllForWorkflow( |
There was a problem hiding this comment.
On soft delete this still cancels the workflow's change requests and terminates their review runs, while ADR 2026-12-03 says open runs of a soft-deleted workflow can finish. Could the ADR call out that change-request review runs are the exception?
There was a problem hiding this comment.
Added to the ADR as v3. A soft delete still cancels the workflow's change requests and ends their review runs.
| if (base > FIRST_VERSION_BASE) { | ||
| decision = | ||
| storedVersions.read(current.getId(), base).stream() | ||
| .flatMap(version -> versionsNewerThan(version, FIRST_VERSION_BASE)) |
There was a problem hiding this comment.
A reject walks the history twice: once in undoReviewedChanges and again here back from the base, up to 200 full-row reads each. On wide tables that could make rejection slow. Could the prior decision be recorded next to the ReviewedRange when the cycle opens?
There was a problem hiding this comment.
The two walks read different versions. undoReviewedChanges reads the cycle's own versions after the base. priorDecision reads back from the base and stops at the first recorded decision, which is usually the base itself or a few bot versions before it (priorDecision_readsBackOnlyToTheMostRecentDecision). For comparison, the reject on main lists the whole version history and then reads versions back until it finds the approved one, with no cap, so this already reads less than main. Recording the decision when the cycle opens would run the same walk for every cycle, approved ones included, so it would read more in total. Leaving it as is.
…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.
…ption 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.
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.
Code Review ✅ Approved 🔴 High risk 6 closed / 6 findingsChanging approval-cycle rollback and suspension handling could alter which governed metadata edits survive rejection and whether open reviews finish. Approval task previews now rebuild the proposed changes from version history on every task write, replacing the running merge that carried stale maps forward and missed bot edits outside review. Suspended workflows finish their already-started runs instead of hanging, and CSV imports are previewed and undone on reject. Six issues resolved this session, including failed history reads aborting task creation, inherited owners/reviewers being reported as removed, and manual or periodic runs of suspended workflows. No open findings remain. ✅ 6 closed✅ Bug: Failed history read now aborts approval task creation
✅ Bug: Comparison fallback reports inherited owners/reviewers as removed
✅ Bug: Failed history read leaves a 0..0 range, so reject reverts nothing
✅ Bug: Flowable read failure for a prior task's range still aborts task creation
✅ Bug: Manual run of a suspended workflow is no longer refused
...and 1 more closed from earlier reviews VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Not backported to
|
Describe your changes:
Fixes #35456
The Proposed Changes card on an approval task now lists what the entity changed since its approval cycle began, recomputed from the version history every time the workflow writes the task.
The two exact repros in the issue already pass on main. Three changes fixed them on the way: #35972 strips the workflow's own status move from the preview, #37010 previews the edit that opened the cycle, and #32335 writes workflow fields with optimistic locking, so the status write is stored as its own version and no longer folded into the user's version (that folding is what the metric report on 2.0.5 shows). ITs 1 and 2 below pin both repros so they stay fixed.
What was still wrong is the shape of the preview itself. It was a running merge: each new task copied the map stored on the open task it superseded and added one change read off the entity when the task was created. Nothing ever recomputed it, so three things still went wrong on main:
ITs 4 and 5 reproduce 1 and 2 and fail on main. RED run on the unfixed code:
Behavior after this change:
triggeringBotscounts as reviewed. Fields a trigger excludes appear in the preview, with the workflow status omitted.proposedChangesBaseVersionrecords where the cycle began: the triggering edit's previous version, or the oldest start recorded in the workflow runtime for the open tasks a new task supersedes. No status is read to find it.proposedChangesIncompletemarks failed reads and snapshot fallbacks. The Proposed Changes card and the default task-created notification both warn when the flag is set, even when there are no entries.This supersedes the decision record "An approval preview opens with the edit that started the cycle" and adds a new record, "An approval preview lists the change since its cycle began". The direction still needs agreement from the decider of the record being superseded, who has been working in this same code recently (#38708, and #37901 is still open). The proposal is on the issue; I built the full change anyway so there is something concrete to look at, and I will rework it if the answer is no.
Update in 409374a (pushed by @yan-3005 on top of the work above)
Three fixes were added to this PR so they ship together:
FilterEntityImplandFetchEntitiesImpl. 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. Lifecycle playbooks that suspend a conflicting workflow depend on this. New ADR 2026-12-03-a-suspended-workflow-finishes-the-runs-it-already-started.Follow-up in 253d430
Gitar flagged that
triggerWorkflowskipped the suspend checktriggerByKeyhas. The REST trigger endpoint already refuses a suspended workflow on its stored flag, so it was not reachable through the API, but the handler now refuses it as well, and thetriggerByKeycheck also covers a periodic trigger's per entity type process key. While checking the periodic path, a live run showed that a suspended workflow recorded an empty run for every event it ignored (1 run became 4 after three edits), because the trigger stays active.WorkflowInstanceListenernow records no run for a trigger start while the workflow is suspended; runs started before the suspend are still recorded and closed. ADR 2026-12-03 is updated.Tests: unit 204/204 (
WorkflowHandler*Test,TriggerFactoryTest,FetchEntitiesImplTest,FilterEntityImplTest,CreateTaskTest,TaskWorkflowLifecycleResolverTest); PostgresWorkflowSuspendOpenTasksIT10/10 with three new cases (manual start refused, no run recorded for ignored events, a suspended periodic timer tick starts nothing),ApprovalTaskPreviewIT16/16,WorkflowTriggeringBotsIT8/8, and the 27 suspend, resume, periodic, trigger and terminate methods ofWorkflowDefinitionResourceIT.Then f24341f (Gitar follow-up): a trigger run marked as a suspended start stays stopped in
FetchEntitiesImplandFilterEntityImpleven if the workflow is resumed before those asynchronous steps run, so no unrecorded main run can start. New unit cases inFetchEntitiesImplTestandFilterEntityImplTest; unit 74/74, PostgresWorkflowSuspendOpenTasksIT10/10 andWorkflowTriggeringBotsIT8/8.Review round in 0a95140 (Sonika's review)
aPriorTaskWithoutARangeOrTriggeringEditMarksTheNextPreviewIncomplete,ApprovalTaskPreviewIT18/18 Postgres, unit 3700/3700).OnTrigger-v2keeps its suspend check).WorkflowSignalDispatcherTest,ApprovalCycleHistoryTest,TriggerFactoryTest,CreateTaskTest,FilterEntityImplTestWorkflowSuspendOpenTasksIT(new case: soft delete with no open run undeploys, restore deploys)ApprovalTaskPreviewIT(new case: prior task without a recorded range)ChangeRequestResourceIT(new case: a change request signal finds no listener while suspended)GlossaryCsvImportApprovalPreviewIT,ChangeRequestApplyIT,ChangeRequestImportAndBulkIT,WorkflowTriggeringBotsITWorkflowDefinitionResourceIT(whole class)Playwright on a fresh server built from this commit (chromium, no retries):
GlossaryWorkflow,GlossaryInheritedReviewerApproval,GlossaryTermMoveApproval,WorkflowRunApprovalOutcome,ChangeRequestReviewLifecycle,WorkflowOssRestrictions,TasksUIFlow,GlossaryImportExport49 of 50 in the full run. The one failure,GlossaryWorkflowcascade delete, saw the row in the search backed list after the API already returned 404 while integration tests loaded the same machine; run alone it passed twice.MetricGovernance(Basic project) 7/7.Screenshots for this update (live build at f24341f)
1. Incomplete cycle history. The middle version row of the cycle was deleted, then a synonym was added. The task card still lists the edit behind the gap, with the incomplete history warning:
Rejecting it restores the original description and the term returns to Approved:
2. Open tasks after the workflow is suspended. An open approval task before the suspend:
Approved after the suspend, the edit applies and the term is Approved:
Rejected after the suspend, the edit rolls back:
An edit while the workflow is suspended opens no new task:
3. Reviewer change imported from CSV. The approval task previews the reviewer change (before this change the preview was empty):
Tests for this update
ApprovalCycleHistoryTest,ApprovalGateImportChangeTest,ChangePreviewUtilsTest,CreateTaskTest,FilterEntityImplTest,FetchEntitiesImplTest,TaskWorkflowLifecycleResolverTest)WorkflowSuspendOpenTasksIT(new): fails on main 6 of 7, passes with the fixGlossaryCsvImportApprovalPreviewIT(new): fails on the PR head before this commit, passes with itApprovalTaskPreviewIT,GlossaryTermInheritedReviewerApprovalIT,GlossaryTermMoveApprovalIT,MetricResourceITapproval tests,WorkflowTriggeringBotsITWorkflowDefinitionResourceIT(whole class, 185 tests, covers custom workflows),ChangeRequestApplyIT(12)Playwright on this build (fresh server at 409374a, chromium, no retries):
GlossaryWorkflow10/10,GlossaryImportExport9/9,TasksUIFlow12/12,ChangeRequestReviewLifecycle7/7,WorkflowOssRestrictions4/4,GlossaryInheritedReviewerApproval2/2,WorkflowRunApprovalOutcome2/2,GlossaryTermMoveApproval1/1, andMetricGovernance5/5 (Basic project).Live check on this build: a term edited 250 times by bots after a human edit, so the cycle passes the 200 version cap, previews the edit behind the cap with the incomplete warning, and a reject restores the description and status Approved.
Type of change:
High level design:
New pieces, all in
governance/workflows/utilunless noted:ApprovalCycleHistoryreads the stored versions of the cycle. It starts from a fresh read of the entity and follows each change's recorded previous version, one stored row at a time, and stops at the base. It does not pagelistVersionsWithOffset, which the plan suggested: that query orders rows by their extension name as a string, so once an entity passes version 10.0 a page of "newest" rows starts at 9.9 and a walk that stops at the base would stop too early. Following the recorded previous version is the same link the server already relies on when it consolidates a session (getPreviousVersion). The walk reads up to 200 versions. If a row is missing or the cap prevents reaching the base, it compares the base and current versions when both are available and marks the result incomplete. This keeps the visible edits while warning that nested changes, such as a column's description, can be missing.ApprovalCycle.baseVersiontakes the earliest triggering or carried base, read from workflow runtime state rather than from task payloads.ApprovedBaselinerecords a decision only when a version records the approval or rejection itself, or a reviewer made it, so an inherited Approved status on an entity without reviewers no longer counts.TriggeringChange.baseVersiongives the version the triggering edit was made from.ChangePreviewUtilsgetsfoldChanges,withCyclePreviewandcycleBaseOf.buildProposedChangesPayloadis narrowed to the change request revision, and the old hop logic (pickIncrementalOrFull, the 2 and 4 argument overloads) is gone.preserveProposedChangesbecomespreservePreviewStateand carries the base key too.CreateTaskwires it in: the preview is computed lazily and only for the two approval task types, inside aFreshReadScope, and the prior open approvals are sorted oldest first instead of taking an arbitrary one.Fallbacks for state from before the upgrade:
legacyReviewedRange).Why a stored pointer and not a rule derived from the history alone: some workflows never write Approved (the custom table workflows in the ITs end without a status write), and when the requester's own approval write is consolidated the approval transition disappears from the history.
Alternatives I rejected: fixing which hop the running merge picks (still carries stale maps and still misses edits that started no run), recomputing on every task read (every GET and list would walk history, and notifications carry the stored payload), using snapshot diffs for every task (top-level list changes can hide edits within a column), and a migration to rewrite open tasks.
Rollout:
CreateTasknear the prior task lookup, so whichever lands second will need a rebase.ChangePreviewUtils: the 2 and 4 argumentbuildProposedChangesPayloadoverloads, andpreserveProposedChanges(nowpreservePreviewState). A code search across the open source repository found no other callers; I could not search the Collate repository, so someone with access should check it before merge.Tests:
Use cases covered
Unit tests
ApprovalCycleHistoryTest,ApprovalCycleTest,TriggeringChangeTest.ChangePreviewUtilsTest(fold semantics replace the hop tests),CreateTaskLifecycleMoveTest,CreateTaskTest(oldest first priors).RollbackEntityImplTestis unchanged and passes, which covers the predicate move.ChangePreviewUtilsTest56,CreateTaskTest96,ApprovalCycleHistoryTest10,RdfOntologyContractTest10,RollbackEntityImplTest7,ApprovalCycleTest6,TriggeringChangeTest5,CreateTaskLifecycleMoveTest3,CreateTaskPostCommitPersistTest3).ApprovedBaselinehas no test of its own; it is the predicate moved verbatim and is covered byRollbackEntityImplTestand the baseline cases inApprovalCycleHistoryTest.Backend integration tests
ApprovalTaskPreviewITcovers the nine use cases above.Local results at 5f77e8a, MySQL and Elasticsearch, each lane run the way CI runs it:
ApprovalTaskPreviewIT6 of 6 (including the two that fail on main),GlossaryTermInheritedReviewerApprovalIT7,GlossaryTermMoveApprovalIT5, and the five approval methods ofMetricResourceIT.ChangeRequestApplyIT11, and threeWorkflowDefinitionResourceITmethods: the two existing preview tests (test_approvalPreviewShowsTheChainOfEditsNotTheWorkflowsStatusWrite,test_approvalPreviewShowsTheNetOfEditsTakenBackWithinTheCycle) andtest_tagAnotherChangePublishedLeavesTheRequestAndTheRestStaysUnderReview, which covers the change request preview refresh.Not run locally: the rest of
WorkflowDefinitionResourceITandMetricResourceIT, and the nightly suites the planner lists as impacted but not local.Review follow-up at
7cfe7c130acApprovalTaskPreviewITcases passed against MySQL and Elasticsearch. The new workflow regression checks that the opening preview includes the bot's edit and that rejection restores the approved term. The local retry gave Elasticsearch a longer startup window and limited its JVM to four processors.Ingestion integration tests
Playwright (UI) tests
TaskTabNewJest tests, including a task with only the incomplete flag.Manual testing performed
Ran all five approval and rollback scenarios end to end against live MySQL, Elasticsearch, compiled UI, and local SMTP builds for both
main(df1fdcdc27e) and this branch (28f17d3fe48). Results are captured side by side below.UI screen recording:
Side-by-side screenshots captured against live builds of
main(df1fdcdc27e, Before) and this branch (28f17d3fe48, After) running the same five scenarios end to end against MySQL, Elasticsearch, the compiled UI, and local SMTP delivery.1. Second approval cycle on a glossary term with a stale prior preview
BusinessGlossary.CustomerLTVis approved with"Original definition", updated to"Accepted definition"and approved in cycle 1, then updated to"Edited definition"in cycle 2. After seeding the open task with the stale cycle 1 preview (Original -> Accepted definition) and adding synonymCLV,maincarries the stale description diff forward into the superseding task, while this branch recomputes from version history (Accepted -> Edited definitionplusCLV).mainatdf1fdcdc27e)28f17d3fe48)2. Bot edit outside review (
ingestion-bot), preview and entity after rejectBusinessGlossary.MonthlyActiveUsersis approved with"Original definition".ingestion-bot(not intriggeringBots) updates the description to"Ingested from warehouse pipeline"outside review. A human then adds synonymMAU, opening an approval task, and the reviewer rejects it. Both previews show only the reviewed synonymMAU, while on rejectmainrevertsingestion-bot's description back to"Original definition"and this branch reverts onlyMAUand keeps"Ingested from warehouse pipeline".Task preview:
mainatdf1fdcdc27e)28f17d3fe48)Entity after reject:
mainatdf1fdcdc27e)28f17d3fe48)3. Bot listed in
triggeringBots(catalog-sync-bot), preview and entity after rejectA workflow with
triggeringBots: ["catalog-sync-bot"]governsBusinessGlossary.NetRetentionRate.catalog-sync-botedits the description to"Synced by catalog-sync-bot", opening an approval task, and unlistedingestion-botadds synonymNRRwhile the task is open. The task preview showscatalog-sync-bot's description change (and excludesNRR). On reject,mainreverts the description and also removes unlistedingestion-bot's synonymNRR, while this branch revertscatalog-sync-bot's description and keepsNRR.Task preview:
mainatdf1fdcdc27e)28f17d3fe48)Entity after reject:
mainatdf1fdcdc27e)28f17d3fe48)4. Table workflow with rollback (no entity reviewers)
A table approval workflow with
rollbackEntityTaskand an explicit reviewer governsanalytics_postgres.warehouse.public.customer_orders(which has no entity reviewers). Cycle 1 approves"Approved table description". Cycle 2 edits the description to"Unreviewed draft description"and the reviewer rejects it. Onmain, the table remainsApprovedwith"Unreviewed draft description"left in place; on this branch, rollback restores"Approved table description".mainatdf1fdcdc27e)28f17d3fe48)5. Incomplete history warning on the task card and task-created notification
BusinessGlossary.GrossMarginis approved with"Original definition", edited to"Edited definition"(opening task 1), and its intermediate version row (glossaryTerm.version.0.4) is removed fromentity_extensionbefore adding synonymGM(opening task 2 and dispatching the task-created email notification). Onmain, neither the Proposed Changes card nor the email notification warns about missing history; on this branch, both display the incomplete-history warning above the remaining changes.Task card:
mainatdf1fdcdc27e)28f17d3fe48)Task-created email notification:
mainatdf1fdcdc27e)28f17d3fe48)Checklist:
Fixes #35456: <short explanation>Fixes #35456above.REVIEW.mdand fixed every finding.docs/decisions/and marks the record it supersedes.