Repository navigation
fix(export): treat any engagement as exported - #2925
Merged
Merged
Conversation
The exported side of the export split only matched EXPORT rows, so a contact that already had another engagement row landed in the charged set again. Adds getActivatedContacts, which treats any engagement row as the exported side, and redefines the non-exported queries as contacts with no engagement row at all. The two sets stay a partition of the selection, so the file, the response fields and the gates are unchanged. SELECT_EXPORTED_CONTACTS and getExportedContacts are left in place; they no longer have a caller.
Coverage Report✅ Passed Commit: e244141 Summary
All files
No coverage changes
Generated by Test Coverage Reporter for commit e244141 |
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.
The exported side of the export split only matched
EXPORTrows, so a contact that already had another engagement row landed in the unit count again.getActivatedContacts: a contact counts as exported as soon as it has any engagement row.EXISTSkeeps it at one row per contact even with several engagement rows.IS NULL).verifyCreditsreads the activated set instead of the exported one. The two sets stay a partition of the selection, so the file, the response fields and the 402/266 gates are unchanged.SELECT_EXPORTED_CONTACTS/getExportedContactsare untouched; they no longer have a caller, left for a separate cleanup.Tests
contacts-export-split.test.ts: only contacts with no engagement row count as units; every selected contact reaches the file; the whole file is handed toregisterExportedContactsso an activated contact still gets anEXPORTrow; when units run out, activated contacts are kept and the rest trimmed.pg-contacts.test.ts: pins the new SQL (EXISTS, no type filter, scoping, ids variant) and the redefined non-exported SQL, plus a guard that the exported lookup still filters onEXPORT.Checked against the local DB with a 16-contact user (3 exported, 3 enriched including one with a duplicate engagement row, rest untouched): activated 6, not activated 10, and the two sets sum to 16 with no overlap.