feat: enable project-registry affiliation writes (CM-361) - #4302
Conversation
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.
Turn on MO/MSA writes in git_integration after lookup/guard checks. Add OrganizationSource.PROJECT_REGISTRY and rank it above email-domain and enrichment. Fix findMemberManualAffiliation to match fully undated MSAs with correct ORDER BY for activity ingest resolution. Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
2d68b42 to
6273aaf
Compare
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Summary
Part 2 of CM-361. Part 1 (#4280) discovers and parses project-maintained affiliation files in
git_integrationbut left MO/MSA writes disabled for validation. This PR turns on those writes, adds guards so user actions and enrichment are respected, and collapses overlapping inferential work experiences in the API/UI.Changes
1. Enable project-registry affiliation writes
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)findMemberManualAffiliationand order bydateStart DESC NULLS LASTso new activities resolve repo-derived affiliations the same way bulk refresh already does2. Guards — prevent unwanted re-apply and enrichment overwrite
git_integration (respect soft-deletes)
deletedAtincluded; nodeletedAt IS NULLfilter on fetch)is_blocked_by_deleted_row()skips re-insert when a user soft-deleted a matching stint (same org + overlapping or undated/open-ended dates)members_enrichment_worker (protect project-registry MO rows)
prepareWorkExperiencesno longer deletes MO rows with sourceuiorproject-registry3. Collapsible work experiences (email-domain + project-registry)
mapper.tsto also treatproject-registryas collapsibleemail-domainandproject-registryrows are collapsible; UI and enrichment rows are never hidden, but overlapping collapsible rows tuck under themGeneric examples
project-registry+email-domainproject-registryis the display row, sources mergedenrichment+project-registry+email-domainui+project-registryproject-registrycollapsed into it, sources merged