Skip to content

Conversation

@eastandwestwind
Copy link
Contributor

@eastandwestwind eastandwestwind commented Oct 31, 2025

⚠️ - contains a migration, be sure to bump downrev; this migration cannot be downgraded

https://ethyca.atlassian.net/browse/ENG-1262 (fides portion)

Fidesplus portion is here- https://github.com/ethyca/fidesplus/pull/2722

Description Of Changes

Adds support for adding custom fields to custom taxonomies and for creating custom fields with values of custom taxonomy keys.

Code Changes

  • Migrates custom field-related enums so that ResourceTypes (the type of resource the field applies to) and FieldType (the value type of the field) now accept any string so they can be used with taxonomy keys; endpoint changes are in the Fidesplus PR

Steps to Confirm

Run a Fidesplus backend using the branch linked above.

  1. General regression on custom fields
  2. Add a custom taxonomy in the taxonomy view
  3. Go to the custom fields table
  4. On creating or editing a custom field, should be able to set the custom taxonomy as the location ("Applies to") or the resource type for the field
  5. When a taxonomy is set as the location of a custom field, editing an item under that taxonomy in the taxonomy view should show the custom fields
  6. On clicking the root node of a custom taxonomy, should be able to add custom fields "in-line" within the edit drawer

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

@eastandwestwind eastandwestwind requested review from a team as code owners October 31, 2025 14:27
@eastandwestwind eastandwestwind requested review from adamsachs and lucanovera and removed request for a team October 31, 2025 14:27
@vercel
Copy link

vercel bot commented Oct 31, 2025

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

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
fides-plus-nightly Ignored Ignored Preview Nov 25, 2025 7:40pm
fides-privacy-center Ignored Ignored Nov 25, 2025 7:40pm

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.

Greptile Overview

Greptile Summary

This PR extends custom fields to support custom taxonomies by migrating resource_type from an enum to a string in the database and frontend.

Key changes:

  • Migration converts resource_type column from PostgreSQL enum to String type in plus_custom_field_definition and plus_custom_field tables
  • Backend models updated to accept any string value for resource_type instead of restricted enum
  • Frontend adds useGetCustomFieldLocationsQuery() to dynamically fetch available locations
  • Resource type normalization logic added to handle display format conversions (e.g., taxonomy:data_categorydata_category)
  • Taxonomy helpers updated to pass through custom taxonomy types instead of returning undefined

Critical issue:

  • The frontend calls a new endpoint /plus/custom-fields/locations but this backend endpoint implementation is not included in this PR and does not appear to exist in the codebase, which will cause the custom field form to fail when loading

Confidence Score: 1/5

  • This PR cannot be safely merged due to a missing backend endpoint
  • Score reflects a critical blocking issue: the frontend introduces a call to useGetCustomFieldLocationsQuery() which expects a /plus/custom-fields/locations backend endpoint, but this endpoint is not implemented in this PR or the existing codebase. This will cause runtime errors when users try to create or edit custom fields.
  • Pay close attention to clients/admin-ui/src/features/plus/plus.slice.ts and clients/admin-ui/src/features/custom-fields/CustomFieldForm.tsx - they reference a missing backend endpoint

Important Files Changed

File Analysis

Filename Score Overview
src/fides/api/alembic/migrations/versions/303287c70600_migrate_resource_type_from_enum_to_.py 5/5 Converts resource_type from Enum to String in custom field tables to support custom taxonomies. Migration is clean with proper PostgreSQL casting.
clients/admin-ui/src/features/custom-fields/useCreateOrUpdateCustomField.ts 4/5 Adds normalizeResourceType function to convert UI display format (e.g., taxonomy:data_category) to backend format before submission.
clients/admin-ui/src/features/custom-fields/CustomFieldForm.tsx 2/5 Calls useGetCustomFieldLocationsQuery() to dynamically populate location options. CRITICAL: Backend endpoint appears to be missing.
clients/admin-ui/src/features/plus/plus.slice.ts 2/5 Adds getCustomFieldLocations RTK Query endpoint and changes getCustomFieldDefinitionsByResourceType to accept string instead of enum. CRITICAL: Backend endpoint /plus/custom-fields/locations appears to be missing.

9 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines 37 to 48
const normalizeResourceType = (rt: string): string => {
if (rt.startsWith("taxonomy:")) {
return rt.split(":", 2)[1];
}
if (rt === "system:information") return "system";
if (rt === "system:data_use") return "privacy_declaration";
return rt;
};

values.resource_type = normalizeResourceType(
values.resource_type as unknown as string,
) as any;
Copy link
Contributor

Choose a reason for hiding this comment

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

style: This transformation logic duplicates the mapping that should be handled by the backend. The UI should send the key as-is (e.g., taxonomy:data_category) and let the backend handle the normalization, making the contract clearer and avoiding frontend/backend logic duplication.

@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.03%. Comparing base (d8e41a8) to head (a5e5662).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6898      +/-   ##
==========================================
- Coverage   87.03%   87.03%   -0.01%     
==========================================
  Files         528      528              
  Lines       34668    34666       -2     
  Branches     4005     4005              
==========================================
- Hits        30174    30172       -2     
  Misses       3620     3620              
  Partials      874      874              

☔ 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.

@gilluminate gilluminate requested review from lucanovera and removed request for lucanovera November 24, 2025 18:26
@jpople jpople enabled auto-merge November 24, 2025 18:32
@jpople jpople dismissed lucanovera’s stale review November 24, 2025 19:25

Approved by another reviewer because Lucano is OOO.

@jpople jpople added this pull request to the merge queue Nov 25, 2025
Merged via the queue into main with commit 0b67f6e Nov 25, 2025
134 of 139 checks passed
@jpople jpople deleted the ENG-1262-custom-field-improvements branch November 25, 2025 21:44
jpople added a commit that referenced this pull request Nov 26, 2025
jjdaurora pushed a commit that referenced this pull request Dec 5, 2025
Co-authored-by: Jeremy Pople <jeremy@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.

6 participants