Skip to content

Fix governance AUT failures: slow workflow cancel on hard delete, stale glossary and ontology specs - #37337

Merged
anuj-kumary merged 4 commits into
mainfrom
anuj-kumary/governance-failure-fix
Nov 9, 2026
Merged

anuj-kumary merged 4 commits into
mainfrom
anuj-kumary/governance-failure-fix

Conversation

@anuj-kumary

@anuj-kumary anuj-kumary commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes the governance failures in nightly AUT run 42312928697 (build om-ef95276e, current main): OntologyLargeGraph.spec.ts, OntologyConceptDrawer.spec.ts, Pages/Glossary.spec.ts and nightly/LargeGlossaryPerformance.spec.ts.

Each failure was reproduced locally before it was fixed.

1. OntologyLargeGraph: 10 Postgres tests and 2 MySQL tests failed on every retry (backend fix)

The fixture cleanup DELETE /ontologies/{id}?recursive=true&hardDelete=true timed out at 90 s. The server's slow-request log for that DELETE:

total: 96907ms, db: 388ms ... phaseExclusive: {bulkHardDeleteWorkflows: 96118ms, resourceDelete: 670ms, ...}

The rows were deleted in 0.6 s. The other 96 s went to WorkflowHandler.cancelInstancesForEntities, which finds running Flowable instances with or().variableValueEquals(...), 100 ids at a time.

  • Flowable emits one EXISTS per id.
  • Postgres plans each one as a hashed subplan over all of ACT_RU_VARIABLE, so one batch means 100 full scans.
  • The AUT database holds thousands of running approval workflows. A 400-concept ontology (801 ids) took about 97 s.

Reproduction: throwaway databases seeded with 10k running instances × 25 variables, one batch of 100 ids:

Postgres 16 MySQL 8
Flowable OR-of-EXISTS query 15,358 ms 18,423 ms
Native IN query (this PR) 9 ms 54 ms

Fix: cancelInstancesForEntities now runs one native IN query per batch, still behind the same count() == 0 short-circuit.

2. LargeGlossaryPerformance: 2 tests failed (expected 50 rows, got 15)

#35288 changed the glossary terms page size from 50 to 15. Search results are now also capped at 15, so after clearing the search a stale result and the full list both show 15 rows. The test now waits for a listed term that the search did not match, instead of counting rows.

3. Glossary.spec "Update Glossary and Glossary Term": strict-mode violation

#37179 made the glossary title an <h2>, so the bare getByRole('heading') in assignTagToGlossaryTerm matched two elements. The helper now looks the heading up by its name, as GlossaryAdvancedOperations.spec already does.

4. OntologyConceptDrawer

  • "guards unsaved text" failed on every retry. The spec expects "Unsaved changes", but Collate overrides label.unsaved-changes as "Unsaved Changes", and the AUT runs the Collate UI. The spec now matches the text case-insensitively.
  • "Add concept in All ontologies" was flaky. The failed attempt's trace shows the cause:
    • The drawer preselected the first ontology in the global list, pw_concept_drawer_361ac5c8, which belonged to another worker.
    • That worker hard-deleted it 300 ms later, so /ontologyConcepts?ontology=… returned 404 and the drawer stayed on <Loader />.
    • The test now preselects its own ontology.
    • Follow-up, not in this PR: the drawer should show an error instead of spinning forever when its model fetch 404s.

5. EntityHardDeletionAtomicityIT bulk-path cases, already failing on main (test helper fix)

incidentAndResultCleanupFollowsSuccessfulDeletion[6]/[8] and rowDeleteFailureRollsBackAllDependentMetadata[2] fail on a clean origin/main (ef95276e73e) too.

  • Ontology Studio: complete the v7 prototype flows #36868 added a MySQL index hint to EntityDAO.deleteByIds, so the bulk row delete now renders as DELETE /*+ INDEX(chart_entity PRIMARY) */ FROM chart_entity WHERE id IN (…).
  • SqlFailureProbe looks for the fragment "delete from chart_entity" (or "delete from test_case"). The hint sits between DELETE and FROM, so the probe never fired and the tests saw no exception.
  • Fix: SqlFailureProbe and SqlQueryCounter now match against the SQL with block comments removed and whitespace collapsed. That fixes every caller in one place.

