Skip to content

Restore missing Data Insights snapshots when version history is exhausted - #36245

Merged
IceS2 merged 2 commits into
mainfrom
fix-data-insights
Oct 26, 2026
Merged

IceS2 merged 2 commits into
mainfrom
fix-data-insights

Conversation

@IceS2

@IceS2 IceS2 commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes

No linked issue for now.

Data Insights rewrites yesterday and today on every normal run. A lifecycle-only update can advance updatedAt while leaving an old entity at v0.1, causing version-history exhaustion to omit yesterday's snapshot.

Use the entity's OpenMetadata createdAt to fill uncovered days with the oldest available version, bounded by the requested window and creation day. Preserve today's-only coverage for genuinely new entities.

This fills uncovered days only when version history is exhausted. Wrong-version attribution when an older version already covers a day remains separate: #36248.

Keep backfill configuration raw during app initialization. Validate enabled backfill only for manual runs, inside the run's error handler, so invalid dates produce a reported failed run. Scheduled runs ignore backfill settings, including incomplete dates.

Historical backfill still requires trustworthy creation dates. Existing legacy rows whose createdAt is absent or was derived from an already-advanced updatedAt need historical evidence before those dates can be repaired.

Type of change

  • Bug fix

High-level design

N/A — scoped backend bug fix using existing creation-audit fields; no schema, migration, or API shape changes.

Tests

Unit tests rerun for 4afb297124c3897ade687995a55216f47f1ff1d1: 47 passed across DataAssetTypeCoverageTest, DataInsightsAppTest, DataInsightsBackfillTest, DataInsightsEntityEnricherProcessorTest, VersionResolverTest. Initial-fix coverage at 05c972f2d0c76b346d455740c85cf8664fd2d60b: resolver 98.3%; backfill validation 100%. Temporarily disabling the initial fixes produced the expected missing-day and missing-date assertion failures, then the fixes were restored.

Integration regression coverage was added to DataInsightsEnricherBehaviorIT:

  • A lifecycle-only bulk update advances updatedAt, preserves v0.1 and a one-version history, and emits yesterday and today.
  • A table created today emits today only.

Both initial snapshot integration cases passed on real MySQL/Elasticsearch.

The follow-up at 4afb297124c3897ade687995a55216f47f1ff1d1 reran AppsResourceIT on MySQL/Elasticsearch: 40 tests, 34 passed, 6 existing skips, 0 failures or errors. All four new backfill cases executed and passed:

  • Scheduled run with enabled backfill and no dates completes without backfill.
  • Manual run with enabled backfill and no dates reports FAILED with the configuration error.
  • Manual run with valid dates completes with the requested backfill.
  • Manual run with disabled backfill and no dates completes without backfill.

mvn spotless:apply, spotless:check, the Java impact-map check, git diff --check, and commit hooks passed for the follow-up.

Initial validation at 05c972f2d0c76b346d455740c85cf8664fd2d60b: broad run failed; focused retries passed.

The results below apply to the initial fix. The follow-up unit and app-integration results are recorded above; the broad run was not repeated after the validation-timing change.

Scope Tests Failures Errors Skipped Result
Unit tests 47 0 0 0 PASSED
MySQL + Elasticsearch, parallel 1541 0 2 139 FAILED: two glossary API timeouts
MySQL + Elasticsearch, isolated + focused retries 100 0 0 6 PASSED
PostgreSQL + Elasticsearch + Redis 2 0 0 0 PASSED

The broad run timed out in GlossaryTermResourceIT#get_assetsCountsWithParentFilter and #get_assetsCountsWithNoParent. Both methods passed in the isolated run with the original assertions and timeouts. The broad run was not repeated.

Integration classes selected and executed

