fix: measure separator gap presence in stint inference (CM-1143)#4085
Merged
fix: measure separator gap presence in stint inference (CM-1143)#4085
Conversation
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 6e2bd6e. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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
inferMemberOrganizationStintChangesseparator 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.