Skip to content

Commit e63548e

Browse files
skwowetcursoragent
andcommitted
feat(CM-361): enable project-registry affiliation writes
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>
1 parent 25f5f29 commit e63548e

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

services/apps/git_integration/src/crowdgit/services/affiliation/affiliation_service.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
find_many_member_ids_by_identities,
1616
find_many_organization_ids_by_identities,
1717
get_repo_affiliation_registry,
18+
insert_member_organizations,
19+
insert_member_segment_affiliations,
1820
save_service_execution,
1921
upsert_repo_affiliation_registry,
2022
)
@@ -841,9 +843,8 @@ async def apply_affiliations(
841843
}
842844
)
843845

844-
# TODO: Enable CDP writes after testing (import insert_member_* from crud)
845-
# await insert_member_organizations(mo_inserts)
846-
# await insert_member_segment_affiliations(msa_inserts)
846+
await insert_member_organizations(mo_inserts)
847+
await insert_member_segment_affiliations(msa_inserts)
847848

848849
async def process_affiliations(
849850
self,

services/libs/common/src/member.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ export const calculateReach = (oldReach: any, newReach: any): { total: number }
9191
*/
9292
export function getMemberOrganizationSourceRank(source: string | null | undefined): number {
9393
if (source === OrganizationSource.UI) return 0
94-
if (source === OrganizationSource.EMAIL_DOMAIN) return 1
95-
if (source?.startsWith('enrichment-')) return 2
96-
return 3
94+
if (source === OrganizationSource.PROJECT_REGISTRY) return 1
95+
if (source === OrganizationSource.EMAIL_DOMAIN) return 2
96+
if (source?.startsWith('enrichment-')) return 3
97+
return 4
9798
}
9899

99100
/**

services/libs/data-access-layer/src/members/segments.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ export async function findMemberManualAffiliation(
189189
AND (
190190
("dateStart" <= $(timestamp) AND "dateEnd" >= $(timestamp))
191191
OR ("dateStart" <= $(timestamp) AND "dateEnd" IS NULL)
192+
OR ("dateStart" IS NULL AND "dateEnd" IS NULL)
192193
)
193-
ORDER BY "dateStart" DESC, id
194+
ORDER BY "dateStart" DESC NULLS LAST, id
194195
LIMIT 1
195196
`,
196197
{

services/libs/types/src/enums/organizations.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export enum OrganizationAttributeName {
77

88
export enum OrganizationSource {
99
EMAIL_DOMAIN = 'email-domain',
10+
PROJECT_REGISTRY = 'project-registry',
1011
ENRICHMENT_PROGAI = 'enrichment-progai',
1112
ENRICHMENT_CLEARBIT = 'enrichment-clearbit',
1213
ENRICHMENT_CRUSTDATA = 'enrichment-crustdata',

0 commit comments

Comments
 (0)