Skip to content

fix(workflows): backport Git sink batch recovery and workflow fixes to 2.0 - #35239

Merged
yan-3005 merged 2 commits into
2.0from
fix/git-sink-hardening-2.0
Oct 13, 2026
Merged

yan-3005 merged 2 commits into
2.0from
fix/git-sink-hardening-2.0

Conversation

@yan-3005

Copy link
Copy Markdown
Contributor

Describe your changes:

Backport of #34373 to 2.0, without its throughput changes. Fixes periodic batch workflows with a sink node on 2.0: sink failures reported as success, instances left RUNNING after a server crash with no way to clear them, and batches that acted on their first entity only.

  • Failure status. A sink failure that no failure branch handles is recorded on the trigger process, so the instance ends FAILURE instead of FINISHED.
  • Terminate endpoint. POST /v1/governance/workflowInstances/{id}/terminate?reason= (admin only) clears an instance and its Flowable rows, including one whose job locks a crashed server still holds. For an executing job it records a stop request (202); the sink stops before its next sub-batch and the periodic fetch loop stops fetching. Open workflow-managed tasks of the instance are closed once the process is deleted.
  • Batch size. One batch-sink execution handles at most 5000 entities.
  • Batch workflows per entity. Condition nodes evaluate every entity of the batch and pass on the matching ones; action nodes (set attribute, certification, glossary term status, rollback) apply to every entity, one after another. Batch-sink workflows with nodes that can't run per batch are refused on save.
  • No queries in Git sinks. Saving a Git-sink workflow whose trigger lists query returns 400; Git-sink workflows are deployed without a query trigger; the workflow builder leaves query out of the entity types.
  • Sink secrets. Masked in REST and MCP workflow responses and change events; encrypted at rest when a Fernet key is configured. Sending the same plaintext again keeps the stored ciphertext.
  • Smaller fixes. Updates and redeploys keep a suspended workflow suspended; the sink form keeps the config fields it doesn't render (batchMode, retryConfig, ...); a sink write that throws fails only its entity; skipped counts reach the node outputs and summary.

Not in this backport: sub-batch prefetching, SinkProvider.nextBatchSize() / finishBatch(), the parallel batch-node pool, and the commit signing key / unsigned fast push settings. Sub-batches are fetched and written one after another, 100 entities each, as on 2.0 today.

Migration. None in OSS. The 2.0.6 sink workflow migration (encrypting stored secrets, redeploying sink workflows, removing query from Git-sink triggers) runs from Collate, which ships the Git sink.

Type of change:

  • Bug fix

Testing:

Run locally on this branch:

  • Unit: openmetadata-service governance, secrets, workflow repositories and JSON patch tests Tests run: 715, Failures: 0, Errors: 0; MCP tools Tests run: 292, Failures: 0, Errors: 0.
  • Integration: the 18 new WorkflowDefinitionResourceIT tests (sink failure status, terminate, batch per entity, Git-sink query rule, secret masking and encryption, suspended kept) — MySQL + Elasticsearch 18/0, PostgreSQL + OpenSearch 18/0.
  • UI: Jest for the workflow builder, config utils and validation service 92 passed.
  • Playwright against a 2.0 server: GitSinkTokenMask, NoOpWorkflowNodeConfig, WorkflowExecutionHistoryEntity, WorkflowOssRestrictions, TaskCustomFormWorkflow — 34 passed.

Known limits

  • New deployments inject failureHandledByBranchExpr, batchExecutionExpr and batchContinuingOutcomeExpr; older executors reject fields they don't declare. Drain jobs and stop older executors before deploying upgraded definitions.
  • Terminate can't tell a dead executor from a live one holding the lock: a live non-batch job can still apply side effects after a 200.
  • After a stop the sink reports failure, so a workflow that routes failure to further nodes runs them.

Checklist:

  • I have read the CONTRIBUTING document.
  • I have commented on my code, particularly in hard-to-understand areas.

🤖 Generated with Claude Code

…ing to 2.0

Backport of #34373 to 2.0, without its throughput changes.

- A sink failure no failure branch handles ends the instance FAILURE instead
  of FINISHED.
- POST /v1/governance/workflowInstances/{id}/terminate clears an instance and
  its Flowable rows, including one whose locks a crashed server still holds;
  for an executing job it records a stop request, honoured between sink
  sub-batches and by the periodic fetch loop.
- One batch-sink execution handles at most 5000 entities.
- Batch workflows evaluate conditions and apply actions to every entity of the
  batch, one entity after another; unsupported batch shapes are refused on save.
- Git-sink workflows refuse query in their trigger on save, are deployed
  without it, and the builder leaves query out of the entity types.
- Sink secrets are masked in REST and MCP responses and encrypted at rest when
  a Fernet key is configured.
- Updates and redeploys keep a suspended workflow suspended; the sink form keeps
  the config fields it does not render; skipped counts reach the run summary.

Left out: sub-batch prefetching, provider batch sizing and finishBatch, the
parallel batch-node pool, and the commit signing key / fast push settings.
@yan-3005
yan-3005 requested review from a team as code owners October 12, 2026 08:33
@yan-3005 yan-3005 added safe to test Add this label to run secure Github workflows on PRs backend skip-pr-checks Bypass PR metadata validation check labels Oct 12, 2026
@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.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 566 → 567
- 1 added, 0 removed, 7 changed spec-list