AppMarketPlaceResourceIT, AppOperationPermissionsIT, AppRunInterruptionIT, AppTriggerConflictIT, AppsResourceIT, BundleWarmupCertificationIT, ConfigResourceIT, CsvAsyncJobResourceIT, DataContractValidationAppIT, DataInsightAggregationIT, DataInsightAliasReconciliationIT, DataInsightChartResourceIT, DataInsightSystemChartResourceIT, DataInsightsEnricherBehaviorIT, DataRetentionAppIT, DatabaseSmokeIT, EnricherBulkVsHistoryPathEquivalenceIT, GlossaryTermResourceIT, IndependentOntologyRetentionIT, K8sOMJobOperatorIT, KpiResourceIT, ReportDataResourceIT, SeedDataPresenceIT, SoftDeleteRetentionIT, SystemAlertsIT, SystemResourceIT, TableResourceIT, TestCaseRelationshipRetentionCleanupIT, UserResourceIT, WebAnalyticEventResourceIT

The isolated run included AppsResourceIT, DataContractValidationAppIT, SystemResourceIT, and the two focused GlossaryTermResourceIT retries. The cache run executed BundleWarmupCertificationIT with PostgreSQL, Elasticsearch, and Redis.

Ingestion and Playwright: N/A — no ingestion or UI changes.

Manual UI testing: not performed. The API/bulk-update scenarios above were exercised by integration tests.

UI screen recording

N/A — backend-only bug fix.

Checklist

  • Regression tests cover the missing-day scenario and the new-entity control.
  • Self-review against REVIEW.md, including follow-up 4afb297124c3897ade687995a55216f47f1ff1d1; initialization no longer validates backfill and scheduled/manual behavior has regression coverage.
  • Impact-map ownership and formatting checks pass.
  • Validation results and the original broad-run timeouts are recorded above.
  • Schema, ingestion, UI recording, and ADR changes are not applicable to this bug fix.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable new issues were found.

Summary

Restores missing Data Insights snapshots after version history runs out, using createdAt to bound the oldest available version.

  • Data asset snapshots now reach back to the entity’s creation day.
  • On-demand backfills now require a complete, ordered date range.

No actionable new issues were found in the changes since the previous review.

Reviews (2) · Last reviewed commit: "Validate Data Insights backfill only for..." · Reviewed by Greptile

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 26, 2026
@IceS2
IceS2 marked this pull request as ready for review October 26, 2026 11:41
@IceS2
IceS2 requested a review from a team as a code owner October 26, 2026 11:41
@IceS2
IceS2 requested review from sonika-shah and a balanced review from Copilot October 26, 2026 11:41
@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.

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 insufficient remaining quota.

Comment on lines +92 to +97
if (oldestVersion != null) {
appendCreationWindow(
windows,
latest,
new VersionedWindow(oldestVersion, startTs, pointerTimestamp, oldestShape));
}

@gitar-bot gitar-bot Bot Oct 26, 2026 •

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: Snapshot backfill rule from creation day has no decision record

This PR changes which days an entity shows up in Data Insights snapshots, and docs/decisions/ has no record for it. The rule is only in the PR description, and the repo squash-merges, so the description never reaches the tree. The description says: "fills uncovered days with the oldest available version, bounded by the requested window and the entity's createdAt" and "Genuinely new entities keep today-only coverage". The skip for legacy rows without createdAt (appendCreationWindow returns early) shows up only as a test name. The code comment at line 140 explains why the window is extended. It does not say that createdAt is the trusted lower bound, or that entities without it are deliberately left without backdated snapshots.

The record would assert: "When an entity's version history ends inside the Data Insights window, the oldest version covers the remaining days, starting no earlier than the UTC start-of-day of the entity's createdAt. Entities without createdAt are never backdated before their oldest version's updatedAt day."

Add a decision record stating the rule, and cite it from the resolver:

