Repository navigation
[2.0] Restore Data Insights snapshots after version-history exhaustion - #36273
Conversation
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.
Code Review ✅ Approved🟡 Medium risk · Extending Data Insights history with the oldest retained entity version could assign approximate state to uncovered days and alter historical snapshot analytics. Backports the Data Insights snapshot repair to 2.0, filling uncovered days with the oldest available version bounded by the earliest retained EntityCreated event in activity_stream. No open findings; the change is approved. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
| if (remaining.windowStartTimestamp() > remaining.windowEndTimestamp()) { | ||
| return; | ||
| } | ||
| Long createdAt = creationTimeLookup.apply(entityType, id); | ||
| if (createdAt == null) { | ||
| return; |
There was a problem hiding this comment.
appendCreationWindow adds two early returns. The repository guide requires one return at the end and explicitly forbids early-return guards. Put the lookup and append steps behind conditions, or extract helpers. This requirement must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| if (remaining.windowStartTimestamp() > remaining.windowEndTimestamp()) { | ||
| return; | ||
| } | ||
| Long createdAt = creationTimeLookup.apply(entityType, id); |
There was a problem hiding this comment.
The additions leave unchanged local variables and parameters without final, contrary to the repository guide. Examples include createdAt and start here, and config in runDataInsights. Apply final throughout the additions where values do not change. This requirement must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| assertEquals(AppRunRecord.Status.FAILED, app.reported.getStatus()); | ||
| IndexingError failure = | ||
| (IndexingError) app.reported.getFailureContext().getAdditionalProperties().get("failure"); | ||
| assertTrue(failure.getMessage().contains("Backfill requires both startDate and endDate")); |
There was a problem hiding this comment.
Assertion breaks the string rule
The new assertion passes a raw string to contains. The repository guide explicitly forbids raw strings in contains calls. Define a named constant for the expected error text and use it here. This requirement must be satisfied before merging.
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Describe your changes
Adapted backport of #36245 to
2.0, including its scheduled-run regression correction. The source PR is still open. No separate issue is linked, as requested.When lifecycle-only ingestion advances
updatedAtwithout a version bump, Data Insights can exhaust version history inside its rewrite window and omit earlier days. Fill those uncovered days with the oldest available version, bounded by creation evidence and the requested window.Type of change
High-level design
2.0has neither thecreatedAtschema field nor theCreationAuditedinterface used on main. This port reads the earliest retainedEntityCreatedevent fromactivity_stream, using its existing(entityType, entityId, timestamp)index. It queries only after history exhaustion leaves uncovered days. There are no schema or migration changes.The fallback starts at the later of the requested start day and the creation-event day. If no creation event remains, it preserves the existing windows. It does not infer creation from
updatedAtor source-system lifecycle timestamps.Limitation: assets created before activity-stream recording was enabled, or whose creation events have expired, cannot be repaired by this fallback. It also leaves wrong-version attribution when older history already covers a day outside scope; that is tracked in #36248.
Backfill dates are validated only during enabled manual runs, inside the run error handler. Scheduled runs and app initialization ignore incomplete backfill settings.
Sources: commits
05c972f2d0and4afb297124from #36245. Reviewed backport commit:1a51fb88ee4365e6938ed00665ae6792b3256fd2.Tests
Local validation: PASSED for the scopes below.
Unit classes:
DataAssetTypeCoverageTest(4),DataInsightsAppTest(3),DataInsightsBackfillTest(8),DataInsightsEntityEnricherProcessorTest(18),VersionResolverTest(12).Measured unit line coverage:
VersionResolver63/69 lines (91.3%);DataInsightsApp.Backfill7/7 lines (100%).MySQL integration classes:
AppsResourceIT(40 tests, 6 skips),DataInsightsEnricherBehaviorIT(11),EnricherBulkVsHistoryPathEquivalenceIT(12). All eight new regression cases executed without skips:The PostgreSQL check invoked the committed
CollectionDAO.ActivityStreamDAOthrough Jdbi against a temporary PostgreSQL 16 database. Five assertions checked earliest creation, update-event exclusion, entity ID/type isolation, and absent-event null results. The full PostgreSQL/OpenSearch application lane was not run.The first MySQL attempt was aborted because stale main-branch app-definition resources prevented app initialization. All backend reactor outputs were then cleaned, and the unit and MySQL integration scopes above passed from clean outputs.
spotless:apply,spotless:check,git diff --check, and commit hooks passed. The Java affected-test planner and impact map do not exist on2.0; the scoped classes above were selected from the changed behavior and its callers.Ingestion, UI/Playwright, and UI recording: not applicable. Manual UI testing was not performed; the behavior was exercised by the integration checks above.
Checklist
1a51fb88ee4365e6938ed00665ae6792b3256fd2; each changed source has behavioral coverage, with no unanswered blocking findings.Draft while source PR #36245 remains open and the release-specific creation-evidence adaptation is reviewed.
No blocking behavior defect was established, but the explicit repository style requirements must be satisfied before merging.
Findings
Summary
Restores uncovered Data Insights days after version history runs out.
IceS2 acknowledges the missing-creation-event limitation and defers existing wrong-version attribution for already-covered days to #36248.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Walk version history] --> B{History exhausted?} B -->|No| C[Keep existing version windows] B -->|Yes| D{Uncovered days remain?} D -->|No| C D -->|Yes| E[Read earliest retained creation event] E --> F{Creation event found?} F -->|No| C F -->|Yes| G[Bound start by requested start and creation day] G --> H[Add uncovered days using oldest available version]Reviews (1) · Last reviewed commit: "Backport Data Insights snapshot repair t..." · Reviewed by Greptile