Type of change:

  • Bug fix

High-level design:

N/A — one targeted backend query change, three spec fixes and an IT-helper matching fix.

Tests:

Use cases covered

  • Hard-deleting an entity cancels exactly the Flowable instances whose global_relatedEntityId is in the deleted set, and leaves other instances running.
  • Hard-deleting a 400-concept ontology no longer blocks on the workflow-cancel lookup.
  • The glossary terms tab pages at 15 rows, and clearing a search brings the unfiltered list back.
  • Tagging a glossary term through the confirmation modal works with the <h2> page title.
  • The ontology concept drawer's unsaved-changes guard works with either label casing.
  • A hard delete that fails part-way through the bulk path rolls back every row and all dependent metadata. This is now actually exercised again, because the probe fires.

Unit tests

  • SqlFailureProbeTest#matchesAStatementWhoseOptimizerHintSplitsTheFragment and SqlQueryCounterTest#countsAStatementWhoseOptimizerHintSplitsTheFragment (new): a hinted DELETE matches its fragment.
  • The WorkflowHandler change is a native SQL query, which only an IT against a real database can check (below).

Backend integration tests

  • EntityHardDeletionAtomicityIT#bulkCancellationEndsOnlyTheDeletedEntitiesWorkflows (new): starts three instances, cancels two entities in one call, and asserts that only the bystander is still running. It catches a wrong IN list or a predicate that cancels too much.
  • EntityHardDeletionAtomicityIT#workflowCancellationWaitsForTheEnclosingCommit (existing) runs the single and bulk hard-delete paths through the new query.
  • EntityHardDeletionAtomicityIT passes in full on both engines at fba6b6945f5 (latest main merged in): 19/19 on MySQL + ES and 19/19 on Postgres + OpenSearch. Before the probe fix the three bulk-path cases failed, the same as on main.
  • Every IT class that uses SqlFailureProbe or SqlQueryCounter was also run, to check that the broader matching changes no other count or injection. Results are in the block below.
  • CredentialAuthBenchIT also uses the counter, but it is @Tag("scale") and runs only in the nightly scale-it job.

Local Java test run: PASSED

  • Commit: fba6b6945f57 (base origin/main)
  • Finished: 2026-11-07 07:08 UTC · 10.0 min
  • Scope: focused; merge readiness is not established. Broader steps deferred: 6 (run --scope full).
Step Scope Classes Tests Failed Skipped Min Result
integration mysql-elasticsearch · parallel 15 132 0 0 6.2 passed
integration cache-tests · isolated 1 4 0 0 3.8 passed
  • Impacted, not run locally: 1 class (listed in the details)
  • Details

Ingestion integration tests

Not applicable: no ingestion changes.

Playwright (UI) tests

Specs run locally: this branch's UI served by Vite against a local Collate server, with retries: 0.

Spec Original spec This PR
nightly/LargeGlossaryPerformance › pagination ✘ Expected: 50 Received: 15 ✓
nightly/LargeGlossaryPerformance › search and filter ✘ Expected: >= 50 Received: 15 ✓
nightly/LargeGlossaryPerformance › child term pagination — ✓
Pages/Glossary › Update Glossary and Glossary Term ✘ strict mode violation, getByRole('heading') ✓
Features/OntologyConceptDrawer › guards unsaved text (classic, ai), Collate label applied locally ✘ Expected "Unsaved changes" Received "Unsaved Changes" ✓
Features/OntologyConceptDrawer › guards unsaved text (classic, ai), OSS label ✓ ✓
Features/OntologyConceptDrawer › Add concept in All ontologies (classic, ai) — ✓
Temporary spec: the first ontology is deleted, then Add concept is clicked ✘ panel never renders (same as AUT) ✓ with the preselect
  • Pages/Glossary "Update Glossary and Glossary Term" is the only caller of the changed assignTagToGlossaryTerm helper.
  • The impact map also selects about 55 glossary, workflow and search specs because utils/glossary.ts changed. I didn't run those locally; the merge queue runs the full suite.
  • OntologyLargeGraph wasn't run end to end, because that needs a server built from this branch. The SQL reproduction and the ITs above cover the backend change.

