ENG-3299: Add CorrespondenceMetadata model and table#7867
Draft
JadeCara wants to merge 8 commits intoENG-3299/enums-scopes-encryptionfrom
Draft
ENG-3299: Add CorrespondenceMetadata model and table#7867JadeCara wants to merge 8 commits intoENG-3299/enums-scopes-encryptionfrom
JadeCara wants to merge 8 commits intoENG-3299/enums-scopes-encryptionfrom
Conversation
Create correspondence_metadata table (1:1 with comment) for delivery tracking and threading. Fields: message_id (unique, idempotency key), in_reply_to, reply_to_address, delivery_status, delivered_at, bounce_reason, sender_email, recipient_email. CASCADE delete from comment ensures cleanup. delivery_status uses varchar (not PG enum) to avoid cross-migration enum dependencies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Tests the constraints the TLA+ spec relies on: - message_id UNIQUE (idempotency guard) - comment_id UNIQUE (1:1 relationship) - CASCADE delete (PR deletion cleanup) - Default delivery_status is "pending" (FSM initial state) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## ENG-3299/enums-scopes-encryption #7867 +/- ##
=================================================================
Coverage 85.08% 85.09%
=================================================================
Files 627 628 +1
Lines 40799 40821 +22
Branches 4742 4742
=================================================================
+ Hits 34714 34736 +22
Misses 5017 5017
Partials 1068 1068 ☔ 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-3299
Description Of Changes
PR 2 of 2 for ENG-3299. Creates the
CorrespondenceMetadatatable with a 1:1 relationship toCommentfor delivery tracking and email threading.Table fields:
comment_id— FK tocomment.id, UNIQUE (1:1), CASCADE deletemessage_id— UNIQUE, indexed (idempotency key for deduplication)in_reply_to— threading reference to parent messagereply_to_address— indexed for inbound routingdelivery_status— varchar with defaultpending(values: pending/sent/delivered/bounced/failed)delivered_at,bounce_reason,sender_email,recipient_emailDesign decision:
delivery_statususes varchar (not a PG enum) to avoid cross-migration enum type dependencies. Validation happens at the Python model layer viaCorrespondenceDeliveryStatusenum.Code Changes
src/fides/api/models/comment.py— AddedCorrespondenceMetadatamodel with 1:1 relationship toCommentsrc/fides/api/db/base.py— RegisteredCorrespondenceMetadatafor Alembic discoverycorrespondence_metadatatable with indexes and constraintsSteps to Confirm
alembic upgrade head— verify table createdalembic downgrade -1thenalembic upgrade head— verify full cycle\d correspondence_metadatashows all columns, UNIQUE oncomment_idandmessage_id, FK tocomment.idwith CASCADEpytest tests/ctl/models/test_comment.py— all passPre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works