Skip to content

fix: filter soft-deleted - #4450

Open
ulemons wants to merge 1 commit into
mainfrom
feat/filter-deleted-member-enrchiment-worker
Open

fix: filter soft-deleted#4450
ulemons wants to merge 1 commit into
mainfrom
feat/filter-deleted-member-enrchiment-worker

Conversation

@ulemons

@ulemons ulemons commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes members_enrichment_worker recreating manually-deleted organization affiliations. The worker rebuilds each member's org affiliation timeline from scratch on every run, but its "current state" read filtered out soft-deleted memberOrganizations rows entirely — so a manually-deleted affiliation was indistinguishable from one that never existed, and the enrichment provider (PDL/Clearbit/etc.) kept resupplying and recreating it. Reported in DE-1016/DE-1021 (Dusky'z contributions incorrectly reappearing on OpenDaylight, instead of being merged into PANTHEON.tech).

Changes

  • fetchMemberDataForLLMSquashing (services/libs/data-access-layer/.../members_enrichment_worker/index.ts) now also returns deletedOrganizations: distinct organizationIds with a soft-deleted, non-UI/PROJECT_REGISTRY-sourced memberOrganizations row for the member — these act as tombstones.
  • prepareWorkExperiences (services/apps/members_enrichment_worker/src/activities/enrichment.ts) now takes the tombstone set and filters them out of the incoming enrichment payload before deciding what to create, so a manually-deleted affiliation is never recreated.
  • Chose "never recreate after manual delete" over a time-based resync window — simpler, and matches the intent of a manual delete. If an org's data legitimately changes later, it won't auto-resync; that's an accepted trade-off, not a currently observed need.
  • Added IDeletedMemberOrganizationData to @crowd/types, exposed as deletedOrganizations on IMemberOriginalData.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Performance improvement
  • Chore / dependency update
  • Documentation

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
@ulemons ulemons self-assigned this Aug 7, 2026
Copilot AI balanced review requested due to automatic review settings August 7, 2026 10:06
@ulemons ulemons added the Bug Created by Linear-GitHub Sync label Aug 7, 2026
@ulemons
ulemons requested a review from skwowet August 7, 2026 10:07
@ulemons
ulemons marked this pull request as ready for review August 7, 2026 10:09
@cursor

cursor Bot commented Aug 7, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes member–organization write logic during enrichment; incorrect tombstone rules could hide legitimate affiliations, but scope is limited to previously soft-deleted enrichment-sourced rows.

Overview
Fixes enrichment re-adding organization affiliations after a user soft-deletes them. The worker rebuilds work experience from provider data each run; because active-state reads ignored deleted memberOrganizations rows, deleted affiliations looked like they never existed and kept coming back.

fetchMemberDataForLLMSquashing now returns deletedOrganizations: distinct org IDs from soft-deleted, non-UI / non-project-registry memberOrganizations for the member. IMemberOriginalData gains IDeletedMemberOrganizationData / deletedOrganizations.

prepareWorkExperiences takes those org IDs as tombstones and drops matching entries from the incoming enrichment payload before computing creates, so providers cannot recreate manually removed affiliations. fetchMemberDataForLLMSquashing is also typed to allow null when the member is missing.

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

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

Adds tombstone handling intended to prevent enrichment from recreating manually deleted organization affiliations.

Changes:

  • Returns soft-deleted organization IDs with member enrichment data.
  • Filters tombstoned organizations from enrichment payloads.
  • Adds shared types for deleted affiliations.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
services/libs/types/src/enrichment.ts Adds deleted-organization types.
services/libs/data-access-layer/src/old/apps/members_enrichment_worker/index.ts Queries soft-deleted affiliations.
services/apps/members_enrichment_worker/src/activities/enrichment.ts Prevents tombstoned affiliations from being recreated.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread services/libs/types/src/enrichment.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 99ae148. Configure here.

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

Labels

Bug Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants