Skip to content

fix(data-insights): read DQ incident data from live indices, drop 30-day cap - #29963

Merged
pmbrull merged 11 commits into
mainfrom
debug-data-insights
Jul 16, 2026
Merged

pmbrull merged 11 commits into
mainfrom
debug-data-insights

Conversation

@IceS2

@IceS2 IceS2 commented Jul 13, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #30054

Problem

Custom Data Insights charts over data quality (testCaseResolutionStatus, testCaseResult) undercount resolved incidents compared to the DQ incident page. Widening the time range or changing the chart metric does not reconcile the count.

Root cause

DataInsightsApp never created a separate store for data quality. createDataQualityDataIndex() creates the live test_case_resolution_status_search_index / test_case_result_search_index (the same indices the incident page and search APIs keep complete) and hangs a di-data-assets-* alias on each. The custom DI charts read those physical indices through the alias.

DataQualityWorkflow then, per run, deleted a time window from those live indices and re-inserted the exact docs live indexing already wrote — a no-op that added nothing but:

  • capped history at 30 days (retentionDays = 30), silently clamping any longer backfill;
  • destroyed live data on recreateDataAssetsIndex by calling deleteDataQualityDataIndex() on the live index;
  • wrote through the canonical index name, ignoring rebuild aliases during a reindex.

The alias itself was also added imperatively at runtime, so a SearchIndexApp reindex dropped it until the next DI run.

Change

  • IndexMapping.dataInsightAliases (joined with - to match the DI di-data-assets-* wildcard, not the _ entity separator) declares the DQ aliases in indexMapping.json. They are applied on index create, re-attached on reindex alias-swap (DefaultRecreateHandler), and reconciled on startup (SearchRepository.createMissingIndexes) so existing clusters pick them up on upgrade.
  • Remove DataQualityWorkflow, its index create/delete helpers, the recreateDataAssetsIndex DQ calls, and the openmetadata-ops CLI hooks.
  • Retire the dataQuality module config from schema, seeds, and UI schema; a 2.0.0 post-data migration strips the key from installed_apps, apps_marketplace, and entity_extension (the config is additionalProperties: false, so DataInsightsApp would otherwise fail to deserialize existing records).

The chart now reads the production index that was always complete, so its count matches the incident page — and stays matched through a DI recreate and a 90-day backfill.

Notes

  • Draft: validated locally on OpenSearch/Elasticsearch dev stacks. Needs an integration test asserting the alias survives a testCaseResolutionStatus reindex and is reconciled after restart.
  • Removing the module-config key from every persisted config is the load-bearing part of the migration; the seed changes cover fresh installs.

Greptile Summary

This PR moves Data Quality Data Insights charts onto the live search indices. The main changes are:

  • Declares di-data-assets-* aliases in the search index mapping.
  • Reattaches those aliases during index creation, reindex promotion, and startup reconciliation.
  • Removes the old Data Quality workflow and related ops hooks from Data Insights.
  • Removes the retired dataQuality app config from schemas, seeds, generated UI types, docs, and upgrade migrations.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
bootstrap/sql/migrations/native/2.0.0/mysql/postDataMigrationSQLScript.sql Removes the retired Data Insights dataQuality config from MySQL persisted app records.
bootstrap/sql/migrations/native/2.0.0/postgres/postDataMigrationSQLScript.sql Removes the retired Data Insights dataQuality config from PostgreSQL persisted app records.
openmetadata-spec/src/main/java/org/openmetadata/search/IndexMapping.java Adds Data Insights alias support with the expected hyphenated alias prefix.
openmetadata-spec/src/main/resources/elasticsearch/indexMapping.json Declares Data Insights aliases for the live Data Quality search indices.
openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java Reconciles Data Insights aliases for existing search indices during startup index checks.
openmetadata-service/src/main/java/org/openmetadata/service/search/DefaultRecreateHandler.java Carries Data Insights aliases through the reindex alias swap.
openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/DataInsightsApp.java Removes the old Data Quality workflow from the Data Insights app run path.

Reviews (4): Last reviewed commit: "Merge branch 'main' into debug-data-insi..." | Re-trigger Greptile

Context used (3)

  • Context used - CLAUDE.md (source)
  • Context used - openmetadata-ui-core-components/CLAUDE.md (source)
  • Context used - AGENTS.md (source)

…day cap

Custom Data Insights charts over data quality (testCaseResolutionStatus,
testCaseResult) undercounted resolved incidents versus the DQ incident page.
DataInsightsApp ran a DataQualityWorkflow that deleted and re-inserted a 30-day
window into the *live* search indices those entities already own, and the
recreate path deleted the live index outright. The DI charts read the same
physical indices via the di-data-assets-* aliases, so the workflow added no
data and only capped history at 30 days.

Data Insights never had a separate store for data quality: the alias points at
the live index that the incident page and search APIs keep complete. This makes
search indexing own those aliases declaratively (IndexMapping.dataInsightAliases,
joined with '-' to match the DI wildcard) and applies them on create, on reindex
alias-swap, and on startup reconciliation, then removes DataQualityWorkflow, its
index create/delete helpers, the recreate-branch calls, and the CLI hooks.

The dataQuality module config is retired from the schema, seeds, and UI schema,
with a migration stripping the key from installed_apps, apps_marketplace, and
entity_extension so DataInsightsApp still deserializes existing configs.
@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Jul 13, 2026
IceS2 and others added 7 commits July 13, 2026 10:05
…iliation, regen app docs

- entity_extension migration now also filters name = 'DataInsightsApplication'
  (mysql + postgres), matching the installed_apps/apps_marketplace statements so
  the dataQuality strip cannot touch another app's version snapshots.
- reconcileAliases attaches only the Data Insights aliases on startup instead of
  re-applying every parent/short alias for all entities, keeping boot-time side
  effects scoped and off the aliases the reindex swap owns.
- Regenerate DataInsightsApplication app docs after removing the dataQuality
  module from the schema.
…ciliation

- DefaultRecreateHandlerTest: assert the di-data-assets-* alias follows the
  staged index through the reindex alias swap, so custom charts keep reading
  the reindexed data.
- DataInsightAliasReconciliationIT: detach the alias from the live index to
  simulate a pre-upgrade cluster, then assert createMissingIndexes reconciles
  it back on startup.
The `?` jsonb key-existence operator is parsed as a JDBC bind placeholder by the
migration runner, so the postgres 2.0.0 postDataMigration failed at startup
("Failed to run sql") and aborted the search integration-test bootstrap. Switch
the three guards to jsonb_exists(...), matching the existing 2.0.0 statements.
Validated on Postgres 16: strips dataQuality only from DataInsightsApplication,
leaves sibling modules and other apps untouched, idempotent on re-run.
@IceS2
IceS2 marked this pull request as ready for review July 14, 2026 12:34
@IceS2
IceS2 requested a review from a team as a code owner July 14, 2026 12:34
Copilot AI review requested due to automatic review settings July 14, 2026 12:34

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 commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 64%
64.59% (75525/116925) 48.54% (45095/92893) 49.19% (13605/27658)

manerow
manerow previously approved these changes Jul 14, 2026
@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (28 flaky)

✅ 4526 passed · ❌ 0 failed · 🟡 28 flaky · ⏭️ 96 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 423 0 4 16
✅ Shard 2 11 0 0 0
🟡 Shard 3 821 0 10 9
🟡 Shard 4 821 0 1 18
🟡 Shard 5 836 0 3 5
🟡 Shard 6 787 0 1 46
🟡 Shard 7 827 0 9 2
🟡 28 flaky test(s) (passed on retry)
  • Features/CustomizeDetailPage.spec.ts › Glossary Term - customization should work (shard 1, 1 retry)
  • Pages/Bots.spec.ts › Bots Page should work properly (shard 1, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: metric (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › the browse tree only shows the asset-type categories a user can access (shard 1, 1 retry)
  • Features/BulkImportWithDotInName.spec.ts › CSV with quoted FQN loads correctly in import grid (shard 3, 1 retry)
  • Features/BulkImportWithDotInName.spec.ts › Column with dot in name under service with dot (shard 3, 1 retry)
  • Features/ContextCenterArchivePage.spec.ts › archive page lazy-loads more rows on scroll within its own scroll container (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article listing search filters, clears, and shows empty state (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › Article list cards, recently viewed widget, and pagination work (shard 3, 1 retry)
  • Features/ContextCenterArticles.spec.ts › description: switching articles does not bleed unsaved content into next article (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › clearing search restores the unfiltered list (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › clicking a memory row adds ?memory= param to the URL (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › Shared memory shows the shared-with-specific-people description (shard 3, 1 retry)
  • Features/DataQuality/BundleSuiteBulkOperations.spec.ts › Add test case to existing Bundle Suite (shard 3, 1 retry)
  • Features/SearchExport.spec.ts › Export queues a background job and downloads from the jobs tray (shard 4, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Enum (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Entity Reference List (shard 5, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 6, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should allow Data Steward to edit glossary terms for dashboardDataModel (shard 7, 1 retry)
  • Pages/ExplorePageRightPanel.spec.ts › Should allow Data Steward to view all tabs for searchIndex (shard 7, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Check for Circular Reference in Glossary Import (shard 7, 1 retry)
  • Pages/GlossaryImportExport.spec.ts › Import partial success - some terms pass, some fail (shard 7, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for pipelineService in platform lineage (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for apiService in platform lineage (shard 7, 1 retry)
  • Pages/ServiceEntity.spec.ts › Tier Add, Update and Remove (shard 7, 1 retry)
  • Pages/TestSuite.spec.ts › Logical TestSuite (shard 7, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

The canonical index name is itself an alias onto a *_rebuild_* index once a
reindex has run, and aliases only ever attach to concrete indices — so asserting
the DI alias resolves to the canonical *name* could never hold. Resolve the
concrete index(es) currently serving the entity and assert against those.

Also use MySQL's ->> (unquoting) operator for the DataInsightsApplication name
predicate instead of relying on JSON_EXTRACT's JSON-coercion comparison.
Copilot AI review requested due to automatic review settings July 14, 2026 16:54
Copilot AI review requested due to automatic review settings July 14, 2026 21:26

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.

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

"parentAliases": [],
"childAliases": []
"childAliases": [],
"dataInsightAliases": ["di-data-assets-testcaseresolutionstatus"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice

@pmbrull
pmbrull merged commit 83840a9 into main Jul 16, 2026
85 of 87 checks passed
@pmbrull
pmbrull deleted the debug-data-insights branch July 16, 2026 08:29
@gitar-bot

gitar-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 3 resolved / 3 findings

Eliminates the redundant DataQualityWorkflow to enable direct reads from live indices, resolving incident count discrepancies and the 30-day data cap. Improved alias reconciliation and configuration migration ensure data consistency across reindexes and system restarts.

✅ 3 resolved
✅ Edge Case: entity_extension migration lacks DataInsights name filter

📄 bootstrap/sql/migrations/native/2.0.0/postgres/postDataMigrationSQLScript.sql:271-277 📄 bootstrap/sql/migrations/native/2.0.0/mysql/postDataMigrationSQLScript.sql:280-283
In both the postgres and mysql 2.0.0/postDataMigrationSQLScript.sql, the installed_apps and apps_marketplace UPDATEs are scoped with name = 'DataInsightsApplication', but the entity_extension UPDATE is scoped only by extension LIKE 'app.version.%' and the presence of the appConfiguration.moduleConfiguration.dataQuality key. This matches version snapshots of any app, relying entirely on the JSON path guard to avoid touching unrelated records. In practice only DataInsightsApp uses moduleConfiguration.dataQuality, so the risk is low, but the inconsistency with the other two statements is worth eliminating for defensiveness. Consider adding a name/type predicate (e.g. restricting to app.version.% rows whose json identifies DataInsightsApplication) so the strip cannot accidentally affect another app that ever introduced a dataQuality module key.

Sources: bootstrap/sql/migrations/native/2.0.0/postgres/postDataMigrationSQLScript.sql:271-277, bootstrap/sql/migrations/native/2.0.0/mysql/postDataMigrationSQLScript.sql:280-283

✅ Quality: createMissingIndexes now re-applies all aliases on every startup

📄 openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:481-495 📄 openmetadata-service/src/main/java/org/openmetadata/service/search/elasticsearch/ElasticSearchIndexManager.java:117-124 📄 openmetadata-service/src/main/java/org/openmetadata/service/search/opensearch/OpenSearchIndexManager.java:132-139
createMissingIndexes() was changed so that for every existing index it now calls reconcileAliases() -> searchClient.createAliases(), which re-adds parentAliases + dataInsightAliases + short alias for all ~all entity types on each startup. The intent (per the PR) is only to attach the newly-introduced DI aliases on upgraded clusters. While alias adds are idempotent, this broadens the startup side effects well beyond the DI aliases and issues an extra ES/OS alias call per index on every boot. The main theoretical risk is if the server restarts while a SearchIndexApp reindex is mid-swap: re-adding the short/parent alias to the canonical index could make an alias resolve to both the canonical and staged index. Zero-downtime reindex normally keeps the live alias on the canonical index until the atomic finalize swap, so this is unlikely, but consider narrowing reconciliation to just getDataInsightAliases() (or documenting why full alias reconciliation on every startup is safe).

✅ Quality: No test for DI alias survival across reindex/restart

📄 openmetadata-service/src/main/java/org/openmetadata/service/search/DefaultRecreateHandler.java:501-504 📄 openmetadata-service/src/main/java/org/openmetadata/service/search/SearchRepository.java:513-522
This change relies on the di-data-assets-* aliases being (a) created on index creation, (b) re-attached during a testCaseResolutionStatus/testCaseResult reindex alias swap in DefaultRecreateHandler, and (c) reconciled on startup via SearchRepository.createMissingIndexes. All three are new invariants with no automated coverage — the author already flags this in the PR notes. Without a regression test, a future refactor of getAliasesFromMapping, createAliases, or createMissingIndexes could silently drop the DI aliases and re-introduce the undercount bug this PR fixes. Add an integration test asserting the alias exists after index create, survives a reindex, and is re-attached after a simulated restart on a cluster whose index predates the alias.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

timothybrush pushed a commit to timothybrush/OpenMetadata that referenced this pull request Aug 27, 2026
…lts (open-metadata#31759)

* fix(data-insights): exclude data-quality docs from data-asset totals

The di-data-assets-* pattern the charts read also resolves the data-quality
aliases (di-data-assets-testcaseresult, -testcaseresolutionstatus) that open-metadata#29963
attached to the live test case indices. TestCaseResult and
TestCaseResolutionStatus are EntityTimeSeriesInterface, not EntityInterface, so
SearchIndex.populateCommonFields never runs for them and their documents carry
no entityType.

That split the two "total data assets" charts. total_data_assets groups with a
terms aggregation on entityType.keyword, which puts a document missing the field
in no bucket, so those documents vanished. total_data_assets_summary_card
filtered with a list of bool.must_not.term clauses on the same field, every one
of which a document lacking it satisfies, so they were counted. The card ran
ahead of the breakdown beneath it by exactly the number of test case results in
the window, and the same inflated denominator depressed the description, owner
and tier percentages.

Give the charts one definition of a data asset in
DataInsightSystemChartRepository: DATA_ASSET_FILTER now requires
exists(entityType) alongside the exclusions, and NON_DATA_ASSET_ENTITY_TYPES
feeds both the filter and the breakdown's excludeGroups so the two cannot drift
again. That also closes a second gap in the opposite direction, where the filter
excluded dataProduct but excludeGroups did not.

The 1.13.4 migration re-applies the scope to the fourteen stored charts,
rewriting only the filter and excludeGroups so anything else in a stored
definition survives.

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

* fix(data-insights): move the chart scope migration to 1.13.5

1.13.4 is frozen: open-metadata#31386 deliberately made main's copy byte-identical to the
1.13 branch, and any deployment that already ran it under a 2.0.0-rc build would
skip a data migration added there, because shouldRunDataMigration only re-runs a
reprocessed version when it equals the current max.

A new 1.13.5 directory has been executed by nobody, so processNativeMigrations
applies it to every deployment regardless of it sorting below the current max
version. The SQL files are empty because the change is pure data migration,
matching the existing 0-byte 1.13.3 schemaChanges.sql.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: IceS2 <[email protected]>
ulixius9 added a commit that referenced this pull request Sep 3, 2026
…lts (#31759) (#32334)

* fix(data-insights): exclude data-quality docs from data-asset totals

The di-data-assets-* pattern the charts read also resolves the data-quality
aliases (di-data-assets-testcaseresult, -testcaseresolutionstatus) that #29963
attached to the live test case indices. TestCaseResult and
TestCaseResolutionStatus are EntityTimeSeriesInterface, not EntityInterface, so
SearchIndex.populateCommonFields never runs for them and their documents carry
no entityType.

That split the two "total data assets" charts. total_data_assets groups with a
terms aggregation on entityType.keyword, which puts a document missing the field
in no bucket, so those documents vanished. total_data_assets_summary_card
filtered with a list of bool.must_not.term clauses on the same field, every one
of which a document lacking it satisfies, so they were counted. The card ran
ahead of the breakdown beneath it by exactly the number of test case results in
the window, and the same inflated denominator depressed the description, owner
and tier percentages.

Give the charts one definition of a data asset in
DataInsightSystemChartRepository: DATA_ASSET_FILTER now requires
exists(entityType) alongside the exclusions, and NON_DATA_ASSET_ENTITY_TYPES
feeds both the filter and the breakdown's excludeGroups so the two cannot drift
again. That also closes a second gap in the opposite direction, where the filter
excluded dataProduct but excludeGroups did not.

The 1.13.4 migration re-applies the scope to the fourteen stored charts,
rewriting only the filter and excludeGroups so anything else in a stored
definition survives.



* fix(data-insights): move the chart scope migration to 1.13.5

1.13.4 is frozen: #31386 deliberately made main's copy byte-identical to the
1.13 branch, and any deployment that already ran it under a 2.0.0-rc build would
skip a data migration added there, because shouldRunDataMigration only re-runs a
reprocessed version when it equals the current max.

A new 1.13.5 directory has been executed by nobody, so processNativeMigrations
applies it to every deployment regardless of it sorting below the current max
version. The SQL files are empty because the change is pure data migration,
matching the existing 0-byte 1.13.3 schemaChanges.sql.



---------



(cherry picked from commit 1b5914c)

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: IceS2 <[email protected]>
ulixius9 added a commit that referenced this pull request Sep 16, 2026
…lts (#31759)

* fix(data-insights): exclude data-quality docs from data-asset totals

The di-data-assets-* pattern the charts read also resolves the data-quality
aliases (di-data-assets-testcaseresult, -testcaseresolutionstatus) that #29963
attached to the live test case indices. TestCaseResult and
TestCaseResolutionStatus are EntityTimeSeriesInterface, not EntityInterface, so
SearchIndex.populateCommonFields never runs for them and their documents carry
no entityType.

That split the two "total data assets" charts. total_data_assets groups with a
terms aggregation on entityType.keyword, which puts a document missing the field
in no bucket, so those documents vanished. total_data_assets_summary_card
filtered with a list of bool.must_not.term clauses on the same field, every one
of which a document lacking it satisfies, so they were counted. The card ran
ahead of the breakdown beneath it by exactly the number of test case results in
the window, and the same inflated denominator depressed the description, owner
and tier percentages.

Give the charts one definition of a data asset in
DataInsightSystemChartRepository: DATA_ASSET_FILTER now requires
exists(entityType) alongside the exclusions, and NON_DATA_ASSET_ENTITY_TYPES
feeds both the filter and the breakdown's excludeGroups so the two cannot drift
again. That also closes a second gap in the opposite direction, where the filter
excluded dataProduct but excludeGroups did not.

The 1.13.4 migration re-applies the scope to the fourteen stored charts,
rewriting only the filter and excludeGroups so anything else in a stored
definition survives.

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

* fix(data-insights): move the chart scope migration to 1.13.5

1.13.4 is frozen: #31386 deliberately made main's copy byte-identical to the
1.13 branch, and any deployment that already ran it under a 2.0.0-rc build would
skip a data migration added there, because shouldRunDataMigration only re-runs a
reprocessed version when it equals the current max.

A new 1.13.5 directory has been executed by nobody, so processNativeMigrations
applies it to every deployment regardless of it sorting below the current max
version. The SQL files are empty because the change is pure data migration,
matching the existing 0-byte 1.13.3 schemaChanges.sql.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: IceS2 <[email protected]>
(cherry picked from commit 1b5914c)
ulixius9 added a commit that referenced this pull request Sep 30, 2026
…the Data Insights chart rescope, both on 2.0.3 (#33415)

* Fixes 31512: Ingest SQL Server synonyms as Table.aliases (#31829)

* feat(spec): add source-managed aliases field to Table entity

Adds an aliases[] array of alternate fully-qualified SQL names (e.g.
SQL Server synonyms) to Table and CreateTableRequest, so a synonym can
be recorded on the canonical table it resolves to instead of creating
a second entity.

* fix(ingestion): sort aliases in source hash normalization for stable digests

Source hash should be stable regardless of alias list ordering, since
sys.synonyms in MSSQL provides no row ordering guarantee. This change sorts
the aliases list before hashing to ensure consistent digest generation
across ingestion runs.

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

* feat(mssql): add sys.synonyms query and synonym result models

* feat(mssql): parse and normalize sys.synonyms base_object_name identifiers

Implement split_sql_server_identifier() for bracket-aware T-SQL identifier
splitting and parse_base_object_name() to normalize synonym base_object_name
into a three-part target (database.schema.table), with handling for missing
parts (defaulting schema to 'dbo' and database to the synonym's database),
remote references, and edge cases.

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

* feat(mssql): add bounded synonym map with consumption tracking

Add SynonymMap class to track SQL Server synonyms with bounded memory
usage and consumption tracking. Implements the following:

- MAX_SYNONYM_ENTRIES: bounded cache with 5000-entry default cap
- add(): stores aliases by target, rejects new targets beyond cap
- aliases_for(): returns sorted aliases and marks target consumed
- record_unresolved(): explicitly records unresolved synonyms
- unresolved(): reports both explicit and unconsumed targets
- is_empty(): checks if the map contains any entries

Includes 9 unit tests covering all core behaviors and edge cases:
alias sorting, deduplication, cap enforcement, consumption tracking,
and unresolved reporting. All 29 tests (20 existing + 9 new) pass.

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

* style(ingestion): apply ruff formatting to alias test files

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

* fix(mssql): bound unresolved synonym list and document aliases_for side effect

Finding 1 (Critical): _explicit_unresolved is now capped at max_entries to
prevent unbounded memory growth on catalogs with many malformed synonyms.
Uses a separate warn-once flag _unresolved_cap_warned to avoid silencing
target-cap warnings.

Finding 2 (Minor): aliases_for method now has a docstring documenting that
calling it marks the target consumed and signals successful ingestion. This
establishes the contract for the "call exactly once per table" expectation.

Includes new test test_unresolved_cap_bounds_explicit_entries verifying the cap
applies correctly to record_unresolved calls.

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

* feat(ingestion): add get_table_aliases hook to the shared table producer

* fix(ingestion): remove connector-specific vocabulary from get_table_aliases docstring and add wiring test

* feat(mssql): discover synonyms up front and attach them as table aliases

Sweeps sys.synonyms across every in-scope database in MssqlSource.prepare()
(before the topology produces anything), builds a target FQN -> alias FQNs
map, and resolves each table's aliases by construction via a get_table_aliases
override. close() reports synonyms that never resolved to an ingested table.

* test(mssql): cover synonym-sweep routing in _in_scope_database_names/prepare

Adds coverage for the keystone routing logic that decides which databases
prepare() sweeps for synonyms: the ingestAllDatabases=False short-circuit,
databaseFilterPattern exclusion, prepare() wiring build_synonym_map's result
into self.synonym_map, and prepare()'s resilience path leaving a usable
empty SynonymMap (not None) when the sweep raises.

* feat(search): index table aliases for exact and partial matching

* fix(service): wire CreateTable.aliases through to the persisted Table entity

TableMapper.createToEntity never copied create.getAliases() onto the
Table it builds, so the aliases field added in the Table/CreateTable
schema (feat(spec): add source-managed aliases field to Table entity)
was silently dropped on both POST and PUT: it could never reach the
entity to be created, updated, replaced, or merged in the first place.
Discovered while writing the Task 9 integration test for the mssql
synonym-aliases design (out of that task's stated file scope, but a
blocking prerequisite for it to test anything at all).

* fix(service): replace table aliases wholesale on update, don't silently drop changes

TableUpdater.entitySpecificUpdate never registered "aliases" with
recordChange, so a PUT that changed only aliases produced no field
diff: entityChanged/versionChanged stayed false and storeUpdate()
skipped persisting the new version entirely. The PUT response still
echoed the caller's in-memory Table (with the new aliases), masking
that the database row kept the stale value — confirmed by re-fetching
the entity after the PUT in the Task 9 integration test.

Registering aliases here, alongside the other plain-field
recordChange calls, makes updateVersion() see the change and persist
it, so a PUT with a new aliases list replaces the array wholesale
(matching default List<String> semantics) instead of being ignored.
This is required for the mssql synonym design's "the connector
resends the full list every run, no diffing needed" property to hold.

* test(service): assert table aliases are replaced wholesale across runs

Gate on the mssql synonym-aliases design assumption that a PUT
CreateTable with a full aliases list replaces the array wholesale, so
created/dropped/retargeted synonyms reconcile through plain upsert
semantics with no diffing stage. Covers initial set, retarget (old
alias gone), and clear (empty list clears aliases), re-fetching the
entity after each PUT rather than trusting the mutation response's
in-memory echo.

Running it against unpatched code (git stash the two preceding fix
commits) confirmed the assumption did NOT hold by default: aliases
never reached the entity at all (TableMapper gap), and once that was
fixed, a retarget silently failed to persist (TableUpdater gap) while
the PUT response still reported the new value. Both gaps are fixed in
the two preceding commits; default array replace semantics were not
sufficient on their own.

* fix(service): use recordListChange for table aliases, not recordChange

recordChange compares aliases with List::equals, which is order-sensitive
and does not normalize null against empty. GlossaryTerm.synonyms (also a
List<String> of alternate names) already uses recordListChange with
listOrEmpty normalization for exactly this reason; Topic.cleanupPolicies
follows the same pattern. Two concrete problems with recordChange here:

- Order churn: ["b","a"] vs ["a","b"] would record as a change, bumping
  the table's version and firing a change event on every re-ingestion
  even when the alias set is unchanged. This was only masked by
  SynonymMap.aliases_for returning a sorted list, making the server
  contract silently depend on every producer sorting.
- Null/empty asymmetry: original=null, updated=[] took the "orig == null"
  branch and recorded a fieldAdded, bumping the version for a table whose
  alias set went from nothing to nothing.

Switch to recordListChange with listOrEmpty-normalized inputs and
stringMatch, following GlossaryTermRepository.updateSynonyms exactly.
Verified via TableResourceIT#put_tableAliases_replaceNotMerge that all
three transitions (set, retarget, clear) still replace wholesale:
retarget now records added+deleted, clear records deleted, and each
correctly marks entityChanged so the new version persists.

* test(service): assert aliases persistence on create, and pin the clear value

Two fixes to put_tableAliases_replaceNotMerge from review:

- The initial-set leg only asserted on the create response (the in-memory
  echo of the request), not on a re-fetched entity, so it proved echo
  rather than persistence. A mapper that wired aliases into the create
  path but dropped them at store time would have passed this leg while
  legs 2/3 (which do re-fetch) still passed via the original=null ->
  fieldAdded path on the first PUT. Added an explicit re-fetch assertion
  so the create path is actually covered.
- The clear leg sent aliases=[] and accepted either null or empty back.
  Now that aliases uses recordListChange (previous commit), the
  persisted value is deterministic, so assert on it directly. Changed
  the leg to send aliases=null instead of aliases=[], matching what
  SynonymMap.aliases_for (ingestion/src/metadata/ingestion/source/database/mssql/synonyms.py)
  actually returns on a miss (None, not an empty list) -- this is the
  production clear path the mssql connector takes, not a hypothetical one.

* feat(lineage): resolve alias FQNs to their canonical table

Add es_search_from_alias to the ES mixin and a fallback in
search_table_entities so lineage resolves a source-managed alias
(e.g. a SQL Server synonym) to the canonical table it points at.
Generic, service-agnostic: works for any connector that populates
Table.aliases, without depending on connector-specific in-memory state.

* feat(ui): show read-only table aliases on the table detail page

Adds a TableAliases widget that lists a table's source-managed alternate
FQNs (e.g. SQL Server synonyms) on the table detail page. Display-only by
design: the MSSQL connector recomputes and overwrites aliases on every
run, so an edit control would silently discard user input.

Also regenerates the UI's TS types for Table/CreateTable/BulkCreateTable
from the JSON Schema to pick up the aliases field added in a prior schema
change; the previous change updated only the schema, never the generated
UI types (make update_typescript_types), leaving Table.aliases absent
from the frontend contract. Verified the regeneration touched only the
aliases addition with no unrelated churn.

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

* test(ui): add Playwright coverage for the table aliases widget

Creates a table with source-managed aliases via the API, visits its
page, and asserts the display-only widget renders each alias and
offers no edit control (the connector overwrites aliases on every
ingestion run, so an editable field would silently discard input).
Also covers the negative case: a table with no aliases renders no
widget at all.

* fix(mssql): resolve 3 basedpyright errors from the alias feature

- common_db_source.py: wrap get_table_aliases() strings in
  FullyQualifiedEntityName before assigning to CreateTableRequest.aliases,
  which is invariantly typed list[FullyQualifiedEntityName] | None.
- source_hash.py: cast the result of _remove_volatile_fields to
  dict[str, Any] before the new "aliases" sort block indexes it by string
  key; narrows the same union for the pre-existing columns/tags/
  tableConstraints/owners blocks too, so their baselined errors also
  clear (baseline.json untouched -- discard mode tolerates unused entries).
- sql_lineage.py: inline-suppress the new search_cache.put(search_tuple, ...)
  call with a narrow pyright:ignore, matching the pre-existing baselined
  call a few lines above -- LRUCache.put's `key: str` annotation is too
  narrow for the tuple keys this cache actually uses everywhere.

make static-checks now reports zero errors attributable to this branch.

* fix(lineage): stub es_search_from_alias in TestDbUtils to prevent bogus MagicMock matches

search_table_entities' Task-10 alias fallback treats any truthy return from
metadata.es_search_from_alias as a resolved alias. TestDbUtils.setUp builds a
bare MagicMock() metadata client; any test that reaches the fallback without
stubbing this call gets an unconfigured, auto-truthy MagicMock back instead of
None, which the fallback short-circuits on and returns as if it were real
Table entities -- breaking test_get_view_lineage_success_with_fallback, whose
schema-fallback scenario reaches this exact branch.

es_search_from_alias's real contract is Optional[List[Table]]; production
code has no bug here since a real client only ever returns that shape. The
gap is purely a missing test stub, so the fix is stubbing it (return None)
once in setUp, covering every test in the class the same way es_search_from_fqn
and get_by_name are already stubbed, rather than papering over it per-test.

Audited every other MagicMock-metadata test in tests/unit/lineage,
tests/unit/test_db_utils.py, and tests/unit/topology that exercises
search_table_entities/get_table_entities_from_query/get_view_lineage without
mocking the function away entirely (test_cross_database_lineage_sql.py,
test_stored_procedure_lineage.py, test_grafana.py, test_hex_lineage.py,
test_snowflake_access_history_lineage.py, test_dbtcloud.py): none reach the
alias-fallback branch today (confirmed by temporary instrumentation), so no
other test file needed a stub.

* fix(mssql): case-fold SynonymMap's lookup key, not the stored alias FQN

Verified against a real SQL Server 2022 instance: sys.synonyms.base_object_name
preserves the exact casing typed in CREATE SYNONYM ... FOR ..., never the
target object's actual stored casing. Under SQL Server's default
case-insensitive collation this is routine (CREATE SYNONYM dbo.o FOR
analytics_master.dbo.Orders against a table stored as "orders" is completely
normal T-SQL), but SynonymMap's dict/set lookups were case-sensitive Python
string comparisons, so the alias silently missed its target and got reported
as an unresolved synonym even though the target exists and was ingested --
defeating the feature's primary use case of cross-database synonyms.

Fix: _targets is now keyed on target_fqn.casefold() in add()/aliases_for();
_consumed stores the same folded key so a target consumed via a differently
cased lookup is correctly excluded from unresolved(). Alias FQN values are
never folded -- OpenMetadata FQNs are case-preserving, so aliases[] must keep
the source's original casing. Bounded caps and warn-once flags on both
_targets and _explicit_unresolved are untouched.

Added 3 tests to TestSynonymMap covering case-insensitive lookup in both
casing directions, original-case preservation of the returned alias, and
consumption-tracking correctness across a case mismatch; all pre-existing
exact-case tests continue to pass unmodified.

* fix(search): wire aliases into the table query and drop the dead boost

I1: the aliases field was added to the search document and to
searchSettings.allowedFields, but neither is consulted when building
the actual Explore query -- ElasticSearchSourceBuilderFactory builds
data-asset queries solely from assetTypeConfigurations[table].searchFields,
which never listed aliases. Searching an alias FQN therefore returned
zero results, contradicting the design spec's search guarantee.

Add aliases (boost 5.0, standard match, mirroring TableIndex's intended
columns.name weight) and aliases.keyword (boost 10.0, exact match, for
FQN-precise ranking) to the table searchFields, and aliases to
highlightFields so a match actually produces highlight fragments.

Also remove TableIndex.getFields()'s dead "aliases" boost entry --
getFields() has zero production callers for TableIndex, so the entry
did nothing -- and replace the vacuous test that asserted on it with
one that asserts against the settings-driven path search actually
uses.

* fix(migration): backfill the aliases search settings on upgrade

I2: searchSettings.json is seed data merged additively on startup --
only whole missing asset types get added to an already-installed
instance's stored settings, so upgraded clusters would keep their old
table entry forever and never pick up the aliases searchField/
highlightField from the previous commit. Alias search would work on
fresh installs but stay broken on every upgrade.

Add v210.MigrationUtil.addAliasesSearchSettings(), following the
get/load/merge/save/log skeleton from v200's
backfillSearchRankingSettings() and the hand-rolled boolean-returning
merge-helper pattern from v1132/v11210's search-settings fixes.
Idempotent.

Neither mysql/v210/Migration.java nor postgres/v210/Migration.java
existed yet (2.1.0's data migration was SQL-only so far), so both are
added here to carry the call -- migration class resolution is purely
reflective on the version-derived package name.

* fix(search): drop ignore_above 256 on aliases.keyword in index mappings

M1: fullyQualifiedName's keyword has no ignore_above, and the schema
permits FQNs up to 3072 chars, but aliases.keyword was capped at 256 --
an alias FQN longer than that is silently dropped from the index with
no diagnostic, and es_search_from_alias can never resolve it.

SearchIndexSettings.harden() already backfills ignore_above on any
keyword field lacking one, using the dynamically computed safe char
threshold (well above 3072) -- the same mechanism fullyQualifiedName
relies on -- so removing the static cap does not leave the field
unbounded. Applied identically to all four locale mapping files.

* refactor(lineage): remove tautological guard in search_table_entities

M4: "if table_entities: return table_entities" two lines above the
alias-fallback block already guarantees table_entities is empty by the
time "if not table_entities:" is reached, so the guard was always
true. Drop it and de-indent; no behavior change.

* docs(ingestion): fix stale source_hash docstrings after aliases sort

M5: _normalize_for_hash and generate_source_hash's docstrings still
listed only columns/tags/tableConstraints/owners as sorted, but
aliases was added to the sort list when the mssql synonym feature
landed. Update both to mention it.

* feat(ui): show the alias name instead of the full FQN in the Aliases widget

The service, database and schema are already established by the table page
the widget sits on, so only the trailing name carries new information. The
full FQN stays available as the cell's title attribute.

Also drops the direct antd/lib/table import that tw-guard rejects for new
files, deriving the column type from the shared Table wrapper's own props.

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

* feat(mssql): gate synonym ingestion and alias lineage resolution behind includeSynonyms

The alias fallback in search_table_entities fired for every connector's
lineage resolution, costing an extra exact-match search per unresolved
table name even for sources that can never produce aliases.

Adds includeSynonyms to the MSSQL connection. It gates both halves:
prepare() skips the sys.synonyms sweep entirely when disabled, and the
lineage resolver consults aliases only for services that opt in.

The resolver reads the opt-in by field name rather than by service type,
so a connector adding the same field (Oracle synonyms) participates
without this service-agnostic module learning connector names. The
per-service result is cached in a bounded LRU, so an opted-out service
costs one lookup per run rather than one per unresolved name.

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

* refactor(migration): move the table aliases search-settings backfill from v210 to v1135

The backfill ships with 1.13.5, not 2.1.0, so it belongs on that release
train. Extracted out of v210.MigrationUtil into its own
v1135.TableAliasesSearchSettingsMigration, matching the one-class-per-concern
shape the rest of v1135 uses, and v210 is back to exactly what main has.

* feat(mssql): make includeSynonyms opt-in

Synonym discovery costs an extra sys.synonyms query per in-scope database and
turns on an extra exact-match search per unresolved name during lineage, so
every MSSQL service paid for it on upgrade whether or not it has synonyms.
Default to false and let the operator turn it on.

The gate already treated an absent field as off (service_resolves_aliases
reads it with getattr(..., False)), so this only changes what a service that
never set the toggle gets.

* Update generated TypeScript types and dereferenced schemas

* refactor(migration): move the table aliases search-settings backfill to a new v202

v1135 was the wrong home: MigrationWorkflow drops an already-recorded version
from the apply list unless it is the max recorded one, and reprocessing only
runs runDataMigration when the version equals that max. Any instance carrying
1.13.5 alongside something newer would therefore never backfill the aliases
searchFields, and alias search would keep returning nothing.

2.0.2 is a fresh version no deployment has recorded, so it is picked up exactly
once on the next upgrade whatever train the instance is on -- an unrecorded
version is applied regardless of its ordering against the recorded max.

Adds the native 2.0.2 SQL directories for both engines (empty, like 2.0.1 --
this is a data migration only) and MigrationWiringTest, because a mismatch
between the directory name and the Java package silently resolves to the
default no-op migration class with no error.

* Fix UI checkstyle

Prettier collapses the ALIAS_NAMES array onto one line. The playwright lint
step is new to this branch -- it arrived with #31994 in the merge from main, so
this spec had never been format-gated.

* Fix Python checkstyle

py_format_check gained a suppressions ratchet in the merge (#31643, the same
commit as the typing modernization). It rejects two things this branch had:
five f-string logging calls not in the G004 baseline, and two '# noqa: UP045'
suppressions -- the ratchet forbids suppressing the codes it enforces rather
than fixing them.

Converted the logging to lazy %-style and the annotations to 'X | None', which
made the typing import in synonyms.py unused. The G004 baseline is untouched:
its fingerprints are content-based, so the pre-existing debt in sql_lineage.py
and mssql/metadata.py still matches.

* test(ui): add table aliases to the default search settings fixture

The Playwright fixture mockEntitySearchConfig deep-equals the table config
returned by PUT /system/settings/reset/searchSettings. Adding the aliases
search fields and highlight field to searchSettings.json made that assertion
fail in all three SearchSettings specs that call restoreDefaultSearchSettings.

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

* Fix UI checkstyle: reduce getWidgetHeight complexity in TableClassBase

Adding the TABLE_ALIASES case pushed the getWidgetHeight switch to a
cyclomatic complexity of 11, over the sonarjs limit of 10. Replace the
switch with a lookup against an explicit list of the keys it handled, so
widgets absent from that list still fall back to height 1 (notably
CUSTOM_PROPERTIES and KNOWLEDGE_ARTICLE, which have entries in
defaultWidgetHeight but were never cased). Add TableClassBase.test.ts to
pin that behaviour; it passes against both the old switch and the lookup.

This also clears the Licence Header check, which only failed because
`yarn lint:base --fix` aborted on the ESLint error before the lint step
could revert organize-imports' writes.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Shailesh Parmar <[email protected]>
(cherry picked from commit ab788cf)

* Fixes 33374: allow Table.aliases through the entity patch (#33375)

Aliases are recomputed from the source on every run, but every table that
already exists in OpenMetadata is updated through a PatchRequest, and
build_patch diffs both models through `include=allowed_fields`. With
`aliases` missing from the allow-list the field could never produce an
operation, so SQL Server synonyms only ever landed on tables created for
the first time - silently, with no error and a 100% success run.

(cherry picked from commit c4fce13)

* refactor(migration): move the table aliases search-settings backfill to 2.0.3

2.0.2 is already released, and MigrationWorkflow selects versions by exact
set membership against SERVER_CHANGE_LOG: a cluster that has already recorded
2.0.2 never re-applies it, so a data migration retro-fitted into that slot
never runs and alias search keeps returning nothing on exactly the upgraded
instances it was written for.

2.0.3 is unrecorded everywhere, so it is picked up exactly once on the next
upgrade. v202 keeps its own two search-settings repairs, which shipped with
2.0.2 and are out of scope here.

Adds the native 2.0.3 SQL directories for both engines (empty, like 2.0.1 --
this is a data migration only) and a MigrationWiringTest for 2.0.3, because a
mismatch between the directory name and the Java package silently resolves to
the default no-op migration class with no error.

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

* chore(playwright): auto-refresh impact-map.generated.json [skip ci]

* Fixes 31478: stop Data Insights summary cards counting test case results (#31759)

* fix(data-insights): exclude data-quality docs from data-asset totals

The di-data-assets-* pattern the charts read also resolves the data-quality
aliases (di-data-assets-testcaseresult, -testcaseresolutionstatus) that #29963
attached to the live test case indices. TestCaseResult and
TestCaseResolutionStatus are EntityTimeSeriesInterface, not EntityInterface, so
SearchIndex.populateCommonFields never runs for them and their documents carry
no entityType.

That split the two "total data assets" charts. total_data_assets groups with a
terms aggregation on entityType.keyword, which puts a document missing the field
in no bucket, so those documents vanished. total_data_assets_summary_card
filtered with a list of bool.must_not.term clauses on the same field, every one
of which a document lacking it satisfies, so they were counted. The card ran
ahead of the breakdown beneath it by exactly the number of test case results in
the window, and the same inflated denominator depressed the description, owner
and tier percentages.

Give the charts one definition of a data asset in
DataInsightSystemChartRepository: DATA_ASSET_FILTER now requires
exists(entityType) alongside the exclusions, and NON_DATA_ASSET_ENTITY_TYPES
feeds both the filter and the breakdown's excludeGroups so the two cannot drift
again. That also closes a second gap in the opposite direction, where the filter
excluded dataProduct but excludeGroups did not.

The 1.13.4 migration re-applies the scope to the fourteen stored charts,
rewriting only the filter and excludeGroups so anything else in a stored
definition survives.

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

* fix(data-insights): move the chart scope migration to 1.13.5

1.13.4 is frozen: #31386 deliberately made main's copy byte-identical to the
1.13 branch, and any deployment that already ran it under a 2.0.0-rc build would
skip a data migration added there, because shouldRunDataMigration only re-runs a
reprocessed version when it equals the current max.

A new 1.13.5 directory has been executed by nobody, so processNativeMigrations
applies it to every deployment regardless of it sorting below the current max
version. The SQL files are empty because the change is pure data migration,
matching the existing 0-byte 1.13.3 schemaChanges.sql.

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

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: IceS2 <[email protected]>
(cherry picked from commit 1b5914c)

* Fixes #31478: re-scope the Data Insights data asset charts in 1.13.6 SQL (#33049)

PR #31759 rewrote the stored chart definitions from a Java data migration hung
off 1.13.5. 1.13.5-release had already shipped and been recorded by then, and
MigrationWorkflow never reaches runDataMigration() for a recorded version once
it is no longer the release train's highest: processNativeMigrations drops it
outright, and even while it is the highest, filterAndGetMigrationsToRun skips a
reprocessing version whose SQL has all run. So no deployment ran it, and
release-1-13 still serves the pre-fix definitions — its breakdown shows a Data
Products bucket the migrated excludeGroups excludes, and the summary card sits
28 above the sum of the buckets.

Express the repair as SQL in 1.13.6 instead. runSchemaChanges and
runPostDDLChanges are not behind shouldRunDataMigration, and parseSQLFiles keeps
any statement whose checksum is absent from SERVER_MIGRATION_SQL_LOGS, so new
SQL in the train's highest version runs even where that version is already
recorded. That covers all three states: release-1-13 (1.13.6 recorded,
reprocessed), a customer whose max is 1.13.5 (1.13.6 fresh), and 2.x on main
(1.13.6 fresh). Both statements are guarded on the stored value, so a deployment
that already holds the corrected definitions is untouched.

The 1.13.5 Java migration and DataInsightChartMigration are removed;
DataInsightSystemChartRepository keeps DATA_ASSET_FILTER and
NON_DATA_ASSET_ENTITY_TYPES as the scope the aggregators and the OpenSearch
regression test read, and the SQL is pinned to them by test. Its SearchClient
moved out of a static initializer, which made the class NPE before the
application is up — that is also why the old migration's unit test only passed
when co-run with the OpenSearch test that installs a SearchRepository.

Verified end to end against the engine versions OpenMetadata ships (mysql:8.0.46
and postgres:15.19), on the 1.5.0 table DDL seeded with pre-fix definitions as
1.5.0/1.6.0 leave them. Both engines report identical row counts — 5 filter
rewrites and 2 breakdown rewrites, then 0 and 0 on a second run — and converge
on identical JSON, with filter stored as a JSON string and excludeGroups as an
array:
- the breakdown gains the filter and drops dataProduct; the cards' stale
  must_not filter is replaced; a chart grouped on tier.keyword gets the filter
  but is not given entity-type excludeGroups
- an already-migrated definition, and a user's own chart grouped on
  entityType.keyword, are both left byte-identical
- a definition with two metrics is skipped by the JSON_LENGTH/jsonb_array_length
  guard rather than half-rewritten

The rollout claim was also driven through the real MigrationWorkflow against a
real MySQL and the real bootstrap/sql/migrations tree: with 1.13.6 recorded in
SERVER_CHANGE_LOG it is still offered, and once its two statement checksums are
in SERVER_MIGRATION_SQL_LOGS it drops out — so the repair reaches an
already-upgraded deployment exactly once.

Tests:
- DataAssetChartScopeSqlMigrationTest: the SQL embeds DATA_ASSET_FILTER and the
  excludeGroups verbatim, both dialects scope the same 14 charts, every UPDATE is
  guarded, each file parses into exactly 2 statements through the same Flyway
  dialect parser the workflow uses, and the post-migration JSON captured from the
  real database deserializes into LineChart/SummaryCard with the scope applied.
- MigrationWorkflowReprocessingTest: the 1.13.4/1.13.5/1.13.6 rollout the Java
  migration was lost to, and that new SQL on the highest recorded version is what
  brings a version back.
- DataAssetChartScopeTest (real OpenSearch node): summary card equals the
  breakdown sum.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit c489498)

* refactor(migration): carry the #31478 Data Insights chart rescope in the 2.0.3 slot

On main the re-scope ships as SQL under bootstrap/sql/migrations/native/1.13.6,
which is the right slot for the 1.13 train but unreachable on this one.
MigrationWorkflow selects versions by exact set membership against
SERVER_CHANGE_LOG and drops an already-recorded version unless it is the
recorded maximum. On a 2.0.x deployment a 1.13.6 directory is therefore either
already recorded (upgraded from the 1.13 train, where it was the max) or is no
longer the max because 2.0.x sits above it -- in both cases the statements are
never offered, and the summary cards keep out-counting the breakdown beneath
them.

2.0.3 is unrecorded everywhere on this train, so the statements are applied
exactly once on the next upgrade. Both UPDATEs are guarded on the stored value,
so a deployment that already picked the fix up on 1.13.6 before upgrading is
left untouched.

- bootstrap/sql/migrations/native/{1.13.5,1.13.6}/ dropped -- 2.0's native
  directories stop at 1.13.4, and nothing references them now that #33049's
  revert removed the v1135 Java classes.
- The SQL moves verbatim into the 2.0.3 postDataMigrationSQLScript.sql that the
  table-aliases commit already created (its header note is rewritten for this
  train); the v203 Java data migration and this SQL share the slot without
  interacting.
- DataAssetChartScopeSqlMigrationTest moves to the v203 package and reads the
  2.0.3 path, with its fixtures under test/resources/migration/v203.
  migrationParsesWithTheDialectParser now drives the real MigrationFile
  instance API, because 2.0 has no static MigrationFile.parseSQLFile -- which
  exercises the same parse path the workflow takes rather than a helper.

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

* test: fix 2.0.3 unit tests after merging 2.0

Declare om:aliases in the RDF ontology for the new Table.aliases field, and
scope DataAssetChartScopeSqlMigrationTest to di_chart_entity statements now
that 2.0.3 postDataMigrationSQLScript.sql also carries the RdfIndexApp updates.

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Shailesh Parmar <[email protected]>
Co-authored-by: IceS2 <[email protected]>
Co-authored-by: Anujkumar Yadav <[email protected]>

This branch was previously deployed

1 inactive deployment
test — bd3ff5d7 Deployed Jul 14, 2026 by IceS2 via playwright-ci-postgresql (4, 7) #56520
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion 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.

Data Insights charts undercount resolved data quality incidents

7 participants