feat: enable project-registry affiliation writes (CM-361)#4302
Conversation
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR is Part 2 of CM-361. Part 1 discovered and parsed project-maintained affiliation files in git_integration but kept the CDP writes disabled for validation. This PR turns those writes on and updates the shared affiliation logic so project-registry member-organization / member-segment-affiliation rows behave correctly downstream — ranked above email-domain/enrichment (but below UI) and picked up during activity ingest.
Changes:
git_integration: activate the previously commented-outinsert_member_organizations/insert_member_segment_affiliationscalls (plus their imports) so parsed repo affiliations land in CDP.- Introduce
OrganizationSource.PROJECT_REGISTRYand slotproject-registrybetweenuiandemail-domainingetMemberOrganizationSourceRank. - Expand
findMemberManualAffiliationto also match fully undated MSAs so new activities resolve repo-derived affiliations like the bulk refresh path already does.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| services/apps/git_integration/src/crowdgit/services/affiliation/affiliation_service.py | Enables the actual MO/MSA inserts after lookup/guard checks and imports the two crud helpers. |
| services/libs/types/src/enums/organizations.ts | Adds the PROJECT_REGISTRY = 'project-registry' enum value. |
| services/libs/common/src/member.ts | Re-ranks sources so project-registry outranks email-domain/enrichment but not UI. |
| services/libs/data-access-layer/src/members/segments.ts | Adds a fully-undated branch to the manual-affiliation lookup used during activity ingest. |
One concern worth addressing before merge: the new undated branch in findMemberManualAffiliation interacts with ORDER BY "dateStart" DESC (PostgreSQL NULLS FIRST default), which lets an undated catch-all MSA win over a more specific dated MSA that covers the timestamp — see the inline comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| OR ("dateStart" IS NULL AND "dateEnd" IS NULL) | ||
| ) | ||
| ORDER BY "dateStart" DESC, id |
Summary
Part 2 of CM-361. Part 1 discovers and parses project-maintained affiliation files in
git_integrationbut left MO/MSA writes disabled for validation. This PR turns on those writes and updates shared affiliation logic soproject-registryrows behave correctly downstream — ranked above email-domain/enrichment and picked up during activity ingest.Changes
insert_member_organizationsandinsert_member_segment_affiliationsafter lookup/guard checks so parsed repo affiliations land in CDPOrganizationSource.PROJECT_REGISTRY(project-registry)project-registryabove email-domain and enrichment ingetMemberOrganizationSourceRank(UI still wins)findMemberManualAffiliationso new activities resolve repo-derived affiliations the same way bulk refresh already does