refactor: deprecate legacy confirmation settings and enforce Policy Engine (#15626)

This commit is contained in:
Abhi
2025-12-29 14:22:42 -05:00
committed by GitHub
parent a3d214f8d7
commit dcd2449b1a
17 changed files with 31 additions and 113 deletions
@@ -96,7 +96,6 @@ describe('BuiltinCommandLoader', () => {
vi.clearAllMocks();
mockConfig = {
getFolderTrust: vi.fn().mockReturnValue(true),
getEnableMessageBusIntegration: () => false,
getEnableExtensionReloading: () => false,
getEnableHooks: () => false,
} as unknown as Config;
@@ -172,7 +171,6 @@ describe('BuiltinCommandLoader', () => {
it('should include policies command when message bus integration is enabled', async () => {
const mockConfigWithMessageBus = {
...mockConfig,
getEnableMessageBusIntegration: () => true,
getEnableHooks: () => false,
} as unknown as Config;
const loader = new BuiltinCommandLoader(mockConfigWithMessageBus);
@@ -180,18 +178,6 @@ describe('BuiltinCommandLoader', () => {
const policiesCmd = commands.find((c) => c.name === 'policies');
expect(policiesCmd).toBeDefined();
});
it('should exclude policies command when message bus integration is disabled', async () => {
const mockConfigWithoutMessageBus = {
...mockConfig,
getEnableMessageBusIntegration: () => false,
getEnableHooks: () => false,
} as unknown as Config;
const loader = new BuiltinCommandLoader(mockConfigWithoutMessageBus);
const commands = await loader.loadCommands(new AbortController().signal);
const policiesCmd = commands.find((c) => c.name === 'policies');
expect(policiesCmd).toBeUndefined();
});
});
describe('BuiltinCommandLoader profile', () => {
@@ -202,7 +188,6 @@ describe('BuiltinCommandLoader profile', () => {
mockConfig = {
getFolderTrust: vi.fn().mockReturnValue(false),
getCheckpointingEnabled: () => false,
getEnableMessageBusIntegration: () => false,
getEnableExtensionReloading: () => false,
getEnableHooks: () => false,
} as unknown as Config;
@@ -81,9 +81,7 @@ export class BuiltinCommandLoader implements ICommandLoader {
modelCommand,
...(this.config?.getFolderTrust() ? [permissionsCommand] : []),
privacyCommand,
...(this.config?.getEnableMessageBusIntegration()
? [policiesCommand]
: []),
policiesCommand,
...(isDevelopment ? [profileCommand] : []),
quitCommand,
restoreCommand(this.config),