Repository navigation
Discover workflow node factories from the classpath so migrate builds distribution nodes - #38133
Conversation
NodeFactoryRegistry registers the factories of every NodeFactoryProvider listed in META-INF/services when it is first used. A process that never runs the server's startup, such as migrate, then builds the nodes a distribution implements, so a migration that redeploys workflows covers them too.
❌ 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 |
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findingsClasspath discovery enables migration-time deployment of distribution-specific workflow nodes, potentially changing which governance workflows execute and what actions they perform. Adds a ✅ 1 closed✅ Quality: Discovery error cap of 100 is a judgment-call limit not in the ADR
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 |
NodeFactoryRegistry registers the factories of every NodeFactoryProvider listed in META-INF/services when it is first used, so migrate builds the nodes a distribution implements and a migration that redeploys workflows covers them. Discovery skips a provider it cannot load or ask, and logs when it stops at its error cap.
NodeFactoryRegistry registers the factories of every NodeFactoryProvider listed in META-INF/services when it is first used, so migrate builds the nodes a distribution implements and a migration that redeploys workflows covers them. Discovery skips a provider it cannot load or ask, and logs when it stops at its error cap.
Describe your changes:
Some workflow node subtypes are defined in the OpenMetadata schema but implemented by a distribution (
policyAgentTaskandcreateAndRunAIAutomationTaskin Collate).NodeFactorybuilds them throughNodeFactoryRegistry, which the distribution filled from its server startup.migrateruns in its own process and never runs that startup, so any migration that builds a workflow could not build those nodes. The 2.0.8 governance workflow redeploy (#36979, #36987) loggedRedeployed 24 of 26on Collate clusters:AutoPilotWorkflowandDataAccessRequestTaskWorkflowfailed with... is a Collate-only feature — handler not registered.This PR lets the registry discover its factories from the classpath:
NodeFactoryProviderSPI: a distribution returns itsNodeSubType → NodeFactoryExtensionfactories and lists the provider inMETA-INF/services/org.openmetadata.service.governance.workflows.elements.NodeFactoryProvider.NodeFactoryRegistryregisters every listed provider when the singleton is created, so the server,migrateand any other entry point build those nodes. A provider that cannot be loaded, created or asked is logged and skipped (the same defensive loop asDataRetentionExtensionRegistry), so a broken provider never stops the built-in nodes from building.registerstays public; existing explicit callers keep working.docs/decisions/2026-11-18-workflow-node-factories-are-discovered-from-the-classpath.md.With this, a migration in OpenMetadata that redeploys workflows also builds the distribution's nodes, with no matching migration in the distribution. Sink providers (
SinkProviderRegistry) are out of scope: they are still registered at server startup, and the decision record states what that leaves undermigrate.Companion Collate PR (registers its provider): open-metadata/openmetadata-collate#8691
Type of change:
High-level design:
N/A — small change (one SPI interface, registry discovery, test, decision record).
Tests:
Use cases covered
META-INF/serviceshas its factories registered and builds its node.migratethat redeploys every governance workflow builds the Collate ones (below).Unit tests
NodeFactoryRegistryTest: two new tests drivediscover(ClassLoader)with a temporaryMETA-INF/serviceslisting (a provider that registers, a missing class, a provider that throws).Backend integration tests
Local Java test run: PASSED
95e051636c54(baseorigin/main)--scope full).Also run locally:
NodeFactoryRegistryTest,NodeFactoryTest,NodeFactoryAIAutomationTest—Tests run: 12, Failures: 0, Errors: 0. Broader affected coverage (--scope full) is pending.Ingestion integration tests
Playwright (UI) tests
Visual regression baselines
Manual testing performed
End-to-end
migratewith this branch and the companion Collate branch, on a fresh MySQL database:OpenMetadataOperations migrateandCollateOperations migrate(both rc=0) → startedCollateApplicationonce to seed the governance workflows (23, includingAutoPilotWorkflowandDataAccessRequestTaskWorkflow) → stopped it.redeployGovernanceWorkflowsForTriggeringVersionmarker, so the 2.0.8 redeploy step runs again as it does when upgrading from 2.0.7 or earlier.OpenMetadataOperations migratewith a copy of the Collate jar whose provider listing was deleted:[v208] Redeployed 21 of 23 governance workflow definition(s), withcreateAndRunAIAutomationTask is a Collate-only feature — handler not registeredandpolicyAgentTask is a Collate-only feature — handler not registered.OpenMetadataOperations migratewith the real jar:Registering workflow node factories from io.collate.governance.workflows.CollateWorkflowNodeProvider→[v208] Redeployed 23 of 23 governance workflow definition(s), no errors.Not run: PostgreSQL (the change is database-independent), and an upgrade from a real 2.0.7 database (step 2 simulates it for this step).
UI screen recording:
Not applicable — backend-only change.
Checklist:
REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.Self-review of
95e051636c5(fresh-context subagent): one 🔴 — the decision record claimed OpenMetadata migrations fully cover the distribution's workflows, whileSinkProviderRegistryis still empty undermigrate; fixed inb06ef33ccccby narrowing the record to node factories and stating the sink gap (prose only, tests unaffected). 🟡 answered: the singleton wiring (INSTANCE = discover(...)) has no OSS test because OSS ships no provider; the Collate PR'sCollateWorkflowNodeProviderTestexercises it throughnew Workflow(...)in a fresh JVM.docs/decisions/2026-11-18-workflow-node-factories-are-discovered-from-the-classpath.md.

Confidence Score: 5/5
The follow-up appears safe to merge.Summary
Workflow node factories are discovered from the classpath so migrations can build nodes supplied by a distribution without server startup.
Reviews (3) · Last reviewed commit: "Close the test class loaders in NodeFact..." · Reviewed by Greptile