Skip to content

feat: add recalculate affiliations script (CM-1118)#4023

Draft
ulemons wants to merge 5 commits intomainfrom
feat/recalculate-enrichment-affiliations
Draft

feat: add recalculate affiliations script (CM-1118)#4023
ulemons wants to merge 5 commits intomainfrom
feat/recalculate-enrichment-affiliations

Conversation

@ulemons
Copy link
Copy Markdown
Contributor

@ulemons ulemons commented Apr 15, 2026

Adds a one-off cleanup script (recalculate-enrichment-affiliations) to fix stale affiliation data caused by bug CM-1118.
The members_enrichment_worker was modifying work experiences without triggering affiliation recalculation, leaving activityRelations.organizationId stale for ~100k members on production.

The script fetches all members with enrichment-sourced work experiences (including soft-deleted ones, to cover create/update/delete scenarios) using cursor-based pagination to avoid OFFSET on large tables. For each page, workflow starts are capped at 20 concurrent calls and a 5s delay is applied between pages to avoid saturating the shared profiles task queue.

Supports --dry-run, --limit, --start-after, --concurrency, page-size, page-delay for safe, resumable execution.

@ulemons ulemons self-assigned this Apr 15, 2026
@ulemons ulemons added the Bug Created by Linear-GitHub Sync label Apr 15, 2026
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
@ulemons ulemons force-pushed the feat/recalculate-enrichment-affiliations branch from 6b3bfcb to 39f61f7 Compare April 15, 2026 14:55
ulemons added 4 commits April 15, 2026 17:11
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
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.

3 participants