Skip to content

feat(ui): completeness on di - #33106

Merged
pmbrull merged 8 commits into
mainfrom
harshach/completeness-on-di
Sep 10, 2026
Merged

pmbrull merged 8 commits into
mainfrom
harshach/completeness-on-di

Conversation

@karanh37

@karanh37 karanh37 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

This pull request introduces enhancements and refactoring to the Data Insights workflow, focusing on improved error handling, extensibility, and support for updating data asset data streams in both Elasticsearch and OpenSearch. The changes also add new extension points for custom logic during data asset snapshot processing and improve the robustness of workflow statistics and error reporting.

Key changes include:

Data Insights Workflow Improvements

  • Added support for extensions in the DataAssetsWorkflow, enabling custom logic to run before processing each batch and after entity enrichment. The workflow now uses a DataInsightsExtension.RunContext and manages extension lifecycle, including completion and cleanup. ([[1]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-c94d8304d49885015591e75c9b376310eb02dae8639fa2cc38530050b453c7b6R67), [[2]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-c94d8304d49885015591e75c9b376310eb02dae8639fa2cc38530050b453c7b6R79), [[3]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-c94d8304d49885015591e75c9b376310eb02dae8639fa2cc38530050b453c7b6R122), [[4]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-c94d8304d49885015591e75c9b376310eb02dae8639fa2cc38530050b453c7b6R231-R251), [[5]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-c94d8304d49885015591e75c9b376310eb02dae8639fa2cc38530050b453c7b6R305-R313), [[6]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-c94d8304d49885015591e75c9b376310eb02dae8639fa2cc38530050b453c7b6R326))
  • Improved error handling and reporting in the workflow, including tracking failures for empty batches, failed entity snapshots, search rejections, and interruptions. These are now logged in workflowStats for better observability. ([[1]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-c94d8304d49885015591e75c9b376310eb02dae8639fa2cc38530050b453c7b6R358-R361), [[2]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-c94d8304d49885015591e75c9b376310eb02dae8639fa2cc38530050b453c7b6R375-R376), [[3]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-c94d8304d49885015591e75c9b376310eb02dae8639fa2cc38530050b453c7b6R417-R421))

Data Asset Data Stream Management

  • Introduced the updateDataAssetsDataStream method in the DataInsightsSearchInterface and implemented it for both Elasticsearch and OpenSearch clients. This allows updating existing backing indexes and templates when the data stream rolls over. ([[1]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-76847b0dfc2bb0c1b118a9ac8237d094147ad72340e30a2563e16b49ed61b4bcR118-R122), [[2]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-80fd3f615367f1d59e457bd28e56bc4c414ac039124d0740114cdee8983fe925L69-R83), [[3]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-ba8e4619d2eb455c68a3af2f43e5b2e89a82c080212b8b71d0cab2ae4e7c74b5L74-R91))
  • Refactored the creation of data asset templates into a new prepareDataAssetTemplates default method, consolidating logic for building mappings and templates. ([[1]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-76847b0dfc2bb0c1b118a9ac8237d094147ad72340e30a2563e16b49ed61b4bcR21-R36), [[2]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-80fd3f615367f1d59e457bd28e56bc4c414ac039124d0740114cdee8983fe925L69-R83), [[3]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-ba8e4619d2eb455c68a3af2f43e5b2e89a82c080212b8b71d0cab2ae4e7c74b5L74-R91))

Elasticsearch & OpenSearch Client Enhancements

  • Improved request handling in the OpenSearch client by refactoring the performRequest method to return status codes and throw exceptions on non-successful responses, aligning error handling with Elasticsearch. ([[1]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-ba8e4619d2eb455c68a3af2f43e5b2e89a82c080212b8b71d0cab2ae4e7c74b5L32-R46), [[2]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-ba8e4619d2eb455c68a3af2f43e5b2e89a82c080212b8b71d0cab2ae4e7c74b5L62-R66))
  • Updated the logic for checking data stream existence and creating data streams to use the new request methods. ([openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/search/opensearch/OpenSearchDataInsightsClient.javaL62-R66](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-ba8e4619d2eb455c68a3af2f43e5b2e89a82c080212b8b71d0cab2ae4e7c74b5L62-R66))

Index Template and Mapping Improvements

  • Added a new static method forDataStream in IndexTemplate to ensure each entity type maintains its own rollover mapping, preventing accidental overwrites. ([openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/search/IndexTemplate.javaR10-R18](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-d6964b8df7736b45445787753507a9b0629656171923a9e27299ffcfd3e28f1eR10-R18))
  • Enhanced the EntityIndexMap.Mappings class to support dynamic_templates via Jackson annotations, improving mapping flexibility. ([[1]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-c530f5ca3eba41551e8e01e8ac5ad73e13cd1d2a82cb5a54619111ddb42daa1eR3-R4), [[2]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-c530f5ca3eba41551e8e01e8ac5ad73e13cd1d2a82cb5a54619111ddb42daa1eR19-R21))

Error Handling and Dependency Updates

  • Changed error handling in DataInsightsApp to throw UncheckedIOException on failures to prepare indexes, making failures more explicit. ([[1]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-f05f9c803443683c7ee7a63d2c42995653b5ce592bec875e24d11058cd82a308R11), [[2]](https://github.com/open-metadata/OpenMetadata/pull/33106/files#diff-f05f9c803443683c7ee7a63d2c42995653b5ce592bec875e24d11058cd82a308R164-R170))

These changes collectively improve the reliability, extensibility, and maintainability of the Data Insights workflow and its integration with search backends.

harshach and others added 7 commits September 7, 2026 16:43
…32552)

* feat(search): report embedding token usage instead of discarding it

* fix(search): report the text the provider received, not the caller's input

(cherry picked from commit 2209bd7)
* fix(security): restrict cross-user follower changes

* fix(security): validate follower user IDs

* fix(cache): bypass read-bundle cache for uncached entities

buildReadBundle used the read-bundle cache for every non-deleted read,
ignoring UNCACHED_ENTITY_TYPES (user, task, workflow*, bot, domain, dataProduct).
For those types a mutation followed by an immediate re-read — e.g. the follower
add/delete then fetch in this PR's DataProductResourceIT — could serve a stale
cached bundle. Without this, the follower authorization tests fail under a
cache-enabled deployment (postgres-elasticsearch-redis / postgres-opensearch
integration lanes) with `expected <false> but was <true>` after a delete.

Gate the read-bundle cache on isCacheableEntityType(entityType) so uncached
types take the already-supported bundleCache == null path and always reflect the
current entity_relationship state. Required for the follower tests to pass on the
Redis/OpenSearch lanes (documents why this caching change is part of the security
fix, per reviewer request).

* test(followers): rename put_-prefixed delete-follower tests to delete_ prefix

The two round-trip tests exercise the DELETE follower endpoint (add is setup),
so name them with the delete_ verb prefix to match the method-name convention
(addresses the Copilot review comment).

---------

Co-authored-by: sonika-shah <[email protected]>
(cherry picked from commit 2fb1cb5)
* feat(api): add samples to AI context

Limit structured table context to 10 permission-filtered rows so SQL agents can inspect value shape without a warehouse discovery query.

* fix(api): resolve sample-data authz with owners loaded

The AI context sample-data check wrapped an already-loaded table in a
pre-resolved ResourceContext. That constructor never runs resolveEntity(),
so owners and domains stayed absent (TABLE_FIELDS does not request them)
and every owner- or domain-conditioned rule misfired in both directions:
an owner-conditioned Deny failed open, and authorizePII() saw null owners
so a table's own owner had their sample data masked.

Resolve by id instead, which loads authorizationFields(), matching what
TableResource's GET /tables/{id}/sampleData already does.

The existing IT used an unconditioned Deny, which passes whether or not
owners are loaded. Add an owner-conditioned Deny case that first asserts
the real endpoint returns 403, then asserts the AI context endpoint
agrees. Verified: it returns 10 sample rows before the fix, none after.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit 8298911)
Copilot AI lite review requested due to automatic review settings September 10, 2026 05:25

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 reached their quota limit.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Sep 10, 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.

