Skip to content

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

Merged
Shreyansh100704 merged 6 commits into
mainfrom
fix/redeploy-changed-workflows-on-startup
Nov 23, 2026
Merged

Shreyansh100704 merged 6 commits into
mainfrom
fix/redeploy-changed-workflows-on-startup

Conversation

@Shreyansh100704

@Shreyansh100704 Shreyansh100704 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #38297

A release that changes a stored workflow, or how workflows are built, reached Flowable only through a migration step that deployed it, with the code of whatever release the upgrade ends on. The server now deploys, on every start, each workflow whose BPMN differs from its latest deployment, and the 2.1.1 SuggestionTaskWorkflow step (#38307) only edits its row, so MigrationArchitectureTest lists no exception again.

Type of change:

  • Bug fix

High-level design:

  • Deploy on start (WorkflowHandler.deployChanged, called from WorkflowDefinitionResource.initialize after seed data): for each stored, non-deleted workflow this server can read, build the BPMN with the running code and compare it byte for byte with the latest Flowable deployment of the main and trigger workflow. A workflow that differs, or has none, is deployed; one that matches is not touched. A workflow that cannot be built or deployed is logged at error and keeps its deployment, and the server still starts.
  • No drain on start: like the deploys in migrations, this deploy does not drain old versions (the existing comment in WorkflowHandler notes the drain can take hours on a large Flowable history); the next deploy through the API drains them.
  • Same BPMN in every JVM: NoOpTrigger iterated a Set.of and CollectMetadataTask a Map.of into the BPMN, whose order changes per JVM, so every restart would have redeployed the 15 seeded task workflows. Both now use a fixed order.
  • Unreadable rows: the workflows are read through WorkflowDefinitionRepository.listReadable(), the skip-and-log logic EntityStatusWorkflows already had, moved to the repository and shared. A row this server cannot decode (a node type from another version) is logged by name and skipped, and the others still deploy.
  • 2.1.1 step: SuggestionTaskOwnerFallbackMigration only changes the row; it and the 2.1.1 Migration classes leave the MigrationArchitectureTest exceptions, and the guard checks them.
  • Decision records: adds ADR:2026-11-23-a-changed-workflow-is-deployed-when-the-server-starts; amends ADR:2026-11-11-a-data-migration-carries-its-own-logic (rule 4 names workflow deploys) and ADR:2026-11-20-suggestion-tasks-fall-back-through-every-owner-to-the-admins.
  • Backport: Fixes 38297: Route suggestions on unowned assets through every owner to the admins #38307 is not on 2.1 yet; both go to 2.1 together before 2.1.1.
  • Known, accepted: a workflow saved through the API with a several-key map (for example a trigger filter for several entity types) is deployed once more on the next start, because the database returns the keys in another order; it is left alone after that. Recorded in the ADR.

Tests:

Use cases covered

  • A workflow stored as it was deployed is not deployed again on start.
  • A workflow whose row a migration changed is deployed once on start, and not again on the next.
  • A workflow that cannot be built, or a stored row that cannot be read, does not stop the others from deploying.
  • Every seeded workflow builds the same BPMN from its stored row (MySQL and Postgres reorder JSON keys) and in another JVM.
  • The 2.1.1 step uses only the classes MigrationArchitectureTest allows.

Unit tests

  • WorkflowBpmnStableAcrossJvmsTest (new): builds every seeded workflow, and a collect-metadata task, in two child JVMs and compares the BPMN. Fails with the old Set.of order.
  • WorkflowDefinitionRepositoryReadableTest (new): an unreadable row between two readable ones is skipped. Fails when the skip is removed.
  • MigrationArchitectureTest: no exceptions, no empty-rule allowance. Fails with 5 violations against the old deploying 2.1.1 step.
  • Governance, workflow-definition and migration unit tests: 1110 passed.
  • Coverage: not measured.

Backend integration tests

  • WorkflowStartupDeployIT (new, 4 cases). With the comparison forced to always deploy, the "left alone" and "deployed once" cases fail.

Local Java test run: PASSED (focused, plus a trimmed set of affected ITs)

  • Commit: d3b1323dab5 (base origin/main). After it, 070eeea3281, 901bdfa34ea and 14a8a6d9dae share the readable-rows logic; for those, the unit row above (1110 tests) and WorkflowStartupDeployIT, EntityStatusWorkflowOwnershipIT, LifecycleWorkflowConfigurationIT on mysql-elasticsearch (10 passed) ran again.
Step Scope Tests Failed Skipped Result
unit governance, workflow-definition and migration tests 1110 0 0 passed
unit WorkflowBpmnStableAcrossJvmsTest, NoOpTriggerTest, CollectMetadataTaskTest (3 runs) 5 0 0 passed
integration mysql-elasticsearch · parallel: WorkflowStartupDeployIT, WorkflowRedeploySignalIT, WorkflowSignalDeliveryIT, WorkflowTaskAssigneesIT, NegatedListRuleMigrationIT, SeedDataPresenceIT, IncidentWorkflowUpgradeIT, WorkflowResourceIT, TierCheckConditionWorkflowIT, OpenMetadataOperationsIT, ContinuousMigrationIT, TaskResourceIT, IncidentTaskIntegrationIT 395 0 31 passed
integration mysql-elasticsearch · isolated: WorkflowDefinitionResourceIT, AppsResourceIT, TagRecognizerFeedbackIT 218 0 6 passed
integration postgres-opensearch · parallel: WorkflowStartupDeployIT, NegatedListRuleMigrationIT, SeedDataPresenceIT, ContinuousMigrationIT, OpenMetadataOperationsIT 13 0 0 passed

Skipped: TaskResourceIT's inherited BaseEntityIT checks it turns off for tasks, BaseEntityIT$ListEntityHistoryByTimestampPaginationTest on this engine, and AppsResourceIT's @Disabled cases. Every IT server boot logged Deployed 0 workflow(s). The planner's full list (about 100 ITs) was not run; the merge queue runs it.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

  • Seeded workflows built in four separate JVMs: identical BPMN after the fix; 15 of 19 differed before it.
  • Live upgrade on local Collate (Postgres, 2.1.0 database running pre-Fixes 38297: Route suggestions on unowned assets through every owner to the admins #38307 code, backed up first):
    1. Before: suggestions on an unowned table under an owned service, and in an owned domain, went to every admin.
    2. Migration: the stored TaskReview gained cascadeOwners: true, and Flowable stayed on version 11, so the migration deployed nothing.
    3. First start: SuggestionTaskWorkflow deployed as version 12, with the other workflows whose BPMN this code builds differently.
    4. Same suggestions: the table owner, the service owner, the domain owner, and the admins for the table with no owner anywhere.
    5. Second start: no deployment at all; every workflow built the same BPMN in the new JVM.

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: not applicable, no schema change.

  • 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 e3e4fd82934 and 070eeea3281 (then a decision-record wording commit and a log message): no 🔴. The first pass found the per-JVM BPMN order, fixed in e3e4fd82934. Answered, not changed:
      • The initialize call has no test: only a mocked call-order test could pin it. The IT boots (Deployed 0) and the always-deploy run (it deployed all 20 seeded workflows at boot) show it runs; the live upgrade above checks it end to end.
      • A save with a several-key map deploys once more on the next start: bounded to one version per save, recorded in the ADR.
  • Decision check: adds docs/decisions/2026-11-23-a-changed-workflow-is-deployed-when-the-server-starts.md and amends two records.

  • 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 actionable issues remain.

Summary

Moves changed-workflow deployment from the 2.1.1 migration to server startup.

  • The server deploys workflows at startup when their generated BPMN has changed.
  • The 2.1.1 migration updates suggestion-owner settings without deploying the workflow itself.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Server starts] --> B[Initialize seed data]
  B --> C[Read stored workflows]
  C --> D{Row readable?}
  D -->|No| E[Log and skip]
  D -->|Yes| F[Build BPMN]
  F --> G{Matches latest deployment?}
  G -->|Yes| H[Leave deployment alone]
  G -->|No| I[Deploy without draining old versions]
  F -->|Build fails| J[Log and continue]
  I -->|Deploy fails| J
Loading

Reviews (6) · Last reviewed commit: "fix(governance): log the skipped workflo..." · Reviewed by Greptile

@Shreyansh100704
Shreyansh100704 requested a review from a team as a code owner November 23, 2026 10:46
@Shreyansh100704
Shreyansh100704 requested review from sonika-shah and a balanced review from Copilot November 23, 2026 10:46
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

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

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 23, 2026 11:06

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 23, 2026 11:14

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

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk

Startup now deploys every stored workflow whose BPMN differs, potentially changing future governance approvals and task execution across the deployment.

Moves the 2.1.1 workflow redeploy to server start: stored workflows whose BPMN differs from the latest Flowable deployment are redeployed on each start, and workflow builders now emit a fixed order so BPMN is identical across JVMs. No issues found.

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

@Shreyansh100704
Shreyansh100704 merged commit 3cdf00c into main Nov 23, 2026
64 checks passed
@Shreyansh100704
Shreyansh100704 deleted the fix/redeploy-changed-workflows-on-startup branch November 23, 2026 16:56
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