Manual testing performed

  1. Pulled the S3 HTML report for both DB lanes of run 42312928697 and grouped the failures by error, page snapshot and trace.
  2. Matched the ontology DELETE timeout to the bulkHardDeleteWorkflows phase in the server's slow-request log, then reproduced the query cost in Postgres 16 and MySQL 8 containers (table above).
  3. Ran the original specs against a local Collate server with this branch's UI and got the same errors as the AUT, then ran the fixed specs (table above).

UI screen recording:

Not applicable: a backend query fix plus Playwright spec fixes, with no product UI change.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>. N/A: test-fix PR, labelled skip-pr-checks.
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above. N/A: test-fix PR.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: N/A, no schema changes.
  • For a UI feature or feature task: N/A.
  • 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 baa41dafb49: no 🔴. On its nits, I added the two-id + bystander IT and tightened the comments (f3f804d1b38). The pre-existing drawer spinner-on-404 is left for a follow-up.
    • fba6b6945f5 adds the SqlFailureProbe/SqlQueryCounter matching fix, with a unit test for each. It's test-only code.
  • Decision check: N/A, no new contract, default or ordering.

🤖 Generated with Claude Code

…stale glossary/ontology specs

- WorkflowHandler.cancelInstancesForEntities: find running instances with one
  native IN query per chunk. Flowable's or().variableValueEquals() emits one
  correlated EXISTS per id, a full ACT_RU_VARIABLE scan each; with ~10k running
  instances a 100-id chunk took 15-18s, so hard-deleting a 400-concept ontology
  took ~97s and OntologyLargeGraph cleanup timed out.
- LargeGlossaryPerformance: glossary terms page at 15 since #35288; after clearing
  the search, wait for a listed term the search did not match.
- utils/glossary assignTagToGlossaryTerm: name the confirmation heading; #37179
  made the glossary title an h2.
- OntologyConceptDrawer: match "Unsaved changes" case-insensitively (Collate
  overrides the label); preselect the test's own ontology in All ontologies so a
  parallel worker deleting the first one cannot leave the drawer loading a 404.