Comment on lines 169 to 171
} catch (IOException ex) {
LOG.error("Couldn't install DataInsightsApp: Can't initialize ElasticSearch Index.", ex);
throw new UncheckedIOException("Could not prepare Data Insights snapshot indexes", ex);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Quality: init() now aborts on transient search-cluster errors

createOrUpdateDataAssetsDataStream() is called from init(App) and its catch block now rethrows as UncheckedIOException instead of logging and continuing, so jobData (set at line 221) is never initialized. A transient search-cluster outage during app load — or one entity type's mapping update failing mid-loop — now aborts DataInsights app initialization entirely rather than degrading gracefully. If fail-fast is intended, this is fine; otherwise consider keeping create failures fatal while tolerating/retrying update failures so a temporary ES/OS hiccup doesn't block app startup.

Was this helpful? React with 👍 / 👎

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 1 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 1 warning(s) across 1 changed file(s).

Count Rule
1 openmetadata-imports/no-circular-imports
All findings
Location Rule Message
🟡 src/utils/AdvancedSearchClassBase.ts:48:1 openmetadata-imports/no-circular-imports This runtime import participates in a circular dependency. Extract the shared type/constant/utility or invert the dependency.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 70%
70.63% (95768/135578) 55.22% (56756/102781) 56.58% (18935/33463)

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 reached their quota limit.

@gitar-bot

gitar-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 1 resolved / 2 findings

Adds Data Insights extensibility, recursive column coverage metrics, and data stream management for Elasticsearch and OpenSearch. Workflow lifecycle support and error tracking are well-structured. Consider whether init() should abort entirely on transient search-cluster errors during createOrUpdateDataAssetsDataStream() — currently a temporary ES/OS outage or mid-loop mapping failure blocks app startup rather than degrading gracefully.

💡 Quality: init() now aborts on transient search-cluster errors

📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/DataInsightsApp.java:169-171 📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/DataInsightsApp.java:219

createOrUpdateDataAssetsDataStream() is called from init(App) and its catch block now rethrows as UncheckedIOException instead of logging and continuing, so jobData (set at line 221) is never initialized. A transient search-cluster outage during app load — or one entity type's mapping update failing mid-loop — now aborts DataInsights app initialization entirely rather than degrading gracefully. If fail-fast is intended, this is fine; otherwise consider keeping create failures fatal while tolerating/retrying update failures so a temporary ES/OS hiccup doesn't block app startup.

✅ 1 resolved
✅ Edge Case: Export completeness guard aborts all exports on any shard failure

📄 openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchSearchManager.java:1289-1291 📄 openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchSearchManager.java:1355-1357
The new response.timedOut() || response.shards().failed() > 0 check lives in searchForExport, which is the general export path (SearchRepository's countRequest/batchRequest loop drives entity CSV/bulk exports, not just Data Insights). A single transient partial-shard failure or request timeout on a large multi-shard index now throws IOException and aborts the entire export, whereas before it returned best-effort partial results. This is a deliberate correctness trade-off, but confirm it is intended for all export consumers and not just DI snapshots; consider scoping the strict guard to the DI index pattern if general exports should remain best-effort.

🤖 Prompt for agents
Code Review: Adds Data Insights extensibility, recursive column coverage metrics, and data stream management for Elasticsearch and OpenSearch. Workflow lifecycle support and error tracking are well-structured. Consider whether `init()` should abort entirely on transient search-cluster errors during `createOrUpdateDataAssetsDataStream()` — currently a temporary ES/OS outage or mid-loop mapping failure blocks app startup rather than degrading gracefully.

1. 💡 Quality: init() now aborts on transient search-cluster errors
   Files: openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/DataInsightsApp.java:169-171, openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/DataInsightsApp.java:219

   `createOrUpdateDataAssetsDataStream()` is called from `init(App)` and its catch block now rethrows as `UncheckedIOException` instead of logging and continuing, so `jobData` (set at line 221) is never initialized. A transient search-cluster outage during app load — or one entity type's mapping update failing mid-loop — now aborts DataInsights app initialization entirely rather than degrading gracefully. If fail-fast is intended, this is fine; otherwise consider keeping create failures fatal while tolerating/retrying update failures so a temporary ES/OS hiccup doesn't block app startup.

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

@sonarqubecloud

Copy link
Copy Markdown

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

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants