fix: soft-delete undated duplicate member organization rows#4070
Conversation
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
3 similar comments
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
There was a problem hiding this comment.
Pull request overview
This PR aims to clean up email-domain work-history data by soft-deleting undated member-organization rows once the stint inference job has produced dated rows for the same member/organization pair. It fits into the member affiliation pipeline in data-access-layer and the cron job that materializes inferred email-domain stints.
Changes:
- Added a new DAL helper to soft-delete undated
memberOrganizationsrows for a member across a set of organizations. - Updated the stint inference cron job to call that cleanup after applying inferred insert/update changes.
- Kept the cleanup scoped to member/org pairs derived from the inferred change set.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
services/libs/data-access-layer/src/members/organizations.ts |
Adds the new soft-delete helper for undated member-organization rows. |
services/apps/cron_service/src/jobs/inferMemberOrganizationStintChanges.job.ts |
Invokes the new cleanup helper after applying inferred stint changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 5b0d264. Configure here.
…ndation#4070) Signed-off-by: Muawiya-contact <contactmuawia@gmail.com>

Summary
This PR prevents duplicate "Unknown" work-history rows after email-domain stint inference.
When the cron job infers a dated
email-domainrow for a(memberId, organizationId), it now also soft-deletes any active undated rows for the same pair (dateStart IS NULLanddateEnd IS NULL).Note
Medium Risk
Touches work-history persistence by soft-deleting rows (and related affiliation overrides), so a bug could remove legitimate undated records for affected orgs; scope is limited to inferred members/orgs with null dates.
Overview
Prevents duplicate "unknown date" work-history rows after email-domain stint inference by cleaning up any active
memberOrganizationsfor the same member/org where bothdateStartanddateEndareNULL.Adds
deleteUndatedMemberOrganizationsin the data-access layer to transactional soft-delete those undated rows and remove theirmemberOrganizationAffiliationOverrides, and invokes it at the end ofinferMemberOrganizationStintChangesprocessing for the orgs affected in the current batch.Reviewed by Cursor Bugbot for commit 5b0d264. Bugbot is set up for automated code reviews on this repo. Configure here.