Detect asset-level deletion in backfill staleness checks#603
Open
rakhiagr wants to merge 9 commits intolinkedin:masterfrom
Open
Detect asset-level deletion in backfill staleness checks#603rakhiagr wants to merge 9 commits intolinkedin:masterfrom
rakhiagr wants to merge 9 commits intolinkedin:masterfrom
Conversation
Tests cover: - Stale emitTime (50 < deletion time 100) → no-op - Newer emitTime (200 >= deletion time 100) → write succeeds (resurrection) - Missing emitTime with soft-deleted aspect → no-op Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The else-if already implies isSoftDeleted is true since the first branch checked !isSoftDeleted. Simplifies to just `else if (oldValue == null)`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…boundary test - Change >= to > in soft-deleted emitTime comparison for consistency with the non-deleted branch. Events at the exact same ms as deletion are treated as stale (likely in-flight when delete occurred). - Add log.warn when a backfill has valid emitTime but the soft-deleted entry has no deletion timestamp — makes silent no-ops diagnosable. - Add boundary test: emitTime == deletionTimestamp → no-op. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ecision-making in a dedicated method
…JSON
Previously, soft-deleted aspects stored only {"gma_deleted":true} with no
deletion metadata. The shouldBackfill() logic (Gap 1 fix) compared emitTime
against the entity-level lastmodifiedon column, which gets corrupted by
unrelated aspect updates on the same entity.
Changes (new schema only):
- SoftDeletedAspect.pdl: Add optional deleted_timestamp and deleted_by fields
- EbeanLocalAccess: Write enriched JSON with deletion timestamp and actor
- EBeanDAOUtils.readSqlRow: Extract per-aspect deleted_timestamp from JSON,
fall back to entity-level lastmodifiedon for legacy rows
- EBeanDAOUtils.isSoftDeletedAspect: Use parsing-based detection instead of
exact string equals, so enriched JSON is correctly identified
- Tests for buildDeletedValue, isSoftDeletedMetadata, enriched write path
Old schema and dual schema paths are unchanged.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…and improve related methods
…c for soft-deleted aspects
When an entity is deleted via deleteAll()/softDeleteAsset(), the entity row's deleted_ts is set to NOW(). batchGetUnion() filters by deleted_ts IS NULL, making these rows invisible and indistinguishable from "never existed" — allowing stale backfills to resurrect them. Fix: When batchGetUnion() returns empty in the new-schema path, query deleted_ts for the URN. If the entity is asset-deleted, return a synthetic soft-deleted EbeanMetadataAspect with the deletion timestamp so shouldBackfill() can correctly compare emitTime > deletionTimestamp. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RFC: https://docs.google.com/document/d/1zOKrxbm_zGxTpMwJ7Wer7owY-YcI0nXDvY6DWRGXj0M/edit?tab=t.0#heading=h.nwcowzxl6in9
Depends on: #602 (Gap 1 + Gap 2 fix)
Backward Compatibility
Testing Done
Unit tests added:
Checklist