File tree Expand file tree Collapse file tree
services/apps/pcc_sync_worker/src/consumer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,7 +111,17 @@ export class PccProjectConsumer {
111111 }
112112 }
113113
114- log . warn ( ( ! this . dryRun ) { await insertSyncError ( tx ,
114+ log . warn (
115+ {
116+ pccProjectId : parsed . pccProjectId ?? null ,
117+ pccSlug : parsed . pccSlug ?? null ,
118+ ...errorDetails ,
119+ } ,
120+ 'Schema mismatch in PCC row' ,
121+ )
122+ if ( ! this . dryRun ) {
123+ await insertSyncError (
124+ tx ,
115125 parsed . pccProjectId ?? null ,
116126 parsed . pccSlug ?? null ,
117127 'SCHEMA_MISMATCH' ,
@@ -341,9 +351,13 @@ async function upsertSegment(
341351 sourceId : string ,
342352 project : ParsedPccProject ,
343353) : Promise < void > {
344- // Update all segment levels (group, project, subproject) that share the same sourceId.
345- // PCC exports every level of the hierarchy with the same PROJECT_ID, so all three CDP
346- // segment levels are updated in one pass.
354+ // Update all CDP segments whose sourceId equals this PCC PROJECT_ID.
355+ // Each PCC node has its own PROJECT_ID. In CDP, how many segment levels share this
356+ // sourceId depends on the effective depth:
357+ // eff=1 → group+project+subproject all share the same PROJECT_ID (same name for all)
358+ // eff=2 → project+subproject share the leaf's PROJECT_ID; group has a different one
359+ // eff=3 or 4 → only the subproject segment carries this PROJECT_ID
360+ // So this UPDATE always writes the correct name and never touches unrelated levels.
347361 await db . none (
348362 `UPDATE segments
349363 SET name = $(name),
You can’t perform that action at this time.
0 commit comments