Skip to content

Conversation

@galvana
Copy link
Contributor

@galvana galvana commented Nov 12, 2025

Ticket ENG-1961

Description Of Changes

Creating DB migration to seed the default identity definitions:

  • email
  • phone_number
  • fides_user_device_id
  • external_id

These identity definitions will be flagged as system managed in https://ethyca.atlassian.net/browse/ENG-1844 so they cannot be deleted.

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

@galvana galvana requested a review from a team as a code owner November 12, 2025 03:01
@galvana galvana requested review from JadeCara and removed request for a team November 12, 2025 03:01
@vercel
Copy link

vercel bot commented Nov 12, 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

@galvana galvana requested review from daveqnet, erosselli and johnewart and removed request for JadeCara and daveqnet November 12, 2025 03:01
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 12, 2025

Greptile Overview

Greptile Summary

This migration seeds the database with 4 default identity definitions (email, phone_number, fides_user_device_id, and external_id) that will later be system-managed to prevent deletion. The migration also creates performance-optimized JSONB indexes on the privacy_preferences_current and privacy_preferences_historic partition tables for each identity key.

Key changes:

  • Deletes existing identity definitions with these keys before inserting to handle upgrade scenarios
  • Creates identity definitions with proper typing (email, phone_number, uuid, string)
  • Adds 8 indexes total (4 identity keys × 2 partitions) to optimize lookups on search_data->'identity'->>'<key>'
  • Downgrade properly removes both indexes and data

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The migration is straightforward and well-implemented. It properly handles upgrade/downgrade scenarios, uses correct PostgreSQL syntax for JSONB indexes, follows the repository's migration patterns (e.g., using server_default="f" for booleans), and includes proper cleanup logic. The DELETE before INSERT approach safely handles re-running the migration.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
src/fides/api/alembic/migrations/versions/xx_2025_11_12_1430_b2c3d4e5f6a7_add_default_identity_definitions.py 5/5 Seeds 4 default identity definitions (email, phone_number, fides_user_device_id, external_id) and creates JSONB indexes on privacy_preferences partitions

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.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.32%. Comparing base (ca922dc) to head (1b692a5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6952   +/-   ##
=======================================
  Coverage   87.32%   87.32%           
=======================================
  Files         525      525           
  Lines       34421    34422    +1     
  Branches     3960     3960           
=======================================
+ Hits        30058    30059    +1     
  Misses       3500     3500           
  Partials      863      863           

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

Copy link
Contributor

@erosselli erosselli left a comment

Choose a reason for hiding this comment

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

LGTM! don't forget the changelog

@galvana galvana enabled auto-merge November 13, 2025 00:58
@galvana galvana added this pull request to the merge queue Nov 13, 2025
Merged via the queue into main with commit c4bf5c5 Nov 13, 2025
66 of 68 checks passed
@galvana galvana deleted the ENG-1961-create-default-identities branch November 13, 2025 02:08
jjdaurora pushed a commit that referenced this pull request Dec 5, 2025
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