Repository navigation
Fix Data Retention Build Issue - #29984
Conversation
❌ 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 |
|
The Java checkstyle failed. Please run You can install the pre-commit hooks with |
Code Review ✅ Approved 1 resolved / 1 findingsUpdates DataRetention failure handling to use schema-backed error objects for orphan pipeline cleanup. The unused HashMap import has been addressed. ✅ 1 resolved✅ Quality: Unused HashMap import added; will fail spotless/checkstyle
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|
🟡 Playwright Results — all passed (29 flaky)✅ 4507 passed · ❌ 0 failed · 🟡 29 flaky · ⏭️ 96 skipped
🟡 29 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
…a Retention build fix (#29984), realign DataRetention with main (#30030) * feat(dataRetention): sweep orphan time-series rows for per-type tables (#28384) * feat(dataRetention): sweep orphan time-series rows for per-type tables Adds `cleanOrphanedTimeSeriesRows()` to `DataRetention` alongside the existing orphan-relationship and orphan-tag sweeps. Each of the five affected DAOs gets a `deleteOrphanedRecords(int limit)` query (MySQL + PostgreSQL) that left-joins to its parent and deletes rows the parent no longer covers: - `testCaseResolutionStatus`: parent link via `entity_relationship` PARENT_OF - `agentExecution`: `agentId` → `ai_application_entity.id` - `mcpExecution`: `serverId` → `mcp_server_entity.id` - `profile_data`: `entityFQNHash` → `table_entity.fqnHash` - `query_cost_time_series`: `entityFQNHash` → `query_entity.fqnHash` The sweep runs after `cleanOrphanedRelationshipsAndHierarchies()` so the PARENT_OF check sees the post-cleanup `entity_relationship` state. Pairs with PR #28367, where the bulk hard-delete cascade now skips time-series children and relies on `DataRetention` to reclaim them out-of-band. Adds `OrphanedTimeSeriesCleanupIT` covering all five per-type queries: inserts a real-parent row and a bogus-parent row through the existing DAO `insert(...)` paths, runs `deleteOrphanedRecords(BATCH)`, asserts the orphan is gone and the valid row is preserved. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * test(dataRetention): fix orphan-cleanup IT name lengths and McpExecution table arg - McpExecutionDAO.insertWithoutExtension uses `<table>` placeholder; the test was passing `null`, which made Jdbi fail to render the SQL template. Pass the literal table name `mcp_execution_entity`. - `ns.prefix(...)` embeds class + method names, so chaining it through database -> schema -> table -> auto-created test_suite pushed the test_suite `name` column past its VARCHAR(256) bound. Use `ns.uniqueShortId()` for the hierarchy components and shorten the test method names so the resulting FQN stays well under the column limit. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * review(dataRetention): bound profile-data orphan delete by rows + clarify PARENT_OF=9 Addresses two PR review findings: - `profiler_data_time_series.deleteOrphanedRecords` previously LIMITed distinct `entityFQNHash` values, then deleted every row for each hash — a batch could delete tens of millions of rows if many orphan hashes each had thousands of rows. Switch to row-level limiting: single-table `DELETE ... WHERE NOT EXISTS (...) LIMIT N` on MySQL, and `ctid IN (SELECT ... LIMIT N)` on PostgreSQL (the table has no `id` column, so we use Postgres ctid for the inner subquery). This matches the row-count cap used by the other four orphan-cleanup queries. - Annotate `er.relation = 9` in the testCaseResolutionStatus query with a `// 9 = Relationship.PARENT_OF` inline comment plus a leading block comment noting the ordinal is stable because the enum appends new values. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> (cherry picked from commit 5f5a123) * fix(search-indexing): reclaim orphaned ingestion pipelines and guard null testDefinition during reindex (#29836) Two reindex failures observed in SearchIndexingApplication that DataRetention did not cover: 1. Orphaned ingestion pipelines. When a service (or test suite) is hard-deleted without the cascade reaching its ingestion pipeline, the pipeline row survives with no incoming CONTAINS relationship. Reindex then throws "Entity type ingestionPipeline <id> does not have expected relationship contains to/from entity type null" because IngestionPipelineRepository.setFields resolves the container via getContainer (mustHaveRelationship=true). Nothing swept these. Adds OrphanIngestionPipelineCleanup (mirrors OrphanTestCaseRelationshipCleanup) wired into DataRetention: pages pipelines, finds ones with no container, and hard-deletes them via the standard delete with a force-delete fallback (search doc, pipeline-status time series, relationship rows, entity row) since the standard delete itself resolves the missing container and throws. 2. NullPointerException building the TestCase search doc. TestCaseIndex called testCase.getTestDefinition().getId() with no null check, so a test case whose testDefinition relationship is gone NPE'd. Unlike the "expected relationship" errors, this NPE is not classified as a stale-reference warning, so it failed the reindex outright. Guards the lookup exactly like TestCaseResultIndex does. Adds OrphanIngestionPipelineCleanupIT covering selective deletion (orphan removed, healthy pipeline preserved). Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> (cherry picked from commit b8d9f3e) * Fixes #20753: replace non-schema jobStackTrace with IndexingError.stackTrace (#29965) * Fixes #20753: replace non-schema jobStackTrace with IndexingError.stackTrace App failure contexts wrote an ad-hoc "jobStackTrace" map key that is not part of the schema. The failureContext.failure field is already typed as IndexingError, which has a schema-defined stackTrace field. Use the typed IndexingError (matching the canonical pattern used across the other apps) instead of raw maps, deduplicating DataRetention's repeated failure blocks. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * Convert DataContractValidationApp failure to typed IndexingError Replace the generic Map<String, Object> failure collector with the typed IndexingError: the top-level exception populates message/stackTrace, and the per-entity errors go into the schema's failedEntities (EntityError) list instead of being keyed by FQN in a raw map. Makes all three apps consistent with the schema-defined failureContext.failure shape. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> (cherry picked from commit a33d41c) * Fix Data Retention Build Issue (#29984) * Fix Data Retention Build Issue * Checkstyle (cherry picked from commit ee2a438) --------- Co-authored-by: Sriharsha Chintalapani <[email protected]> Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>



Describe your changes:
Fixes #
I worked on ... because ...
Type of change:
High-level design:
N/A — small change.
Tests:
Use cases covered
Unit tests
Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Summary by Gitar
HashMapwithIndexingErrortype forfailureDetailsinDataRetention.java.setMessageandsetStackTracefor improved type consistency.This will update automatically on new commits.
Greptile Summary
This PR fixes the data retention failure details shape. The main changes are:
IndexingErrorobject.setMessage.setStackTrace.Confidence Score: 5/5
This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "Checkstyle" | Re-trigger Greptile
Context used (3)