From 21aab91b7cfd3d15dfc289dd1e29a50c0ab5342d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 12 May 2026 00:03:57 +0000 Subject: [PATCH 1/5] Initial plan From 61698ac4217abaa4c74c488ceec109d943d5ad3e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 12 May 2026 00:06:23 +0000 Subject: [PATCH 2/5] Handle alternate custom property name shapes in normalize --- lib/plugins/custom_properties.js | 18 +++++++++++++----- .../unit/lib/plugins/custom_properties.test.js | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/lib/plugins/custom_properties.js b/lib/plugins/custom_properties.js index 95b82501e..34cd33bda 100644 --- a/lib/plugins/custom_properties.js +++ b/lib/plugins/custom_properties.js @@ -40,12 +40,20 @@ module.exports = class CustomProperties extends Diffable { // Force all names to lowercase to avoid comparison issues. normalize (properties) { - return properties - .filter(({ property_name: propertyName }) => propertyName != null) - .map(({ property_name: propertyName, value }) => ({ + return properties.reduce((normalizedProperties, property) => { + const propertyName = property?.property_name || property?.name + + if (typeof propertyName !== 'string') { + return normalizedProperties + } + + normalizedProperties.push({ name: propertyName.toLowerCase(), - value - })) + value: property.value + }) + + return normalizedProperties + }, []) } comparator (existing, attrs) { diff --git a/test/unit/lib/plugins/custom_properties.test.js b/test/unit/lib/plugins/custom_properties.test.js index 6afc8228b..ef12d7d19 100644 --- a/test/unit/lib/plugins/custom_properties.test.js +++ b/test/unit/lib/plugins/custom_properties.test.js @@ -58,6 +58,24 @@ describe('CustomProperties', () => { ]) }) + it('should normalize paginated custom properties when property name shape differs', async () => { + const mockResponse = [ + { name: 'Owner', value: 'My Team' }, + { property_name: 'Criticality', value: 'High' }, + { value: 'ignored' } + ] + + github.paginate.mockResolvedValue(mockResponse) + + const plugin = configure() + const result = await plugin.find() + + expect(result).toEqual([ + { name: 'owner', value: 'My Team' }, + { name: 'criticality', value: 'High' } + ]) + }) + it('should sync', async () => { const mockResponse = [ { property_name: 'no-change', value: 'no-change' }, From 6da091a4f531063fbe2c57ae9a2db047791e7658 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 12 May 2026 00:07:26 +0000 Subject: [PATCH 3/5] Add explicit object guard in custom property normalization --- lib/plugins/custom_properties.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/plugins/custom_properties.js b/lib/plugins/custom_properties.js index 34cd33bda..b43efe524 100644 --- a/lib/plugins/custom_properties.js +++ b/lib/plugins/custom_properties.js @@ -41,7 +41,11 @@ module.exports = class CustomProperties extends Diffable { // Force all names to lowercase to avoid comparison issues. normalize (properties) { return properties.reduce((normalizedProperties, property) => { - const propertyName = property?.property_name || property?.name + if (!property || typeof property !== 'object') { + return normalizedProperties + } + + const propertyName = property.property_name || property.name if (typeof propertyName !== 'string') { return normalizedProperties From e3bd6bb83de96eb1d0032d03b0a637a711969f9f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 12 May 2026 03:44:18 +0000 Subject: [PATCH 4/5] Support property_name in custom_properties config entries --- lib/plugins/custom_properties.js | 24 ++++++++++++++----- .../lib/plugins/custom_properties.test.js | 5 ++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/plugins/custom_properties.js b/lib/plugins/custom_properties.js index b43efe524..35f0144da 100644 --- a/lib/plugins/custom_properties.js +++ b/lib/plugins/custom_properties.js @@ -12,12 +12,24 @@ module.exports = class CustomProperties extends Diffable { // Force all names to lowercase to avoid comparison issues. normalizeEntries () { - this.entries = this.entries - .filter(({ name }) => name != null) - .map(({ name, value }) => ({ - name: name.toLowerCase(), - value - })) + this.entries = this.entries.reduce((normalizedEntries, entry) => { + if (!entry || typeof entry !== 'object') { + return normalizedEntries + } + + const entryName = entry.name || entry.property_name + + if (typeof entryName !== 'string') { + return normalizedEntries + } + + normalizedEntries.push({ + name: entryName.toLowerCase(), + value: entry.value + }) + + return normalizedEntries + }, []) } async find () { diff --git a/test/unit/lib/plugins/custom_properties.test.js b/test/unit/lib/plugins/custom_properties.test.js index ef12d7d19..dfee1afd9 100644 --- a/test/unit/lib/plugins/custom_properties.test.js +++ b/test/unit/lib/plugins/custom_properties.test.js @@ -32,6 +32,11 @@ describe('CustomProperties', () => { expect(plugin.entries).toEqual([{ name: 'test', value: 'test' }]) }) + it('should normalize entries with property_name when be instantiated', () => { + const plugin = configure([{ property_name: 'ent-ownership', value: 'expert-services' }]) + expect(plugin.entries).toEqual([{ name: 'ent-ownership', value: 'expert-services' }]) + }) + it('should fetch and normalize custom properties successfully', async () => { const mockResponse = [ { property_name: 'Test1', value: 'value1' }, From e27039e08d69d85ba580f5f955e60f5074418ef7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 12 May 2026 03:45:23 +0000 Subject: [PATCH 5/5] Polish custom properties test descriptions --- test/unit/lib/plugins/custom_properties.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/lib/plugins/custom_properties.test.js b/test/unit/lib/plugins/custom_properties.test.js index dfee1afd9..a9e878d58 100644 --- a/test/unit/lib/plugins/custom_properties.test.js +++ b/test/unit/lib/plugins/custom_properties.test.js @@ -27,12 +27,12 @@ describe('CustomProperties', () => { }) describe('Custom Properties plugin', () => { - it('should normalize entries when be instantiated', () => { + it('should normalize entries when instantiated', () => { const plugin = configure([{ name: 'Test', value: 'test' }]) expect(plugin.entries).toEqual([{ name: 'test', value: 'test' }]) }) - it('should normalize entries with property_name when be instantiated', () => { + it('should normalize entries with property_name when instantiated', () => { const plugin = configure([{ property_name: 'ent-ownership', value: 'expert-services' }]) expect(plugin.entries).toEqual([{ name: 'ent-ownership', value: 'expert-services' }]) })