// ADR:2026-10-xx-data-insights-snapshots-extend-oldest-version-to-creation-day
private void appendCreationWindow(

Was this helpful? React with 👍 / 👎

Comment on lines +73 to +83
public record Backfill(String startDate, String endDate) {
public Backfill {
if (startDate == null || startDate.isBlank() || endDate == null || endDate.isBlank()) {
throw new IllegalArgumentException("Backfill requires both startDate and endDate");
}
if (TimestampUtils.getTimestampFromDateString(startDate)
> TimestampUtils.getTimestampFromDateString(endDate)) {
throw new IllegalArgumentException("Backfill startDate must not be after endDate");
}
}
}

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.

This check runs in init(), and init() runs on every path, not just on-demand runs. That includes the nightly scheduled run (AbstractNativeApplication.execute() calls init() before startApp()), plus configure, uninstall and app registration at server startup.

So a saved config with backfillConfiguration.enabled: true and a missing date now makes every scheduled run throw in init(). That happens before startApp() reaches the line that drops the backfill for non-on-demand runs (backfill = Optional.empty()). Before this change, that config only broke manual runs, and the nightly job kept working. The Configuration form lets you save it, because neither date is required in the schema.

Because the throw happens outside startApp(), the failed run also skips the catch/finally that marks the job as FAILED and sends the status update.

A possible fix would be to keep init() lenient and build the Backfill only for on-demand runs, inside the try in startApp(). A bad date then fails that run with your clear message, and scheduled runs ignore it:

private Optional<BackfillConfiguration> backfillConfiguration = Optional.empty();

In init(), replacing the "Configure Backfill" block:

    backfill = Optional.empty();
    backfillConfiguration =
        Optional.ofNullable(config.getBackfillConfiguration())
            .filter(backfillConfig -> Boolean.TRUE.equals(backfillConfig.getEnabled()));

In startApp(), replacing the if (!runType.equals(ON_DEMAND_JOB)) block:

      boolean onDemand = runType.equals(ON_DEMAND_JOB);
      backfill =
          onDemand
              ? backfillConfiguration.map(
                  backfillConfig ->
                      new Backfill(backfillConfig.getStartDate(), backfillConfig.getEndDate()))
              : Optional.empty();
      if (!onDemand) {
        recreateDataAssetsIndex = Optional.empty();
      }

It might also be worth adding a test for a scheduled run with enabled: true and no dates, to confirm it still completes.

if (!(latest instanceof CreationAudited audited) || audited.getCreatedAt() == null) {
return;
}
// Non-versioned updates can move even the oldest version's updatedAt past its creation day.

@manerow manerow Oct 26, 2026 •

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.

Non-blocking, just to get the scope right. The same root cause also hits entities with more than one version, and this fix doesn't reach them because their history isn't exhausted.

Example: a table got a description in v0.2 ten days ago, and its lifeCycle changes every night.

  1. Tonight's ingestion moves v0.2's updatedAt to today.
  2. The resolver gives today to v0.2, then gives yesterday to v0.1, the version without the description.
  3. Yesterday is rewritten on every run, so each day's final snapshot is written after the next night's touch. Every finished day ends up showing the previous version.

Counts are right, so it's invisible in "Total Data Assets". But description, owner and tier coverage stay one version behind for tables whose lifeCycle changes daily.

The cause is upstream of Data Insights. updatedAt is documented as "Last update time corresponding to the new version of the entity", but the store paths move it on changes that don't bump the version. That's tracked separately in #36248, not in this PR. Your createdAt fallback stays useful there for data written before such a fix.

For now, it might be worth narrowing the title and description to what this PR fixes: entities with a single version dropping out of earlier days after a lifeCycle-only update.

@IceS2 IceS2 changed the title Fix Data Insights snapshots after non-versioned updates Restore missing Data Insights snapshots when version history is exhausted Oct 26, 2026
Copilot AI balanced review requested due to automatic review settings October 26, 2026 12:58

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 insufficient remaining quota.

@gitar-bot

gitar-bot Bot commented Oct 26, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 0 closed / 1 findings

🟡 Medium risk · Extending exhausted version history from createdAt could populate inaccurate historical Data Insights snapshots when creation audit dates are unreliable.

Restores missing Data Insights snapshots when an entity's version history is exhausted, by filling uncovered days from the oldest available version bounded by the requested window and the entity's createdAt. Changes requested: the new backfill rule in VersionResolver.java has no decision record under docs/decisions/, and since the repo squash-merges, the rule currently lives only in the PR description. Add a record stating that the oldest version covers remaining days, starting no earlier than the UTC start-of-day of createdAt, and that entities without createdAt are never backdated before their oldest version's updatedAt day.

⚠️ Quality: Snapshot backfill rule from creation day has no decision record

📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/workflows/dataAssets/processors/enricher/VersionResolver.java:92-97 📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/workflows/dataAssets/processors/enricher/VersionResolver.java:135-149

This PR changes which days an entity shows up in Data Insights snapshots, and docs/decisions/ has no record for it. The rule is only in the PR description, and the repo squash-merges, so the description never reaches the tree. The description says: "fills uncovered days with the oldest available version, bounded by the requested window and the entity's createdAt" and "Genuinely new entities keep today-only coverage". The skip for legacy rows without createdAt (appendCreationWindow returns early) shows up only as a test name. The code comment at line 140 explains why the window is extended. It does not say that createdAt is the trusted lower bound, or that entities without it are deliberately left without backdated snapshots.

The record would assert: "When an entity's version history ends inside the Data Insights window, the oldest version covers the remaining days, starting no earlier than the UTC start-of-day of the entity's createdAt. Entities without createdAt are never backdated before their oldest version's updatedAt day."

Add a decision record stating the rule, and cite it from the resolver
// ADR:2026-10-xx-data-insights-snapshots-extend-oldest-version-to-creation-day
private void appendCreationWindow(
🤖 Prompt for agents
Code Review: Restores missing Data Insights snapshots when an entity's version history is exhausted, by filling uncovered days from the oldest available version bounded by the requested window and the entity's `createdAt`. Changes requested: the new backfill rule in `VersionResolver.java` has no decision record under `docs/decisions/`, and since the repo squash-merges, the rule currently lives only in the PR description. Add a record stating that the oldest version covers remaining days, starting no earlier than the UTC start-of-day of `createdAt`, and that entities without `createdAt` are never backdated before their oldest version's `updatedAt` day.

1. ⚠️ Quality: Snapshot backfill rule from creation day has no decision record
   Files: openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/workflows/dataAssets/processors/enricher/VersionResolver.java:92-97, openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/insights/workflows/dataAssets/processors/enricher/VersionResolver.java:135-149

   This PR changes which days an entity shows up in Data Insights snapshots, and `docs/decisions/` has no record for it. The rule is only in the PR description, and the repo squash-merges, so the description never reaches the tree. The description says: "fills uncovered days with the oldest available version, bounded by the requested window and the entity's createdAt" and "Genuinely new entities keep today-only coverage". The skip for legacy rows without `createdAt` (`appendCreationWindow` returns early) shows up only as a test name. The code comment at line 140 explains why the window is extended. It does not say that `createdAt` is the trusted lower bound, or that entities without it are deliberately left without backdated snapshots.
   
   The record would assert: "When an entity's version history ends inside the Data Insights window, the oldest version covers the remaining days, starting no earlier than the UTC start-of-day of the entity's `createdAt`. Entities without `createdAt` are never backdated before their oldest version's `updatedAt` day."

   Fix (Add a decision record stating the rule, and cite it from the resolver):
   // ADR:2026-10-xx-data-insights-snapshots-extend-oldest-version-to-creation-day
   private void appendCreationWindow(

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

@IceS2
IceS2 added this pull request to the merge queue Oct 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-26T16:11:01Z)

Blocked the queue: integration-tests-postgres-opensearch

@IceS2
IceS2 added this pull request to the merge queue Oct 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-26T17:20:43Z)

Blocked the queue: integration-tests-mysql-elasticsearch

@IceS2
IceS2 added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 633340a Oct 26, 2026
98 of 102 checks passed
@IceS2
IceS2 deleted the fix-data-insights branch October 26, 2026 19:09
IceS2 added a commit that referenced this pull request Oct 27, 2026
Adapt PR #36245 (05c972f and 4afb297) to the release branch.
Use retained activity-stream creation events to bound uncovered snapshot
days because 2.0 has no creation-audit field. Preserve missing-evidence
behavior and validate backfill dates only inside manual run handling.

Cover creation boundaries, lifecycle-only bulk updates, creation-event
filtering, and scheduled/manual backfill execution.
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.

3 participants