Skip to content

[2.1] Fixes #38796: Let a workflow list the bots whose changes start it - #39005

Merged
yan-3005 merged 2 commits into
2.1from
backport/2.1/pr-38797
Nov 30, 2026
Merged

yan-3005 merged 2 commits into
2.1from
backport/2.1/pr-38797

Conversation

@gh-bot-collate

Copy link
Copy Markdown

Automated backport of #38797 to 2.1.

Source PR #38797
Author @yan-3005
Merge commit c6ee3a8d2247ab839a31769b92c0f5052ba66604
Method Conflicts resolved by Claude — worth a read of the diff.

Resolution notes

Backport notes: #38797 → 2.1

Conflict

openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/WorkflowDefinitionRepository.java
conflicted only in the import block:

<<<<<<< HEAD
=======
import org.openmetadata.service.governance.workflows.WorkflowTriggeringBots;
import org.openmetadata.service.governance.workflows.elements.triggers.PeriodicBatchEntityTrigger;
>>>>>>> c6ee3a8d22 (...)

The rest of the file's hunks (the new requireNewTriggeringBotsAllowed/triggeringBotsOf helpers,
the prepareForCreate and getUpdater call sites) applied cleanly — the conflict was only in this
import list.

Resolution

Kept only import ...WorkflowTriggeringBots;, the import this PR actually introduces.

Dropped import ...elements.triggers.PeriodicBatchEntityTrigger;. That import, and the
PeriodicBatchEntityTrigger.requireServerTimezone(...) call it supports in prepare(), are an
unrelated, pre-existing main-only feature (periodic-batch-trigger server-timezone validation)
that predates PR #38797 — it's already present in the commit before c6ee3a8 on main. It showed
up in the cherry-pick's diff only as surrounding context, not as part of this PR's change. 2.1 has
no PeriodicBatchEntityTrigger.requireServerTimezone method and no such validation in prepare(),
so adding the import without the feature it supports would be dead/unused and out of scope for this
backport.

What to check by hand

  • Confirm WorkflowTriggeringBots compiles/links against 2.1's BotRepository/user model (the class
    itself came in clean via the cherry-pick as a new file, A in git status — not hand-edited here).
  • Confirm no other file in this cherry-pick references PeriodicBatchEntityTrigger.requireServerTimezone
    or otherwise assumes the periodic-batch-timezone feature is present on 2.1.

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 #38797 is asked to look.

resolver run

…8797)

* Let a workflow list the bots whose changes start it

Since 2.1 a bot's change never starts a governance workflow and is never held for approval. That
keeps ingestion out of review queues, but blocks automation that exists to propose content for
people to review.

An eventBasedEntity trigger now lists, in triggeringBots, the bots whose changes start it:
- WorkflowEventConsumer drops a bot's change before Flowable unless a workflow on the entity type
  lists the bot, and tags the change with the bot (triggeringBot variable).
- FilterEntityImpl starts the run only for the workflows that list that bot.
- ApprovalGate holds a listed bot's edit for the Enforce workflows that list it.
- GovernanceApprovalRegistry's snapshot carries the lists, resolved to the users the bots write as.
- Saving a workflow refuses an unknown bot, a system bot and an application's bot; only newly
  listed bots are checked. governance-bot never starts a workflow.
- Workflow builder: a bot picker on the start node, listing only bots an admin created.

The list is empty by default, so no stored workflow changes behaviour.

* Refuse leftover application bots; show bot display names once loaded

- A bot left behind by an uninstalled application keeps its "<AppName>Bot" name but loses the
  application's link, so it looked admin-created. Saving a workflow now also refuses a bot named
  for a marketplace or installed application, and the Triggering Bots picker hides it.
- The picker kept showing a saved bot's raw name after the bot list loaded: useSyncedListData now
  relabels the selection when its label function changes.

* Document the name-based application-bot rule; fetch app lists in parallel

- The decision record now states how an application's bot is recognised: the installed
  application's link, or its "<application name>Bot" name for an installed or marketplace
  application, and why a leftover bot of an uninstalled application must be refused too.
- The Triggering Bots picker fetches installed and marketplace applications concurrently.

* Name the change's bot changedByBot; test a workflow listing two bots

- A workflow lists several bots; a change has one author. The process variable that carries that
  author is now changedByBot (was triggeringBot), and the comments say so.
- WorkflowTriggeringBotsIT: one Enforce workflow listing two bots holds both bots' edits as
  separate change requests.

* Refresh listed bots when bots change; never gate workflow automation; cover the create flow

- The registry snapshot's epoch now also fingerprints bot_entity, so a listed bot deleted and
  recreated with another bot user (or reassigned) is resolved again within the 5-second recheck,
  instead of only after a workflow definition is written.
- ApprovalGate.rulesForActor returns no rules for workflow automation (governance-bot, or a user it
  impersonates), as the consumer already does, whatever a bot list holds.
- Unit tests for the registry's bot lists (listing, suspended, Enforce, deleted bot, epoch), the
  trigger filter's bot check, and gate admission for listed bots and workflow automation.
- IT for the flow the feature exists for: a bot listed on the seeded glossary term approval
  workflow creates a term, which goes to review; the asset link it adds is held and released when
  the term is approved.

* Test workflow automation writing for a listed bot; merge the picker's fetch wrappers

Covers the exact case from review: a listed bot impersonated by governance-bot is never held by the approval gate. The picker's two swallow-and-return-empty fetch helpers become one generic fetchAllPagesOrEmpty.

(cherry picked from commit c6ee3a8)
@gh-bot-collate
gh-bot-collate Bot requested review from a team as code owners November 27, 2026 13:50
@gh-bot-collate
gh-bot-collate Bot requested review from yan-3005 and removed request for a team November 27, 2026 13:50
@gh-bot-collate
gh-bot-collate Bot requested review from sweta1308 and removed request for a team November 27, 2026 13:50
@gh-bot-collate gh-bot-collate Bot added the safe to test Add this label to run secure Github workflows on PRs label Nov 27, 2026
@gh-bot-collate

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.

The approval registry snapshot now fingerprints bot_entity, so repository tests that build a partial schema need the table or every governed write reports the approval rules as unavailable.
@yan-3005
yan-3005 merged commit a11fd64 into 2.1 Nov 30, 2026
53 of 55 checks passed
@yan-3005
yan-3005 deleted the backport/2.1/pr-38797 branch November 30, 2026 08:18
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.

2 participants