@anuj-kumary anuj-kumary added the skip-pr-checks Bypass PR metadata validation check label Nov 7, 2026
@github-actions github-actions Bot added the UI UI specific issues label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@anuj-kumary anuj-kumary added the safe to test Add this label to run secure Github workflows on PRs label Nov 7, 2026
@anuj-kumary
anuj-kumary marked this pull request as ready for review November 7, 2026 06:32
@anuj-kumary
anuj-kumary requested review from a team as code owners November 7, 2026 06:32
EntityDAO.deleteByIds (#36868) renders DELETE /*+ INDEX(t PRIMARY) */ FROM t, so
SqlFailureProbe and SqlQueryCounter fragments like "delete from chart_entity" stopped
matching. The bulk-path atomicity cases in EntityHardDeletionAtomicityIT injected
nothing and failed. Match against the SQL with block comments removed.
@gitar-bot

gitar-bot Bot commented Nov 7, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Replacing Flowable's entity-workflow lookup with native IN queries could miss linked instances, leaving workflows active after hard deletion.

Replaces the per-id OR-of-EXISTS Flowable lookup in cancelInstancesForEntities with one native IN query per batch, fixing the 90 s hard-delete timeout on large ontologies. Also updates glossary and ontology Playwright specs for page size, heading locator, label casing and preselected ontology. 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

@anuj-kumary

Copy link
Copy Markdown
Member Author

Local Java test run: PASSED — details

  • Commit: fba6b6945f57 (base origin/main)
  • The summary is in the PR description.

Tests run locally

  • integration · mysql-elasticsearch · parallel: CredentialHotPathNoIoIT (2 passed), EntityBulkCreateRecoveryIT (12 passed), EntityHardDeletionAtomicityIT (19 passed), IndependentOntologyAuthorizationIT (19 passed), IndependentOntologyStatusIT (11 passed), MultiTeamUserFanOutIT (1 passed), NativeOntologyDataGraphContextIT (5 passed), NativeOntologyDataGraphPageIT (6 passed), OntologyImpactIT (17 passed), SqlFailureProbeTest (19 passed), SqlQueryCounterTest (0 passed), SqlTestDecoratorsIT (6 passed), TableMetadataReadIT (9 passed), TeamUserOwnsFanOutIT (2 passed), TopicServiceHydrationIT (4 passed)
  • integration · cache-tests · isolated: CredentialRedisDownIT (4 passed)

Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts.

Broader coverage not executed by this focused run

  • mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=IngestionPipelineMigrationEntryPointTest,MigrationUtilTaskWorkflowTest,OntologyEntityDAOTest,TaskRepositoryLifecycleEventTest,TaskWorkflowHandlerReviewVotesTest,TaskWorkflowHandlerTest,WorkflowEventConsumerTest,WorkflowHandlerSchemaUpdateTest,WorkflowHandlerTriggerTest,WorkflowRedeployEntryPointTest,WorkflowRedeployMigrationTest,WorkflowSignalIsolationTest -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<94 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=ChangeRequestAdmissionIT,ChangeRequestApplyIT,ChangeRequestDecisionIT,ChangeRequestImportAndBulkIT,ChangeRequestLifecycleIT,ChangeRequestResourceIT,DataContractValidationAppIT,EntityShapeIT,TagRecognizerFeedbackIT,WorkflowDefinitionResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=rdf -Dit.test=RdfGovernanceRulesIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pcache-tests -DintegrationTests.lane=parallel -Dit.test=EntityCacheWriteOrderIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Psearch-it -DdatabaseType=postgres -DsearchType=opensearch -Djpw.data.mode=ingest -Dit.test=SearchAccessRulesIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
Why these tests
  • added by author: use SqlFailureProbe/SqlQueryCounter, whose fragment matching now ignores SQL comments; EntityHardDeletionAtomicityIT also drives WorkflowHandler.cancelInstancesForEntities (CredentialAuthBenchIT is @Tag scale, nightly only) ← CredentialHotPathNoIoIT, CredentialRedisDownIT, EntityBulkCreateRecoveryIT, EntityHardDeletionAtomicityIT, IndependentOntologyAuthorizationIT (+9 more)
Impacted, not run locally (1)
  • EntityLoaderSmokeUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
Commands
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=CredentialHotPathNoIoIT,EntityBulkCreateRecoveryIT,EntityHardDeletionAtomicityIT,IndependentOntologyAuthorizationIT,IndependentOntologyStatusIT,MultiTeamUserFanOutIT,NativeOntologyDataGraphContextIT,NativeOntologyDataGraphPageIT,OntologyImpactIT,SqlFailureProbeTest,SqlQueryCounterTest,SqlTestDecoratorsIT,TableMetadataReadIT,TeamUserOwnsFanOutIT,TopicServiceHydrationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pcache-tests -DintegrationTests.lane=global-state -Dit.test=CredentialRedisDownIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

@anuj-kumary
anuj-kumary enabled auto-merge (squash) November 7, 2026 12:24
@anuj-kumary
anuj-kumary merged commit c804ba3 into main Nov 9, 2026
73 checks passed
@anuj-kumary
anuj-kumary deleted the anuj-kumary/governance-failure-fix branch November 9, 2026 03:00
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 skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants