Skip to content

fix(script-executor): schedule member email deduplication sweep - #4485

Open
ramanathan1504 wants to merge 2 commits into
linuxfoundation:mainfrom
ramanathan1504:fix/schedule-member-email-dedup
Open

fix(script-executor): schedule member email deduplication sweep#4485
ramanathan1504 wants to merge 2 commits into
linuxfoundation:mainfrom
ramanathan1504:fix/schedule-member-email-dedup

Conversation

@ramanathan1504

Copy link
Copy Markdown

Fixes #4484

Problem

findAndMergeMembersWithSameVerifiedEmailsInDifferentPlatforms is registered in workflows.ts but nothing ever triggers it. script_executor_worker/src/main.ts registers only the four cleanup schedules, and services/cronjobs holds only archived_repositories. The sweep therefore runs only when someone starts it by hand, and duplicate members accumulate in between.

Downstream symptom (linuxfoundation/insights#2093): on the LFX Insights leaderboard for apache/logging-log4j2, one person renders as two contributors — ramanathan1504 (57 authored commits) and ramanathanbscmca@gmail.com (10). The leaderboard pipe groups strictly by memberId, so there is no downstream recourse.

Change

Registers the workflow as a recurring schedule alongside the existing ones. It already pages by hash and uses continueAsNew, so it is built for unattended repeated execution.

  • Weekly, Sunday 03:00 — off-peak and clear of the Wednesday 09:00 cleanup schedules.
  • ScheduleOverlapPolicy.SKIP rather than BUFFER_ONE: a full sweep of memberIdentities can outlast the interval, and buffered sweeps would stack up.

No matching semantics change. The detection query still requires verified identities on both sides, so this adds no new trust in self-asserted git commit emails.

Verification

I could not run the service end to end, so I verified the matching logic directly. I reproduced the detection query from member.repo.ts against a local Postgres, seeded with the identity shapes both integrations actually produce — including the git member's verified type: 'username' identity from commit_service.py:

GitHub member state Detected as mergeable with the git member?
email identity present and verified yes
email identity present but unverified no
no email identity at all no
 primaryMemberId | secondaryMemberId | primaryMemberIdentityValue
-----------------+-------------------+----------------------------
 GH_A            | GIT               | ramanathanbscmca@gmail.com

So pairs like the reported one are already detectable by the existing query — the sweep simply never runs. That is what this PR fixes.

Formatting was matched to services/.prettierrc.cjs by hand (printWidth: 100, semi: false, singleQuote, import order), since pnpm was not available in my environment. Happy to push a formatter pass if CI disagrees.

Note on the PR title

I do not have a JIRA key for this, so the title omits one and the Jira validation check will warn. Please let me know the right key and I will retitle.

findAndMergeMembersWithSameVerifiedEmailsInDifferentPlatforms is
registered in workflows.ts but nothing ever triggers it. main.ts
registers only the four cleanup schedules, and services/cronjobs holds
only archived_repositories, so the sweep runs only when someone starts
it by hand and duplicate members accumulate in between.

Register it as a recurring schedule alongside the existing ones. The
workflow already pages by hash and uses continueAsNew, so it is built
for unattended repeated execution.

Matching semantics are unchanged: the detection query still requires
verified identities on both sides, so this adds no new trust in
self-asserted git commit emails.

Overlap policy is SKIP rather than BUFFER_ONE because a full sweep can
outlast the interval, and buffered sweeps would stack up.

Refs: linuxfoundation#4484

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Ramanathan <ramanathanbscmca@gmail.com>
Copilot AI balanced review requested due to automatic review settings August 17, 2026 13:14
@cursor

cursor Bot commented Aug 17, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Recurring automated member merges affect production identity data, though the merge workflow and matching rules are unchanged and only execution was missing.

Overview
Wires the existing cross-platform verified-email member merge workflow into automatic execution so duplicate contributors are merged without manual Temporal runs.

On script_executor_worker startup, a new scheduleMergeMembersWithSameVerifiedEmails helper registers a Temporal schedule (mergeMembersWithSameVerifiedEmails) that starts findAndMergeMembersWithSameVerifiedEmailsInDifferentPlatforms on the script-executor queue with empty args (full hash-ordered sweep). Timing is weekly, Sunday 03:00; overlap policy is SKIP (not buffered) so long continueAsNew sweeps do not stack. Retries match the other schedules (3 attempts, exponential backoff). Merge detection rules are unchanged—only scheduling is added.

Reviewed by Cursor Bugbot for commit 69d619c. Bugbot is set up for automated code reviews on this repo. Configure here.

@CLAassistant

CLAassistant commented Aug 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Schedules the existing verified-email member deduplication workflow to run weekly.

Changes:

  • Adds a Sunday 03:00 Temporal schedule using SKIP overlap behavior.
  • Registers the schedule during worker initialization.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
scheduleMemberDeduplication.ts Defines the recurring deduplication schedule.
main.ts Registers the schedule at startup.
Suppressed comments (2)

services/apps/script_executor_worker/src/schedules/scheduleMemberDeduplication.ts:17

  • The overlap-policy rationale is useful, but allowed comments are limited to two lines. Please condense this performance constraint while preserving why SKIP must not be changed casually.
        // The workflow walks the whole memberIdentities table via continueAsNew, so a single
        // sweep can outlast the interval. Skip an overdue run instead of buffering it, so
        // sweeps never stack up on top of each other.

services/apps/script_executor_worker/src/schedules/scheduleMemberDeduplication.ts:30

  • This comment only narrates the empty initial argument and workflow paging behavior. That behavior is already clear from args: [{}] and the workflow contract, so this violates the repository's no-descriptive-comments guideline.
        // Start from the beginning of the hash ordering; the workflow pages itself from there.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread services/apps/script_executor_worker/src/schedules/scheduleMemberDeduplication.ts Outdated
removing comments

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ramanathan <ramanathanbscmca@gmail.com>
Copilot AI review requested due to automatic review settings August 17, 2026 14:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

Duplicate members are never merged: findAndMergeMembersWithSameVerifiedEmailsInDifferentPlatforms is never scheduled

3 participants