Skip to content

Discover workflow node factories from the classpath so migrate builds distribution nodes - #38133

Merged
yan-3005 merged 3 commits into
mainfrom
fix/discover-workflow-node-factories
Nov 18, 2026
Merged

yan-3005 merged 3 commits into
mainfrom
fix/discover-workflow-node-factories

Conversation

@yan-3005

@yan-3005 yan-3005 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Some workflow node subtypes are defined in the OpenMetadata schema but implemented by a distribution (policyAgentTask and createAndRunAIAutomationTask in Collate). NodeFactory builds them through NodeFactoryRegistry, which the distribution filled from its server startup. migrate runs 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) logged Redeployed 24 of 26 on Collate clusters: AutoPilotWorkflow and DataAccessRequestTaskWorkflow failed with ... is a Collate-only feature — handler not registered.

This PR lets the registry discover its factories from the classpath:

  • New NodeFactoryProvider SPI: a distribution returns its NodeSubType → NodeFactoryExtension factories and lists the provider in META-INF/services/org.openmetadata.service.governance.workflows.elements.NodeFactoryProvider.
  • NodeFactoryRegistry registers every listed provider when the singleton is created, so the server, migrate and any other entry point build those nodes. A provider that cannot be loaded, created or asked is logged and skipped (the same defensive loop as DataRetentionExtensionRegistry), so a broken provider never stops the built-in nodes from building.
  • register stays public; existing explicit callers keep working.
  • Decision record: 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 under migrate.

Companion Collate PR (registers its provider): open-metadata/openmetadata-collate#8691

Type of change:

  • Improvement

High-level design:

N/A — small change (one SPI interface, registry discovery, test, decision record).

Tests:

Use cases covered

  • A provider listed in META-INF/services has its factories registered and builds its node.
  • A listing that names a missing class, or a provider that throws while returning its factories, is skipped; the remaining providers still register.
  • End to end with Collate, a migrate that redeploys every governance workflow builds the Collate ones (below).

Unit tests

  • NodeFactoryRegistryTest: two new tests drive discover(ClassLoader) with a temporary META-INF/services listing (a provider that registers, a missing class, a provider that throws).

Backend integration tests

  • Not applicable (no backend API changes).

Local Java test run: PASSED

  • Commit: 95e051636c54 (base origin/main)
  • Finished: 2026-11-18 14:18 UTC · 1.5 min
  • Scope: focused; merge readiness is not established. Broader steps deferred: 5 (run --scope full).
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (1 class) 1 6 0 0 1.5 passed

Also run locally: NodeFactoryRegistryTest, NodeFactoryTest, NodeFactoryAIAutomationTest — Tests run: 12, Failures: 0, Errors: 0. Broader affected coverage (--scope full) is pending.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Visual regression baselines

  • Not applicable (no rendering change).

Manual testing performed

End-to-end migrate with this branch and the companion Collate branch, on a fresh MySQL database:

  1. Fresh database → OpenMetadataOperations migrate and CollateOperations migrate (both rc=0) → started CollateApplication once to seed the governance workflows (23, including AutoPilotWorkflow and DataAccessRequestTaskWorkflow) → stopped it.
  2. Removed the 2.0.8 change-log row, its data-migration identity and the redeployGovernanceWorkflowsForTriggeringVersion marker, so the 2.0.8 redeploy step runs again as it does when upgrading from 2.0.7 or earlier.
  3. Control — OpenMetadataOperations migrate with a copy of the Collate jar whose provider listing was deleted: [v208] Redeployed 21 of 23 governance workflow definition(s), with createAndRunAIAutomationTask is a Collate-only feature — handler not registered and policyAgentTask is a Collate-only feature — handler not registered.
  4. Repeated step 2, then OpenMetadataOperations migrate with 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:

  • I have read the CONTRIBUTING document.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill 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, while SinkProviderRegistry is still empty under migrate; fixed in b06ef33cccc by 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's CollateWorkflowNodeProviderTest exercises it through new Workflow(...) in a fresh JVM.
  • Decision check: adds docs/decisions/2026-11-18-workflow-node-factories-are-discovered-from-the-classpath.md.
  • I have added tests around the new logic.

RetriggerView in GreptileConfidence 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.

  • Workflow builds find distribution node factories from the classpath.

Reviews (3) · Last reviewed commit: "Close the test class loaders in NodeFact..." · Reviewed by Greptile

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.
@yan-3005
yan-3005 requested a review from a team as a code owner November 18, 2026 14:24
@yan-3005
yan-3005 requested review from pmbrull and a balanced review from Copilot November 18, 2026 14:24
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

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 18, 2026 14:32

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 18, 2026 14:40

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

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 1 closed / 1 findings

Classpath discovery enables migration-time deployment of distribution-specific workflow nodes, potentially changing which governance workflows execute and what actions they perform.

Adds a NodeFactoryProvider SPI so NodeFactoryRegistry discovers distribution workflow node factories from the classpath, letting migrate build Collate-only nodes during governance workflow redeploys. Addressed the discovery error cap, which was not documented in the decision record. No issues found.

✅ 1 closed
✅ Quality: Discovery error cap of 100 is a judgment-call limit not in the ADR

📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/NodeFactoryRegistry.java:40-44 📄 openmetadata-service/src/main/java/org/openmetadata/service/governance/workflows/elements/NodeFactoryRegistry.java:66-78 📄 docs/decisions/2026-11-18-workflow-node-factories-are-discovered-from-the-classpath.md:30-35
MAX_DISCOVERY_ERRORS = 100 sets a new limit on how many malformed ServiceLoader registrations discovery walks past before it stops. Any provider listed after that point is dropped without a dedicated warning. The value was a judgment call, but the ADR added in this PR (docs/decisions/2026-11-18-workflow-node-factories-are-discovered-from-the-classpath.md) only says that a broken provider "is logged and skipped". It never mentions that skipping is capped, at what count, or why. The repository's decision-record rules require new caps to be recorded. Add a bullet to the ADR's Decision section, for example: "Discovery stops after 100 provider errors, because ServiceLoader's iterator does not guarantee it advances past a failure; providers listed after that are not registered, and the stop is logged." Also log a distinct error when the cap is reached, so a truncated discovery is not silent.

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

@yan-3005 yan-3005 added the skip-pr-checks Bypass PR metadata validation check label Nov 18, 2026
@yan-3005
yan-3005 merged commit e714413 into main Nov 18, 2026
56 of 59 checks passed
@yan-3005
yan-3005 deleted the fix/discover-workflow-node-factories branch November 18, 2026 16:07
yan-3005 added a commit that referenced this pull request Nov 18, 2026
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.
yan-3005 added a commit that referenced this pull request Nov 18, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants