Skip to content

fix(front): dedupe gitlab commit notifications by event id#320

Open
timosaikkonen wants to merge 1 commit into
colinlienard:mainfrom
timosaikkonen:fix/gitlab-commit-notification-dedup
Open

fix(front): dedupe gitlab commit notifications by event id#320
timosaikkonen wants to merge 1 commit into
colinlienard:mainfrom
timosaikkonen:fix/gitlab-commit-notification-dedup

Conversation

@timosaikkonen

Copy link
Copy Markdown

fix(front): dedupe GitLab commit notifications by event id

Summary

When using GitLab, a commit/push notification (e.g. from a bot like renovate) is re-sent as a desktop push notification on every poll cycle, repeating indefinitely.

Cause

In fetchGitlabNotifications (src/routes/(app)/dashboard/+page.svelte), the "keep only new or modified notifications" filter has a dedicated branch for push events:

case 'push_data' in n:
    return !('push_data' in n && n.push_data.ref === item.ref);

This branch is broken in two ways:

  • The result is inverted (leading !), so find matches the first non-matching item.
  • It compares item.ref, but commit notifications never set ref — only merge request notifications carry it, and ref isn't even persisted to storage.

As a result, a push/commit event is never recognized as already-seen, is treated as new every cycle, and re-triggers a push notification.

Fix

Remove the broken branch so push/commit events fall through to the default case, which matches by event id — the same id createGitlabNotificationData assigns to a commit notification.

Test plan

  • Connect a self-hosted/GitLab account with a repo that receives bot commits
  • Before: the same commit notification fires repeatedly (~every poll)
  • After: each commit notifies once; already-seen commits are deduped

The push-event branch of the "keep only new/modified" filter was inverted
and compared `item.ref`, which commit notifications never set (only merge
request notifications carry `ref`, and it is not persisted). As a result a
commit/push event was never recognized as already-seen and re-triggered a
push notification on every poll (e.g. a bot commit notifying repeatedly).

Remove the broken branch so push/commit events fall through to the default
case, which matches by event id (the same id used to build the notification).

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant