feat(core,cli): enforce mandatory MessageBus injection (Phase 3 Hard Migration) (#15776)

This commit is contained in:
Abhi
2026-01-04 17:11:43 -05:00
committed by GitHub
parent 90be9c3587
commit 12c7c9cc42
57 changed files with 442 additions and 278 deletions

View File

@@ -19,6 +19,10 @@ import * as os from 'node:os';
import { ToolConfirmationOutcome } from './tools.js';
import { ToolErrorType } from './tool-error.js';
import { GEMINI_DIR } from '../utils/paths.js';
import {
createMockMessageBus,
getMockMessageBusInstance,
} from '../test-utils/mock-message-bus.js';
// Mock dependencies
vi.mock(import('node:fs/promises'), async (importOriginal) => {
@@ -200,7 +204,7 @@ describe('MemoryTool', () => {
let performAddMemoryEntrySpy: Mock<typeof MemoryTool.performAddMemoryEntry>;
beforeEach(() => {
memoryTool = new MemoryTool();
memoryTool = new MemoryTool(createMockMessageBus());
// Spy on the static method for these tests
performAddMemoryEntrySpy = vi
.spyOn(MemoryTool, 'performAddMemoryEntry')
@@ -300,7 +304,9 @@ describe('MemoryTool', () => {
let memoryTool: MemoryTool;
beforeEach(() => {
memoryTool = new MemoryTool();
const bus = createMockMessageBus();
getMockMessageBusInstance(bus).defaultToolDecision = 'ask_user';
memoryTool = new MemoryTool(bus);
// Clear the allowlist before each test
const invocation = memoryTool.build({ fact: 'mock-fact' });
// eslint-disable-next-line @typescript-eslint/no-explicit-any