Repository navigation
Backport #36754 - Restoring a soft-deleted TestCase that has incident history succeeds - #36754 - #37086
Conversation
…#36754 onto the taskr run 0175. PR open-metadata#36754 is backported to the 2.0 worktree as staged changes (not committed); the RED/GREEN checks, the full TestCaseResourceIT class, and spotless all pass.
Code Review ✅ Approved🟡 Medium risk · Filtering time-series children from shared restoreChildren changes recursive restore behavior; an incorrectly classified child could remain unrestored. Fixes restoring a soft-deleted TestCase with incident history, which previously returned a 404 for testCaseResolutionStatus because time-series children were looked up in the entity repository map during 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 |
Summary
This backports PR #36754 (upstream commit
27fa0b5, fixing issue #35826) to the 2.0 branch: restoring a soft-deleted TestCase with incident history previously failed with a 404 for testCaseResolutionStatus, becauserestoreChildrenlooked up time-series children inENTITY_REPOSITORY_MAP, where they are not registered. The fix inEntityRepository.javawraps the child-restore loop inrestoreChildrenwith a check that skips time-series children, mirroring the filter already used bydispatchToContainedChildrenanddeleteChildren; both the restore path and the PUT create-or-update path funnel through this code, so the single change covers both flows. The upstream commit's two regression tests and their helpers were added toTestCaseResourceITin the integration-tests module, for a total of two files changed (96 insertions, 2 deletions). Reviewers should start with therestoreChildrenhunk, which is the functional change, and check the one place 2.0 differed from main: the import conflict inTestCaseResourceIT, resolved by inserting theTestCaseResolutionStatusimport in sorted position. Verification passes on the 2.0 base: the new tests were confirmed RED without the fix and GREEN with it, the fullTestCaseResourceITclass runs green, and spotless is clean.Implementer's note: PR #36754 is backported to the 2.0 worktree as staged changes (not committed); the RED/GREEN checks, the full TestCaseResourceIT class, and spotless all pass.
Plan
Branch prep (implementation worktree, branched from up-to-date 2.0):
git fetch upstream 2.0and confirm the base is at/near62ac1852495; create the implementation branch fromupstream/2.0tip. Note: the open-metadata remote here isupstream, notorigin(which is the fork).Cherry-pick
git cherry-pick -x 27fa0b54b2362c88d2e1b69644b53e41046ce56f(not a merge commit; no-mneeded).restoreChildren'sidsByType.entrySet()loop (EntityRepository.java:6560-6563) inif (!Entity.isTimeSeriesEntity(childType)) { ... }, keeping the PR's short comment citing the TestCase --PARENT_OF--> testCaseResolutionStatus case and dispatchToContainedChildren parity.TestCaseErrorDetails), resolve by insertingimport org.openmetadata.schema.tests.type.TestCaseResolutionStatus;in sorted position between the existingTestCaseEvaluationScopeandTestCaseResolutionStatusTypesimports. The two new tests and theaddResolutionStatusChild/softDeleteTestCaseRecursivelyhelpers insert cleanly betweentest_testCaseSoftDeleteAndRestore_200_OK(:898) andtest_testCaseHardDelete_200_OK(:900). If the cherry-pick conflicts more broadly, abandon it (git cherry-pick --abort) and hand-apply the two hunks from the reference diff verbatim, then commit with the-x-style trailer added manually.dispatchToContainedChildren,ENTITY_REPOSITORY_MAP/ENTITY_TS_REPOSITORY_MAP, or anything else — keep the diff scoped to the two hunks.Verify scope:
git show --stat HEADmust list exactly the two files above; comparegit diff 27fa0b54b236^ 27fa0b54b236 -- <two files>withgit show HEAD -- <two files>— they should differ only in import-block context/line numbers, never in substance. Also confirm the pre-existing FQN usage ofTestCaseResolutionStatusat TestCaseResourceIT.java:2251 is left untouched.RED check (prove the tests fail without the fix): save the fix hunk (
git diff HEAD~1 HEAD -- openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/EntityRepository.java > /tmp/36754-fix.diff), reverse-apply it (git apply -R /tmp/36754-fix.diff), install the unfixed service jar (mvn install -DskipTests -pl openmetadata-shaded-deps,openmetadata-service), and run the two new tests:mvn test -pl openmetadata-integration-tests -Dtest='TestCaseResourceIT#test_testCaseSoftDeleteAndRestoreWithIncident_200_OK+test_testCaseCreateOrUpdateOnSoftDeletedWithIncident_200_OK'Expect both to fail with the 404 "Entity repository for testCaseResolutionStatus not found" from issue Restoring a soft-deleted TestCase with incidents fails: "Entity repository for testCaseResolutionStatus not found" #35826. Then restore the fix (
git apply /tmp/36754-fix.diff).Per repo memory: never use
-amwith-pl openmetadata-integration-tests(shaded-deps shading binds topackageand the IT compile breaks); install the service jar into ~/.m2 first — 2.0 ITsVerification
Review (glm): approve
cherry-pick -xpath alone would reproduce the upstream subject "…succeeds (Restoring a soft-deleted TestCase that has incident history succeeds #36754)" without the '(backport 2.0 Restoring a soft-deleted TestCase that has incident history succeeds #36754)' suffix or '[2.0]' prefix the task card requiresFiles
Opened by taskr run 0175.