Skip to content

[dev] [Marfuen] mariano/fix-policy-digest-dedup#2624

Merged
Marfuen merged 1 commit intomainfrom
mariano/fix-policy-digest-dedup
Apr 21, 2026
Merged

[dev] [Marfuen] mariano/fix-policy-digest-dedup#2624
Marfuen merged 1 commit intomainfrom
mariano/fix-policy-digest-dedup

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Apr 21, 2026

This is an automated pull request to merge mariano/fix-policy-digest-dedup into dev.
It was created by the [Auto Pull Request] action.


Summary by cubic

Deduplicates policy acknowledgment digests by normalized email across orgs so one person receives a single digest, even if they have multiple User records. Fixes duplicate emails and ensures consistent primary org branding.

  • Bug Fixes
    • Rollup now keys by email.trim().toLowerCase() instead of user.id.
    • Added regression test covering two orgs with the same email (different user IDs) to assert a single email is sent.

Written for commit f48890f. Summary will update on new commits.

User.email is not @unique in the schema, so the same person can end up
with multiple user rows — typically when invited to separate orgs through
different flows. Keying the rollup on user.id split those duplicates into
one email per row, which is why a user with memberships across 8 orgs
received two separate digests within a minute of each other (one per
duplicated user record, each branded from a different primaryOrgId).

Key the dedup map on the normalized email address instead so one person
always gets one digest regardless of how many user rows back their memberships.

Added a regression test covering two orgs, same email, different user.ids.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 21, 2026

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

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Apr 21, 2026 6:48pm
comp-framework-editor Ready Ready Preview, Comment Apr 21, 2026 6:48pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped Apr 21, 2026 6:48pm

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Auto-approved: This is a low-risk bug fix that corrects email deduplication logic in a background task by using normalized emails instead of user IDs. It includes a regression test.

@Marfuen Marfuen merged commit 75c8888 into main Apr 21, 2026
10 of 11 checks passed
@Marfuen Marfuen deleted the mariano/fix-policy-digest-dedup branch April 21, 2026 18:47
claudfuen pushed a commit that referenced this pull request Apr 21, 2026
## [3.27.2](v3.27.1...v3.27.2) (2026-04-21)

### Bug Fixes

* **digest:** key policy acknowledgment rollup by email, not user.id ([#2624](#2624)) ([75c8888](75c8888))
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.27.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants