Skip to content

fix: refresh affiliations after email-domain stint changes (CM-1216)#4181

Open
skwowet wants to merge 2 commits into
mainfrom
bugfix/CM-1216
Open

fix: refresh affiliations after email-domain stint changes (CM-1216)#4181
skwowet wants to merge 2 commits into
mainfrom
bugfix/CM-1216

Conversation

@skwowet

@skwowet skwowet commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

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-domain member 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-domain member 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.

Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
@skwowet skwowet self-assigned this Jun 8, 2026
Copilot AI review requested due to automatic review settings June 8, 2026 18:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 memberUpdate workflow 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>
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