Skip to content

Conversation

@sonika-shah
Copy link
Contributor

@sonika-shah sonika-shah commented Nov 27, 2025

Describe your changes:

Fixes Glossary term circular reference issue with csv import

Issue

CSV import allowed creating glossary terms with circular self-references where a term could be set as its own parent. This occurred because:

  1. Root Cause: During CSV import, the term's FQN is calculated as parent_fqn + "." + term_name (e.g., "Test csv.name1.name1"), while the parent FQN from CSV is just "Test
    csv.name1". The existing validateHierarchy() method only checked UUID and FQN equality, which didn't match in this case, allowing the circular reference to be created.
  2. User Impact: Users could unknowingly create invalid hierarchies during CSV import. The validation error only appeared during PATCH operations, not during creation,
    making it difficult to identify and fix the issue.
  3. Example: A CSV row with parent "Test csv.name1" and term name "name1" would create a self-referencing term that couldn't be updated later.

Fix

  1. Enhanced validateHierarchy() Method - Added name-based validation to catch circular self-references:
  2. New validateForDryRun() Method - Because prepareInternal() (and thus full validation) only runs when dryRun = false, this method provides early validation and error reporting during dry-run.

When dryRun=true

Screen.Recording.2025-11-27.at.1.36.50.PM.mov

When dryRun=false

42["csvImportChannel","{\"jobId\":\"a0b7790a-0d6f-4a47-a4d0-85201f6d9128\",\"status\":\"COMPLETED\",\"result\":{\"dryRun\":false,\"status\":\"partialSuccess\",\"numberOfRowsProcessed\":4,\"numberOfRowsPassed\":3,\"numberOfRowsFailed\":1,\"importResultsCsv\":\"status,details,parent,name*,displayName,description,synonyms,relatedTerms,references,tags,reviewers,owner,glossaryStatus,color,iconURL,extension\\r\\nfailure,Invalid hierarchy: Term 'Test csv.name1' cannot be its own parent,Test csv.name1,name1,name1,<p>name1<\/p>,,,,,,user:admin,Approved,,,\\r\\nsuccess,Entity updated,,parent,parent,<p>parent<\/p>,,,,,,user:admin,Approved,,,\\r\\nsuccess,Entity updated,Test csv.parent,child,child,<p>child<\/p>,,,,,,user:admin,Approved,,,\\r\\n\"},\"error\":null}"]

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 self-assigned this Nov 27, 2025
@sonika-shah sonika-shah requested a review from a team as a code owner November 27, 2025 07:57
@sonika-shah sonika-shah added safe to test Add this label to run secure Github workflows on PRs backend labels Nov 27, 2025
@sonika-shah sonika-shah added the To release Will cherry-pick this PR into the release branch label Nov 27, 2025
yan-3005
yan-3005 previously approved these changes Nov 27, 2025
@sonarqubecloud
Copy link

@sonika-shah sonika-shah merged commit 2d01015 into main Nov 28, 2025
22 of 28 checks passed
@sonika-shah sonika-shah deleted the fix-glossaryterm-circular-ref-isue-by-csv-import branch November 28, 2025 04:46
@github-actions
Copy link
Contributor

Changes have been cherry-picked to the 1.11.0 branch.

github-actions bot pushed a commit that referenced this pull request Nov 28, 2025
* Fix Glossary term circular reference issue with csv import

* Fix test

(cherry picked from commit 2d01015)
sonika-shah added a commit that referenced this pull request Dec 1, 2025
* Fix Glossary term circular reference issue with csv import

* Fix test
@sonika-shah
Copy link
Contributor Author

Changes have been cherry-picked to the 1.10.11 branch.

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

No open projects
Status: Done ✅

Development

Successfully merging this pull request may close these issues.

3 participants