Repository navigation
Conversation
taskr run 0142. `restoreChildren` now skips time-series children so soft-deleted test cases with incidents restore via both `/restore` and upsert; the two new integration tests failed before the fix and pass after it, and all planned checks pass.
❌ 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 |
…dition assert the actual PARENT_OF edge The incident-task mirror records are written asynchronously and best-effort by the incident workflow, and counting relationships to the incidentId counts the task's CREATED edges — so the old guard could hold with no resolution-status child present and the tests could pass vacuously. Create the resolution-status record directly instead (record plus its PARENT_OF edge are written synchronously in one transaction) and assert the edge count is exactly 1.
Code Review ✅ Approved🟡 Medium risk · Skipping time-series children during subtree restoration changes restore behavior and could mishandle child types that require repository-based restoration. Restoring a soft-deleted TestCase with incident history no longer fails with a 404, because restoreChildren now skips time-series children such as testCaseResolutionStatus, matching the existing bulk-path and delete-side filters. Regression tests cover both the restore endpoint and create-or-update on a soft-deleted case. No issues found. 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 |
🚦 Removed from the merge queue —
|
Summary
Restoring a soft-deleted TestCase with incident history (TestCase --PARENT_OF--> testCaseResolutionStatus edges) failed with a 404 "Entity repository for testCaseResolutionStatus not found" because restoreChildren looked up a repository for the time-series child. Time-series entities are registered — in their own registry,
ENTITY_TS_REPOSITORY_MAP, consulted viaEntity.getEntityTimeSeriesRepository()— but not inENTITY_REPOSITORY_MAP, which is the only mapEntity.getEntityRepository(type)consults, so that lookup throws (#35826). The fix adds an early skip for time-series children in restoreChildren in EntityRepository.java, mirroring the filter the bulk path already applies in dispatchToContainedChildren and that deleteChildren applies on the delete side — subtree soft-delete/restore cascades never touch time-series children, so skipping (rather than dispatching to the time-series repository) is the symmetric fix. Because create-or-update on a soft-deleted entity funnels through the same applyPut → restoreEntity → restoreChildren path as PUT /v1/dataQuality/testCases/restore, this one change fixes both failing flows. Two regression tests were added to TestCaseResourceIT, one for the restore endpoint and one for create-or-update on a soft-deleted case. Each test creates a resolution-status record directly and asserts its PARENT_OF edge exists (count == 1) before soft-deleting, so it cannot pass vacuously. Reviewers should start with the change in restoreChildren and check that the skip condition matches the dispatchToContainedChildren filter.Implementer's note:
restoreChildrennow skips time-series children so soft-deleted test cases with incidents restore via both/restoreand upsert; the two new integration tests failed before the fix and pass after it, and all planned checks pass.Plan
TestCaseResourceIT.javaand run them on unfixed code, confirming the 404 "Entity repository for testCaseResolutionStatus not found" reported in issue Restoring a soft-deleted TestCase with incidents fails: "Entity repository for testCaseResolutionStatus not found" #35826.openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java, extendrestoreChildren(UUID, String): inside theidsByTypeloop, add an earlyif (Entity.isTimeSeriesEntity(entry.getKey())) { continue; }before the repository lookup — mirroring the exact filter the bulk path uses indispatchToContainedChildrenand thatdeleteChildrenapplies on delete. Keep the added comment minimal, citing the dispatchToContainedChildren parity and the TestCase --PARENT_OF--> testCaseResolutionStatus case. No other changes: do not touchdispatchToContainedChildren,ENTITY_REPOSITORY_MAP/ENTITY_TS_REPOSITORY_MAP, or any REST/schema/relationship code. This one fix covers both failing paths, since PUT create-or-update on a soft-deleted entity funnels throughapplyPut→restoreEntity→ the samerestoreChildren.openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/TestCaseResourceIT.java, following the shape oftest_testCaseSoftDeleteAndRestore_200_OKand the direct resolution-status creation pattern oftest_hardDeleteReapsResolutionStatusChildren:a.
test_testCaseSoftDeleteAndRestoreWithIncident_200_OK— create a test case, create a resolution-status child, soft-delete it, thenrestoreEntity(id)(PUT /v1/dataQuality/testCases/restore); assert 200 andgetEntityreturns the case withdeleted=false.b.
test_testCaseCreateOrUpdateOnSoftDeletedWithIncident_200_OK— same setup, then re-send the create request viaupdateEntity(the PUT create-or-update path); assert 200 and the entity restored.Both use the
addResolutionStatusChildhelper, which creates aNewresolution-status record directly (record + TestCase --PARENT_OF--> testCaseResolutionStatus edge are written synchronously in one transaction) and assertscountRelationshipsTo(statusId) == 1before soft delete. This is deliberately not the incident-task mirror path: those records are written asynchronously and best-effort by the incident workflow (fresh random record id, sync failures swallowed), so a test keyed on them could pass vacuously whenever the workflow does not fire. The direct creation is deterministic and asserts the exact edge the regression walks over.mvn spotless:applyon the touched modules, then commit. No.github/java-tests/impact-map.jsonchange is needed:jdbi3/EntityRepository.javamatches the existingcorearea globjdbi3/Entity*(fullSuite), andTestCaseResourceITmatches*TestCase*ITin thedata-qualityarea.Verification
Review (sol): approve
Files
Closes #35826
Opened by taskr run 0142.