From 18084d1625922d7f98b41c3ed553d22f1398f660 Mon Sep 17 00:00:00 2001 From: Izaak Gough Date: Wed, 26 Aug 2026 11:33:24 +0100 Subject: [PATCH] fix(bigquery-firestore-export): apply DISPLAY_NAME changes on update DISPLAY_NAME is mutable in the kit, but the update mask never included display_name, so editing it and redeploying reported success and left the scheduled query's name unchanged. --- kits/bigquery-firestore-export/src/dts.ts | 5 ++ .../tests/dts.test.ts | 58 +++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/kits/bigquery-firestore-export/src/dts.ts b/kits/bigquery-firestore-export/src/dts.ts index 5f509b360..ea46f5429 100644 --- a/kits/bigquery-firestore-export/src/dts.ts +++ b/kits/bigquery-firestore-export/src/dts.ts @@ -176,6 +176,11 @@ export async function constructUpdateTransferConfigRequest( updatedFields.partitioning_field.stringValue = newPartitioningField; } + if (config.displayName !== transferConfig.displayName) { + updateMask.push("display_name"); + updatedConfig.displayName = config.displayName; + } + if (config.schedule !== transferConfig.schedule) { updateMask.push("schedule"); updatedConfig.schedule = config.schedule; diff --git a/kits/bigquery-firestore-export/tests/dts.test.ts b/kits/bigquery-firestore-export/tests/dts.test.ts index 060ff3ae3..0ee7408f3 100644 --- a/kits/bigquery-firestore-export/tests/dts.test.ts +++ b/kits/bigquery-firestore-export/tests/dts.test.ts @@ -72,6 +72,7 @@ describe("constructUpdateTransferConfigRequest", () => { const client = clientWithTransferConfig({ name: "projects/p/locations/us/transferConfigs/c", destinationDatasetId: "analytics", + displayName: "Users export", schedule: "every 24 hours", notificationPubsubTopic: "projects/test-project/topics/kit-users-export-processMessages", @@ -95,6 +96,63 @@ describe("constructUpdateTransferConfigRequest", () => { expect(request.updateMask?.paths).toEqual(["params"]); }); + test("updates the display name when it changed", async () => { + const client = clientWithTransferConfig({ + name: "projects/p/locations/us/transferConfigs/c", + destinationDatasetId: "analytics", + displayName: "Old export name", + schedule: "every 24 hours", + notificationPubsubTopic: + "projects/test-project/topics/kit-users-export-processMessages", + params: { + fields: { + query: { stringValue: config.queryString }, + destination_table_name_template: { + stringValue: 'users_{run_time|"%H%M%S"}', + }, + partitioning_field: { stringValue: "created_at" }, + }, + }, + }); + + const request = await constructUpdateTransferConfigRequest( + client, + "projects/p/locations/us/transferConfigs/c", + config + ); + + expect(request.updateMask?.paths).toEqual(["display_name"]); + expect(request.transferConfig?.displayName).toBe("Users export"); + }); + + test("leaves the display name out of the mask when unchanged", async () => { + const client = clientWithTransferConfig({ + name: "projects/p/locations/us/transferConfigs/c", + destinationDatasetId: "analytics", + displayName: "Users export", + schedule: "every 12 hours", + notificationPubsubTopic: + "projects/test-project/topics/kit-users-export-processMessages", + params: { + fields: { + query: { stringValue: config.queryString }, + destination_table_name_template: { + stringValue: 'users_{run_time|"%H%M%S"}', + }, + partitioning_field: { stringValue: "created_at" }, + }, + }, + }); + + const request = await constructUpdateTransferConfigRequest( + client, + "projects/p/locations/us/transferConfigs/c", + config + ); + + expect(request.updateMask?.paths).toEqual(["schedule"]); + }); + test("rejects clearing an existing partitioning field", async () => { const client = clientWithTransferConfig({ name: "projects/p/locations/us/transferConfigs/c",