fix: refresh affiliations after email-domain stint changes (CM-1216)#4181
Open
skwowet wants to merge 2 commits into
Open
fix: refresh affiliations after email-domain stint changes (CM-1216)#4181skwowet wants to merge 2 commits into
skwowet wants to merge 2 commits into
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 closes a timing gap between email-domain stint inference (which persists email-domain member-organization rows) and downstream affiliation refreshes by signaling the per-member Temporal memberUpdate workflow after stint changes are actually applied, ensuring affiliations get recalculated once the new/updated rows exist.
Changes:
- Import and initialize a Temporal client in the stint inference cron job.
- After persisting inferred stint changes, signal the
memberUpdateworkflow for the affected member to refresh affiliations.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…nt inference Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
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
When activities are ingested, data-sink-worker affiliates them using the work history available at that moment and buffers verified email-domain dates for stint inference. The stint job later writes
email-domainmember organization rows, but it previously stopped there.That left a timing gap: enrichment or a UI edit could trigger an affiliation refresh before the email-domain row existed, so activities would be refreshed against an incomplete timeline. When stint inference later created or updated the email-domain row, affiliations were not refreshed again, leaving downstream data stale even though the work history was now correct.
This change signals the per-member update workflow after stint inference persists real
email-domainmember organization changes. The refresh then runs after the email-domain row exists.We also looked at whether stint should push members into a separate delayed Redis buffer and drain that later to coalesce multiple refresh signals, for example during onboarding when a member might get several email-domain updates over time. That felt like overkill for now. Within a single stint run, all buffered dates for a member are processed together and produce one signal. When the same member is picked up again later, it is usually because new dates arrived after the previous pass, which is a real work-history change worth refreshing. A day-long delay buffer would add another queue and keep affiliations stale longer for downstream systems, without solving a problem we are actually seeing in production.