Support filtering by duplicate request groups. Add duplicate request drawer UI.#7965
Draft
lucanovera wants to merge 4 commits intomainfrom
Draft
Support filtering by duplicate request groups. Add duplicate request drawer UI.#7965lucanovera wants to merge 4 commits intomainfrom
lucanovera wants to merge 4 commits intomainfrom
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (83.17%) is below the target coverage (85.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #7965 +/- ##
==========================================
- Coverage 85.04% 83.17% -1.87%
==========================================
Files 631 631
Lines 41203 41217 +14
Branches 4806 4808 +2
==========================================
- Hits 35040 34284 -756
- Misses 5071 5711 +640
- Partials 1092 1222 +130 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket ENG-1806
Description Of Changes
Replaces the generic "View Log" action on the Duplicate Request Detection entry in the privacy request activity timeline with a new "View duplicates" drawer that lists every request in the same duplicate group as a table (Request ID → Created at → Source → Status), pinning the current request at the top with a "Current" tag and linking the rest to their detail pages in new tabs.
Getting there required two small but important backend pieces:
duplicate_request_group_idfilter onPrivacyRequestFilter, wired intofilter_privacy_request_queryset. The frontend callsPOST /privacy-request/searchwith the current request'sduplicate_request_group_idto fetch the group members — no new endpoint, no new query hook (searchPrivacyRequestsalready extendsPartial<PrivacyRequestFilter>).privacyrequest.duplicate_request_group_id. Migrationc09e76282dd1created this index when the column was aString; migration80d28dea3b6bdropped the column/index and re-added the column as a UUID foreign key but never recreated the index. Postgres does not auto-index FK columns. There was no existing production query hitting this column (the column was write-only — set byDuplicateDetectionServiceand never read as a filter) so the gap hadn't surfaced, but the new filter is the first query pattern to hit it. Without the index this would seq-scanprivacyrequeston every call.The migration follows the repo's existing large-table pattern (
a7241db3ee6a_add_identity_indexes.py): inlineCREATE INDEXunder 1M rows, otherwise register the key inpost_upgrade_background_migration_taskssopost_upgrade_index_creation.pyrunsCREATE INDEX CONCURRENTLYat application startup (non-blocking).index=Truewas added to the SQLAlchemy column so futurealembic autogenerateruns keep model and DB aligned.Frontend note: the timeline branches inside
ActivityTimeline.tsx— when the timeline entry is Duplicate Request Detection and the current request has aduplicate_request_group_id, clicking it opens the new drawer; otherwise it falls through to the existingLogDrawer(e.g. legacy records without a group id).Code Changes
Backend
src/fides/api/alembic/migrations/versions/xx_2026_04_20_1200_e8f9a0b1c2d3_recreate_ix_privacyrequest_duplicate_request_group_id.py— new conditional migration to recreateix_privacyrequest_duplicate_request_group_idsrc/fides/api/migrations/post_upgrade_index_creation.py— registered deferredCREATE INDEX CONCURRENTLYstatement underprivacyrequestsrc/fides/api/models/privacy_request/privacy_request.py— addedindex=Trueonduplicate_request_group_idsrc/fides/api/schemas/privacy_request.py— addedduplicate_request_group_id: Optional[UUID]toPrivacyRequestFiltersrc/fides/service/privacy_request/privacy_request_query_utils.py— applied filter infilter_privacy_request_querysettests/ops/api/v1/endpoints/privacy_request/test_privacy_request_duplicate_group_filtering.py— new file, 4 tests (returns group members, excludes unrelated groups, empty for unknown group id, 422 for invalid UUID)Frontend
clients/admin-ui/src/features/privacy-requests/events-and-logs/DuplicatesDrawer.tsx— new component; AntDrawer+Tablewith Request ID → Created at → Source → Status, current row pinned at top with "Current" tag, other rows useRouterLinkwithtarget="_blank"clients/admin-ui/src/features/privacy-requests/events-and-logs/ActivityTimeline.tsx— state + conditional render; branches to the new drawer when the entry is Duplicate Request Detection and a group id is setclients/admin-ui/src/features/privacy-requests/events-and-logs/ActivityTimelineEntry.tsx— dynamic button label ("View duplicates" vs "View Log")clients/admin-ui/src/features/privacy-requests/events-and-logs/hooks/usePrivacyRequestEventLogs.ts— flagisDuplicateDetectionon the timeline item; exports sharedDUPLICATE_DETECTION_DATASET_NAMEconstantclients/admin-ui/src/features/privacy-requests/types.ts—PrivacyRequestEntity.duplicate_request_group_id,ActivityTimelineItem.isDuplicateDetection/hasDuplicateGroupclients/admin-ui/src/types/api/models/PrivacyRequestFilter.ts— regenerated to includeduplicate_request_group_idSteps to Confirm
Backend
ix_privacyrequest_duplicate_request_group_idexists onprivacyrequest:duplicate.ANALYZE privacyrequestfirst if the plan looks off):Index Scan using ix_privacyrequest_duplicate_request_group_id, notSeq Scan.Frontend
/privacy-requests/<second-request-id>.LogDrawerunchanged.Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works