New source→spec entries:
  openmetadata-ui/src/main/resources/ui/src/components/WorkflowDefinitions/WorkflowBuilder/forms/SinkTaskForm.tsx

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/src/components/WorkflowDefinitions/WorkflowBuilder/CustomControls.tsx
  openmetadata-ui/src/main/resources/ui/src/components/WorkflowDefinitions/WorkflowBuilder/NodeConfigSidebar.tsx
  openmetadata-ui/src/main/resources/ui/src/components/WorkflowDefinitions/WorkflowBuilder/NodeFormSidebar.tsx
  openmetadata-ui/src/main/resources/ui/src/components/WorkflowDefinitions/WorkflowBuilder/WorkflowControls.tsx
  openmetadata-ui/src/main/resources/ui/src/components/WorkflowDefinitions/WorkflowBuilder/WorkflowHeader.tsx
  openmetadata-ui/src/main/resources/ui/src/components/WorkflowDefinitions/WorkflowBuilder/forms/FormActionButtons.tsx
  openmetadata-ui/src/main/resources/ui/src/generated/entity/data/table.ts

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

@pmbrull
pmbrull requested review from a team, akash-jain-10, harshach and tutte as code owners October 12, 2026 08:34
@gitar-bot

gitar-bot Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · Batch workflows now apply metadata actions to up to 5,000 entities per run, so a misconfigured workflow could alter many records.

Backports Git sink batch recovery and sink secret masking to 2.0, fixing sink failures reported as success, stuck RUNNING instances via a new terminate endpoint, per-entity batch handling, Git-sink query trigger rejection, and masking of sink secrets. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

Options

Display: compact → Counting what did not apply, without listing it.

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

@github-actions

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 68%
68.07% (82512/121204) 52.91% (51015/96411) 53.65% (15168/28272)

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@yan-3005 yan-3005 changed the title fix(workflows): backport Git sink batch recovery and sink secret masking to 2.0 fix(workflows): backport Git sink batch recovery and workflow fixes to 2.0 Oct 12, 2026
@yan-3005
yan-3005 merged commit 26d9949 into 2.0 Oct 13, 2026
76 of 78 checks passed
@yan-3005
yan-3005 deleted the fix/git-sink-hardening-2.0 branch October 13, 2026 06:49
mohityadav766 added a commit that referenced this pull request Oct 13, 2026
#35239 brought this test to 2.0 while this branch made SetGlossaryTermStatusImpl
patch impersonating governance-bot, so the test still expected the plain
four-argument patch. It now checks the same call main's copy of the test does.
mohityadav766 added a commit that referenced this pull request Oct 13, 2026
…ted failures logged as errors [2.0] (#35302)

* Fixes #35037: reject negative search pagination before it reaches the engine [2.0]

Backport of #35039 and #35040. A negative from or size on the search
endpoints is rejected with a 400 that names the parameter instead of failing
in the search engine as a 500, and the UI no longer sends a negative offset.

SearchResourceIT conflicted: 2.0 has neither the httpGetSearch helper nor the
400 mapping the old negative-offset test expected, so the new tests and
helpers were added by hand.

(cherry picked from commit 893cd1b)
(cherry picked from commit e3914c5)

* Fixes #35293: serve glossary CSV documentation for glossary-term import [2.0]

The bulk import page asks /v1/csv/documentation/{entityType} for the type it
imports into. For a glossary term that is glossaryTerm, which has no
documentation file, so every request returned a 500 and was logged twice at
ERROR. Glossary-term import already goes through GlossaryCsv, so glossaryTerm
now gets the glossary's documentation. A type with no documentation returns a
404, and the FATAL log before the rethrow is gone.

* Apply a workflow approval when the approver is not a reviewer [2.0]

Anyone the task policy lets resolve an approval task, such as an admin or an
owner, could approve a glossary term without being one of its reviewers. The
workflow then set the status as that user, the reviewer check rejected it, and
the failure was only logged: the task closed as Approved while the term stayed
In Review.

As on main since #34541, a status change the governance workflow makes, as or
impersonating governance-bot, skips the reviewer check: the approval task
already decided who may approve. Direct edits are still checked.
SetGlossaryTermStatusImpl now writes impersonating governance-bot like the
other workflow nodes, so its changes are recognised too.

* Skip deleted alert recipients without logging an error [2.0]

An alert can name a user or team that is deleted later. Every event for that
alert logged the lookup failure at ERROR with a stack trace, although there is
simply no one left to notify. A missing recipient is now skipped at DEBUG, as
main does since #33967; any other lookup failure is still logged as an error.

* Mock the 2.0 API client in the backported pagination test

The pagination tests from #35040 mock ./axiosClient, which only exists on
main. On 2.0 searchAPI imports its client from ./index, so the mock could not
resolve and all 12 new cases failed. Mock ./index like the rest of the file.

* Verify the impersonated status patch in BatchModeNodesTest

#35239 brought this test to 2.0 while this branch made SetGlossaryTermStatusImpl
patch impersonating governance-bot, so the test still expected the plain
four-argument patch. It now checks the same call main's copy of the test does.
@yan-3005 yan-3005 self-assigned this Nov 19, 2026

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants