diff --git a/src/config/legacy-migrate.test.ts b/src/config/legacy-migrate.test.ts index 94182b41e63e..1e19f15e550d 100644 --- a/src/config/legacy-migrate.test.ts +++ b/src/config/legacy-migrate.test.ts @@ -208,6 +208,16 @@ describe("legacy migrate heartbeat config", () => { expect((res.config as { heartbeat?: unknown } | null)?.heartbeat).toBeUndefined(); expect((res.config as { agent?: unknown } | null)?.agent).toBeUndefined(); }); + + it("records a migration change when removing empty top-level heartbeat", () => { + const res = migrateLegacyConfig({ + heartbeat: {}, + }); + + expect(res.changes).toContain("Removed empty top-level heartbeat."); + expect(res.config).not.toBeNull(); + expect((res.config as { heartbeat?: unknown } | null)?.heartbeat).toBeUndefined(); + }); }); describe("legacy migrate controlUi.allowedOrigins seed (issue #29385)", () => { diff --git a/src/config/legacy.migrations.part-3.ts b/src/config/legacy.migrations.part-3.ts index dbc097480e50..db4d3a9c9f9e 100644 --- a/src/config/legacy.migrations.part-3.ts +++ b/src/config/legacy.migrations.part-3.ts @@ -343,6 +343,9 @@ export const LEGACY_CONFIG_MIGRATIONS_PART_3: LegacyConfigMigration[] = [ raw.channels = channels; } + if (!agentHeartbeat && !channelHeartbeat) { + changes.push("Removed empty top-level heartbeat."); + } delete raw.heartbeat; }, },