Skip to content

Conversation

@galvana
Copy link
Contributor

@galvana galvana commented Nov 14, 2025

Ticket ENG-1963

Description Of Changes

This PR enables duplicate taxonomy names across the taxonomy system (data categories, data uses, data subjects, and custom taxonomy elements). Previously, both fides_key and name had to be unique within each taxonomy type. Now, only fides_key must be unique, allowing multiple elements to share the same name as long as they have different keys or parent hierarchies.

This change better supports real-world taxonomy use cases where:

  • Different branches of a hierarchical taxonomy may need the same semantic names (e.g., "Employee" under different regional parents)
  • Multiple data subjects may share common names but represent different entities (e.g., "Customer" for different business units)
  • Taxonomy migrations and imports from different sources may introduce naming conflicts that are semantically acceptable

The uniqueness constraint is now enforced solely on fides_key within each taxonomy type, while names can be duplicated freely.

Code Changes

  • Modified DataCategory, DataSubject, and DataUse models in sql_models.py to override create() and update() methods, skipping name uniqueness checks while enforcing fides_key uniqueness
  • Modified TaxonomyElement model in taxonomy.py to override create() and update() methods with the same logic for custom taxonomies
  • Updated error handling in generic_overrides.py API endpoints to return more specific error messages from KeyOrNameAlreadyExists exceptions

Steps to Confirm

  1. Follow the testing steps in https://github.com/ethyca/fidesplus/pull/2793

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • All UX related changes have been reviewed by a designer
    • No UX review needed
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

@vercel
Copy link

vercel bot commented Nov 14, 2025

Deployment failed with the following error:

You must set up Two-Factor Authentication before accessing this team.

View Documentation: https://vercel.com/docs/two-factor-authentication

@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

❌ Patch coverage is 79.66102% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.31%. Comparing base (69e950e) to head (3ce5596).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/fides/api/models/taxonomy.py 37.50% 8 Missing and 2 partials ⚠️
src/fides/api/models/sql_models.py 95.00% 0 Missing and 2 partials ⚠️

❌ Your patch status has failed because the patch coverage (79.66%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6971      +/-   ##
==========================================
- Coverage   87.33%   87.31%   -0.02%     
==========================================
  Files         525      525              
  Lines       34458    34512      +54     
  Branches     3967     3984      +17     
==========================================
+ Hits        30093    30134      +41     
- Misses       3501     3511      +10     
- Partials      864      867       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@galvana galvana marked this pull request as ready for review November 15, 2025 05:51
@galvana galvana requested a review from a team as a code owner November 15, 2025 05:51
@galvana galvana requested review from thabofletcher and removed request for a team and thabofletcher November 15, 2025 05:51
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 15, 2025

Greptile Overview

Greptile Summary

This PR removes the name uniqueness constraint from taxonomy elements (data categories, data uses, data subjects, and custom taxonomies), allowing multiple elements to share the same name as long as their fides_key values are unique. The implementation overrides the create() and update() methods in the model classes to skip name validation while enforcing fides_key uniqueness.

Key changes:

  • Modified DataCategory, DataSubject, and DataUse models to override create/update methods with check_name=False
  • Modified TaxonomyElement model with the same pattern for custom taxonomies
  • Updated API error handling to use exception messages directly for better error reporting
  • Added comprehensive test coverage for duplicate name scenarios across all taxonomy types
  • No database migration required since the change is purely at the application logic level (no schema changes)

Confidence Score: 4/5

  • This PR is safe to merge with minor style improvements recommended
  • The implementation is straightforward and well-tested. The core logic correctly removes name uniqueness checks while maintaining fides_key uniqueness. Minor style issues exist with redundant filter conditions in update methods that don't affect functionality but could be simplified for clarity.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/fides/api/models/sql_models.py 4/5 Overrides create() and update() methods for DataCategory, DataSubject, and DataUse to allow duplicate names while enforcing fides_key uniqueness. Logic is sound with one minor redundancy issue in update methods.
src/fides/api/models/taxonomy.py 5/5 Overrides create() and update() methods for TaxonomyElement to skip name uniqueness checks. Implementation correctly handles taxonomy_type scoping for custom taxonomies.
src/fides/api/api/v1/endpoints/generic_overrides.py 5/5 Updates error handling to use the exception message directly via str(e), providing more accurate error messages to API consumers.
tests/service/test_taxonomy_service.py 5/5 Adds comprehensive test coverage for duplicate name scenarios across all taxonomy types, including create and update operations. Tests verify both success and failure cases.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@vercel
Copy link

vercel bot commented Nov 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
fides-plus-nightly Ready Ready Preview Comment Nov 17, 2025 9:42pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
fides-privacy-center Ignored Ignored Nov 17, 2025 9:42pm

Copy link
Contributor

@JadeCara JadeCara left a comment

Choose a reason for hiding this comment

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

Updated the greptile's suggestions and tested locally. I was not able to add duplicate sibling names as expected.

@Kelsey-Ethyca Kelsey-Ethyca added this pull request to the merge queue Nov 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 17, 2025
@JadeCara JadeCara added this pull request to the merge queue Nov 17, 2025
Merged via the queue into main with commit 7ff64b1 Nov 17, 2025
68 of 69 checks passed
@JadeCara JadeCara deleted the ENG-1963-allow-duplicate-taxonomy-names branch November 17, 2025 22:53
Kelsey-Ethyca pushed a commit that referenced this pull request Nov 18, 2025
Co-authored-by: JadeWibbels <jade.wibbels@gmail.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Jade Wibbels <jade@ethyca.com>
jjdaurora pushed a commit that referenced this pull request Dec 5, 2025
Co-authored-by: JadeWibbels <jade.wibbels@gmail.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Jade Wibbels <jade@ethyca.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants