From b3bbf2473aeeac7b2507923b90b4bdc2af24fb27 Mon Sep 17 00:00:00 2001 From: Rafael Date: Fri, 21 Aug 2026 11:29:54 -0300 Subject: [PATCH] FEAT(cdc): carry iceberg_table_name through the add-tables endpoint The POST /pipelines/:pipelineId/inputs/:inputId/tables route built its CdcTable payload field-by-field and silently dropped iceberg_table_name even though inputsService.addCdcTable/the gRPC AddCdcTable call (and the protospack CdcTable message) already support it. Widen the inline request body type and thread the field into the addCdcTable payload; absent for snowflake, unchanged back-compat. Co-Authored-By: WOZCODE --- .../platform-api.controller.spec.ts | 21 +++++++++++++++++++ .../platform-api/platform-api.controller.ts | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/src/modules/platform-api/platform-api.controller.spec.ts b/src/modules/platform-api/platform-api.controller.spec.ts index ae4c352..57127ca 100644 --- a/src/modules/platform-api/platform-api.controller.spec.ts +++ b/src/modules/platform-api/platform-api.controller.spec.ts @@ -185,6 +185,27 @@ describe('PlatformApiController - addTable', () => { expect(addCdcTableOrder).toBeLessThan(addCdcJobsOrder); }); + it('addTable: carries iceberg_table_name on the added table through to AddCdcTable', async () => { + inputsService.addCdcTable.mockResolvedValue({ input: {} }); + pipelinesClientService.addCdcJobs.mockResolvedValue({ job_ids: ['p_3'], skipped: [] }); + + const icebergBody = { ...body, iceberg_table_name: 'cdc_raw.public__orders' }; + + await controller.addTable('pid', 'iid', icebergBody, mockUser); + + expect(inputsService.addCdcTable).toHaveBeenCalledWith({ + id: 'iid', + table: { + table_schema: 'public', + table_name: 'orders', + primary_keys: ['id'], + name: 'orders', + iceberg_table_name: 'cdc_raw.public__orders', + }, + info: { customer_id: 'c1', customer: 'cust', user_id: 'u1' }, + }); + }); + it('addTable: rolls back the DynamoDB row when AddJobs fails', async () => { inputsService.addCdcTable.mockResolvedValue({ input: {} }); pipelinesClientService.addCdcJobs.mockRejectedValue(new Error('platform down')); diff --git a/src/modules/platform-api/platform-api.controller.ts b/src/modules/platform-api/platform-api.controller.ts index e547b0d..8355ffa 100644 --- a/src/modules/platform-api/platform-api.controller.ts +++ b/src/modules/platform-api/platform-api.controller.ts @@ -1076,6 +1076,9 @@ export class PlatformApiController { raw: { table_schema: string; table_name: string }; qualify: { table_schema: string; table_name: string }; }; + // Iceberg destination only (protospack CdcTable.iceberg_table_name); + // absent for snowflake, back-compat. + iceberg_table_name?: string; }, @User() user: RequestUser, ) { @@ -1090,6 +1093,7 @@ export class PlatformApiController { table_name: body.table_name, primary_keys: body.primary_keys, name: body.table_name, + iceberg_table_name: body.iceberg_table_name, }; this.logger.info('addTable: appending CDC table to DynamoDB', { inputId, tableName: body.table_name });