From 173743fd9ee0f0455117e4cb59bf4212abd06c7a Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Fri, 15 May 2026 09:25:49 -0400 Subject: [PATCH] fix: preserve canonical sub-repos normalization semantics --- get-shit-done/bin/lib/configuration.generated.cjs | 3 ++- sdk/src/configuration/index.test.ts | 8 ++++++++ sdk/src/configuration/index.ts | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/get-shit-done/bin/lib/configuration.generated.cjs b/get-shit-done/bin/lib/configuration.generated.cjs index fa3c50748..e19ccf075 100644 --- a/get-shit-done/bin/lib/configuration.generated.cjs +++ b/get-shit-done/bin/lib/configuration.generated.cjs @@ -110,10 +110,11 @@ function normalizeLegacyKeys(parsed) { if (Object.prototype.hasOwnProperty.call(result, 'sub_repos')) { const value = result.sub_repos; const planning = result.planning ?? {}; - if (!planning.sub_repos) { + if (planning.sub_repos === undefined) { result.planning = { ...planning, sub_repos: value }; } else { + // canonical nested wins — just drop the stale top-level result.planning = { ...planning }; } delete result.sub_repos; diff --git a/sdk/src/configuration/index.test.ts b/sdk/src/configuration/index.test.ts index 9062177ba..fd19cf698 100644 --- a/sdk/src/configuration/index.test.ts +++ b/sdk/src/configuration/index.test.ts @@ -216,6 +216,14 @@ describe('normalizeLegacyKeys', () => { // canonical nested wins expect((parsed as Record>).git?.branching_strategy).toBe('phase'); }); + + it('preserves canonical planning.sub_repos when both top-level and nested exist', () => { + const input = { sub_repos: ['legacy'], planning: { sub_repos: null } }; + const { parsed } = normalizeLegacyKeys(input); + expect((parsed as Record>).sub_repos).toBeUndefined(); + // canonical nested wins even when explicit null is used to unset + expect((parsed as Record>).planning?.sub_repos).toBeNull(); + }); }); // ─── mergeDefaults ─────────────────────────────────────────────────────────── diff --git a/sdk/src/configuration/index.ts b/sdk/src/configuration/index.ts index 8e4f9a9a2..6aef0dc9e 100644 --- a/sdk/src/configuration/index.ts +++ b/sdk/src/configuration/index.ts @@ -174,9 +174,10 @@ export function normalizeLegacyKeys(parsed: Record): Normalizat if (Object.prototype.hasOwnProperty.call(result, 'sub_repos')) { const value = result.sub_repos; const planning = (result.planning as Record | undefined) ?? {}; - if (!planning.sub_repos) { + if (planning.sub_repos === undefined) { result.planning = { ...planning, sub_repos: value }; } else { + // canonical nested wins — just drop the stale top-level result.planning = { ...planning }; } delete result.sub_repos;