Skip to content

fix: measure separator gap presence in stint inference (CM-1143)#4085

Merged
skwowet merged 3 commits intomainfrom
hotfix-infer-member-org-stint-changes
May 7, 2026
Merged

fix: measure separator gap presence in stint inference (CM-1143)#4085
skwowet merged 3 commits intomainfrom
hotfix-infer-member-org-stint-changes

Conversation

@skwowet
Copy link
Copy Markdown
Collaborator

@skwowet skwowet commented May 7, 2026

Summary

Fixed an edge case in member organization stint inference where long-running concurrent orgs could incorrectly split an existing email-domain stint.

Previously, the separator check looked at whether another org's start or end date landed in the gap between the closest same-org stint and the new activity date. That caused false splits when a concurrent org overlapped the same-org stint for a long time but ended shortly after it.

The new logic treats another org as a separator only when it has meaningful presence in the gap. It also ignores umbrella/concurrent orgs that fully wrap the closest same-org stint.


Note

Medium Risk
Changes the stint-splitting heuristic used by the cron-driven inference, which can alter generated member-organization date ranges and downstream reporting. Logic is localized but affects data updates/inserts based on historical activity gaps.

Overview
Updates inferMemberOrganizationStintChanges separator detection to split stints only when another organization has >30 days of actual overlap within the gap between the closest same-org stint and the new activity date.

Ignores concurrent "umbrella" org stints that fully wrap the neighbor stint and replaces the prior boundary-date check (start/end landing in the gap) with an explicit gap-overlap calculation, reducing false splits from long-running overlapping orgs.

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

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet self-assigned this May 7, 2026
Copilot AI review requested due to automatic review settings May 7, 2026 10:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the separator detection logic inside inferMemberOrganizationStintChanges to prevent incorrect splitting of an existing email-domain stint when another organization overlaps for a long time but only slightly extends into the gap.

Changes:

  • Reworks “separator” detection to require >30 days of actual overlap within the computed gap between the closest same-org stint and the new activity date.
  • Adds logic to ignore “umbrella” stints (other orgs) that fully wrap the closest same-org stint, treating them as concurrent rather than separators.

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

@skwowet skwowet merged commit 7a0de7b into main May 7, 2026
15 checks passed
@skwowet skwowet deleted the hotfix-infer-member-org-stint-changes branch May 7, 2026 10:49
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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

Reviewed by Cursor Bugbot for commit 6e2bd6e. Configure here.

Comment thread services/libs/common_services/src/services/member-organization.ts
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.

2 participants