chore: dedupe public API conflict alerts (CM-1349) - #4414
Conversation
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds opt-in, Redis-deduplicated Slack alerts for actionable public API conflicts.
Changes:
- Adds one-hour, fail-open alert deduplication.
- Alerts on member identity and resolution conflicts.
- Removes blanket conflict alerts from the shared error handler.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
backend/.eslintrc.js |
Enables void usage; currently has an unclosed override object. |
backend/src/api/public/alerts/notifyOnce.ts |
Adds Redis-backed alert deduplication. |
backend/src/api/public/alerts/identityConflict.ts |
Maps and alerts identity conflicts. |
backend/src/api/public/alerts/memberResolveConflict.ts |
Alerts ambiguous member resolution. |
backend/src/api/public/middlewares/errorHandler.ts |
Removes blanket 409 alerting. |
backend/src/api/public/v1/members/createMember.ts |
Alerts single-identity creation conflicts. |
backend/src/api/public/v1/members/resolveMember.ts |
Uses targeted resolution-conflict alerts. |
backend/src/api/public/v1/members/identities/createMemberIdentity.ts |
Uses targeted identity-conflict alerts. |
backend/src/api/public/v1/members/identities/verifyMemberIdentity.ts |
Alerts verification conflicts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
backend/src/api/public/v1/members/identities/createMemberIdentity.ts:108
- When
data.verifiedis true, the transaction also verifies every same-value identity in the loop above. If one of those identities conflicts on a different platform, this reports and deduplicates the alert usingdata.platform, so the Slack alert points to the wrong identity. Track the identity associated with the failing insert/update and pass that subject here.
rethrowIdentityConflict(req, error, {
memberId,
platform: data.platform,
value: data.value,
type: data.type,
backend/src/api/public/alerts/identityConflict.ts:20
- The dedupe key uses the caller's raw casing, but the active uniqueness constraint is on
lower(value)(V1785255019__member_identities_case_insensitive_unique_indexes.sql:9-12). Requests forFooandfootherefore hit the same conflict but generate different Redis keys and duplicate Slack alerts within the hour. Canonicalize the value for the key.
identity.value,
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
backend/.eslintrc.js:50
- This disables
no-voidfor every backend TypeScript file to support two local fire-and-forget calls, weakening lint coverage outside this change. Keep the project-wide rule and scope the suppression or rejection handling to those call sites instead; the protected-files hook also identifies ESLint configuration as project-wide infrastructure.
'no-void': 'off',
backend/src/api/public/alerts/identityConflict.ts:20
- The dedupe key keeps the request's original casing, but the identity uniqueness constraint compares
lower(value)(backend/src/database/migrations/V1785255019__member_identities_case_insensitive_unique_indexes.sql:9-12). Equivalent conflicts such asFoo@example.comandfoo@example.comtherefore reserve different Redis keys and can emit duplicate alerts. Normalize the value according to the constraint when constructing the key.
identity.value,
Summary
Self-serve identity and member-resolve conflicts were spamming
#cdp-lfx-self-serve-alertson every retry. We now send those alerts once per hour (Redis dedupe), with a consistent format.The shared error handler no longer Slack-alerts on every 409. Only identity and resolve conflicts opt in. Things like work-experience date conflicts stay quiet.
Changes
notifyOncehelper (Redis, 1h window, fail-open)resolveMembermatcheserrorHandler