Skip to content

Conversation

@sandsinh
Copy link
Contributor

@sandsinh sandsinh commented Jan 29, 2026

Filter dangling enrollments in getAllEnrollment

Summary

Added validation to filter out dangling site enrollments - enrollments that reference sites belonging to a different organization than the entitlement.

Changes

  • Fetches associated sites using batchGetByKeys after retrieving enrollments
  • Filters out dangling enrollments where site's orgId doesn't match entitlement's orgId
  • Logs warnings with details (enrollmentId, siteId, siteOrgId, expectedOrgId) for monitoring
  • Also handles orphaned enrollments where the site no longer exists

Why

Dangling enrollments can occur when sites are moved between organizations but their enrollments aren't cleaned up. This fix ensures the API returns only valid enrollments, preventing issues downstream.

Please ensure your pull request adheres to the following guidelines:

  • make sure to link the related issues in this description
  • when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes

Related Issues

Thanks for contributing!

@sandsinh sandsinh requested a review from ravverma January 29, 2026 09:16
Copy link
Contributor

@ravverma ravverma left a comment

Choose a reason for hiding this comment

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

LGTM
leaving one change request

@github-actions
Copy link

This PR will trigger a patch release when merged.

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.

3 participants