Skip to content

Conversation

@sonika-shah
Copy link
Contributor

Describe your changes:

Fixes When a parent term moved to a different glossary, only the parent's relationships were updated
but the Children's glossary relationships (entity_relationship table) were not updated

Added test for the scenarios :

  1. test_moveTermWithChildren_toParentInSameGlossary (1.347s) - Verifies moving a term with children to a different parent within the same glossary
  2. test_moveTermWithChildren_toRootInDifferentGlossary (1.258s) - Verifies moving a term with children to the root of a different glossary, then deletes the original
    glossary
  3. test_moveTermWithChildren_toParentInDifferentGlossary (1.513s) - Verifies moving a term with children under a parent in a different glossary, then deletes original
    glossary and parent
  4. test_moveNestedTermWithChildren_toRootInSameGlossary (1.551s) - Verifies moving a nested term with children to root in the same glossary
  5. test_moveNestedTermWithChildren_toRootInDifferentGlossary (1.887s) - Verifies moving a nested term with children to root in a different glossary, then deletes original
    glossary and parent
  6. test_moveNestedTermWithChildren_toParentInDifferentGlossary - Verifies moving a nested term with children to a different parent in a different glossary
  7. test_moveMiddleTermInHierarchy_toRootInSameGlossary (0.771s) - Verifies moving a middle-level term (with both parent and children) to root in the same glossary
  8. test_moveMiddleTermInHierarchy_toRootInDifferentGlossary (2.028s) - Verifies moving a middle-level term to root in a different glossary, then deletes original parent
    and glossary
  9. test_consecutiveMoves_verifyRelationshipIntegrity (4.128s) - Most critical test - Reproduces the exact customer scenario with consecutive moves, then deletes both
    original and intermediate glossaries

I worked on ... because ...

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

@sonika-shah sonika-shah requested a review from a team as a code owner December 11, 2025 14:31
@github-actions github-actions bot added backend safe to test Add this label to run secure Github workflows on PRs labels Dec 11, 2025
@sonika-shah sonika-shah added the To release Will cherry-pick this PR into the release branch label Dec 11, 2025
@sonika-shah sonika-shah requested a review from Copilot December 11, 2025 14:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical relationship integrity bug where moving a glossary term with children to a different glossary did not update the children's glossary relationships in the entity_relationship table. The fix ensures that when a parent term moves to a different glossary, all nested children have their HAS relationships updated from the old glossary to the new glossary.

Key Changes:

  • Added updateChildrenGlossaryRelationships() method to recursively update glossary relationships for all nested children
  • Added bulkUpdateFromId() DAO method to efficiently update relationship records in batch
  • Added 9 comprehensive integration tests covering various move scenarios including consecutive moves, hierarchical structures, and cleanup operations

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
GlossaryTermRepository.java Added method to update children glossary relationships when parent moves; calls new bulk update DAO method
CollectionDAO.java Added bulkUpdateFromId SQL UPDATE method to change fromId in entity_relationship table for multiple records
GlossaryTermResourceTest.java Added 9 test cases covering move scenarios including cross-glossary moves, nested hierarchies, consecutive moves, and post-deletion verification

@github-actions
Copy link
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 63%
63.99% (50492/78905) 41.42% (24431/58988) 44.96% (7726/17183)

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs To release Will cherry-pick this PR into the release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants