Fix bug where System scopes weren't migrated. (#17174)

This commit is contained in:
Jacob Richman
2026-01-20 20:07:17 -08:00
committed by GitHub
parent 9866eb0551
commit 93ae7772fd
2 changed files with 53 additions and 0 deletions

View File

@@ -1961,6 +1961,57 @@ describe('Settings Loading and Merging', () => {
}),
);
});
it('should migrate disableUpdateNag to enableAutoUpdateNotification in system and system defaults settings', () => {
const systemSettingsContent = {
general: {
disableUpdateNag: true,
},
};
const systemDefaultsContent = {
general: {
disableUpdateNag: false,
},
};
vi.mocked(fs.existsSync).mockReturnValue(true);
(fs.readFileSync as Mock).mockImplementation(
(p: fs.PathOrFileDescriptor) => {
if (p === getSystemSettingsPath()) {
return JSON.stringify(systemSettingsContent);
}
if (p === getSystemDefaultsPath()) {
return JSON.stringify(systemDefaultsContent);
}
return '{}';
},
);
const settings = loadSettings(MOCK_WORKSPACE_DIR);
// Verify system settings were migrated
expect(settings.system.settings.general).toHaveProperty(
'enableAutoUpdateNotification',
);
expect(
(settings.system.settings.general as Record<string, unknown>)[
'enableAutoUpdateNotification'
],
).toBe(false);
// Verify system defaults settings were migrated
expect(settings.systemDefaults.settings.general).toHaveProperty(
'enableAutoUpdateNotification',
);
expect(
(settings.systemDefaults.settings.general as Record<string, unknown>)[
'enableAutoUpdateNotification'
],
).toBe(true);
// Merged should also reflect it (system overrides defaults, but both are migrated)
expect(settings.merged.general?.enableAutoUpdateNotification).toBe(false);
});
});
describe('saveSettings', () => {

View File

@@ -808,6 +808,8 @@ export function migrateDeprecatedSettings(
processScope(SettingScope.User);
processScope(SettingScope.Workspace);
processScope(SettingScope.System);
processScope(SettingScope.SystemDefaults);
return anyModified;
}