fix: tombston in inferMemberOrganizationStintChanges (CM-1367) - #4502
fix: tombston in inferMemberOrganizationStintChanges (CM-1367)#4502ulemons wants to merge 1 commit into
Conversation
Signed-off-by: Umberto Sgueglia <usgueglia@contractor.linuxfoundation.org>
PR SummaryMedium Risk Overview
Reviewed by Cursor Bugbot for commit 910e2f3. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Pull request overview
Prevents manually deleted email-domain affiliations from being recreated during stint inference.
Changes:
- Propagates
deletedBythrough organization types and DAL queries. - Skips all inferred changes for human-tombstoned organizations.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
services/libs/types/src/organizations.ts |
Adds deletedBy to the affiliation type. |
services/libs/data-access-layer/src/members/organizations.ts |
Selects the tombstone actor field. |
services/libs/common_services/src/services/member-organization.ts |
Suppresses inference for tombstoned organizations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
Fixes DE-1016/DE-1021: a human-deleted
email-domainsourced org affiliation can reappear on a member profile once new matching activity comes in, because theinfer-member-organization-stint-changescron job only checkeddeletedAtand neverdeletedBy. PR #4476 (CM-1367) already fixed this for provider/enrichment-sourced affiliations, but the email-domain stint-inference path is a separate codepath that PR didn't touch. This PR closes that gap by making a human tombstone (deletedByset) permanently block recreation of that org affiliation, regardless of whether the new activity date falls inside the deleted row's date range.Changes
deletedBy?: stringtoIMemberOrganization(services/libs/types/src/organizations.ts) so the field can flow through to the stint-inference logic."deletedBy"to the SELECT column list infetchMemberOrganizationsBySource(services/libs/data-access-layer/src/members/organizations.ts) — the cron job already fetches deleted rows viawithDeleted: true, it just wasn't reading who deleted them.inferMemberOrganizationStintChanges(services/libs/common_services/src/services/member-organization.ts) now computes atombstonedOrgIdsset from rows where bothdeletedAtanddeletedByare set, and skips any stint insert/extend for thoseorganizationIds outright. This is intentionally stronger than the existingdeletedRowssuppression, which only blocks recreation for activity dates that intersect the deleted row's own date range — a human delete should hold regardless of date, while a system/provider delete (nodeletedBy) keeps the narrower, date-scoped suppression.Type of change
JIRA ticket
CM-13267