mirror of
https://github.com/proffesor-for-testing/agentic-qe.git
synced 2026-09-19 08:45:47 +08:00
98e58c3c27
- Integrate 8 previously unregistered MCP handlers: - Chaos engineering: chaos_inject_latency, chaos_inject_failure, chaos_resilience_test - Integration testing: integration_dependency_check, integration_test_orchestrate - Token-optimized: test_execute_filtered, performance_test_filtered, quality_assess_filtered - Create NewDomainToolsHandler.ts to route new domain tools Dead code removal (~22k lines): - Delete 4 overlapping filtered handlers (coverage, flaky, security, contract) - Remove unused directories: src/alerting/, src/reporting/, src/transport/ - Remove 4 unregistered CLI command dirs: fleet/, test/, quality/, monitor/ (42 files) - Archive 10 one-time verification scripts to scripts/archive/ - Remove 2 CLI backup files (index-spec.ts, index-working.ts) Test organization: - Move HNSWPatternStore.test.ts from src/ to tests/unit/memory/ - Delete OutputFormatter duplicate test from src/ - Consolidate duplicate RuVector and learning-persistence tests - Rename RuVector.SelfLearning.test.ts for consistent naming Dependencies: - Remove unused packages: jose, @types/chrome, gpt-tokenizer Build config: - Exclude src/edge/ subdirectories from main tsconfig (separate build) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
112 lines
3.1 KiB
JavaScript
112 lines
3.1 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* BATCH-001: Logger Path Mocking Fixes
|
|
* Systematically fix Logger initialization issues in test files
|
|
*/
|
|
|
|
import { SwarmMemoryManager } from '../src/core/memory/SwarmMemoryManager';
|
|
import { EventBus } from '../src/core/EventBus';
|
|
import * as path from 'path';
|
|
import * as fs from 'fs';
|
|
import { exec } from 'child_process';
|
|
import { promisify } from 'util';
|
|
|
|
const execAsync = promisify(exec);
|
|
|
|
interface BatchFixResult {
|
|
batchId: string;
|
|
filesAttempted: number;
|
|
filesFixed: number;
|
|
testsPassed: number;
|
|
testsFailed: number;
|
|
fixPatterns: string[];
|
|
errors: string[];
|
|
}
|
|
|
|
async function fixLoggerTests(): Promise<void> {
|
|
const dbPath = path.join(process.cwd(), '.swarm/memory.db');
|
|
const memoryStore = new SwarmMemoryManager(dbPath);
|
|
await memoryStore.initialize();
|
|
const eventBus = EventBus.getInstance();
|
|
|
|
console.log('🔧 BATCH-001: Fixing Logger Path Initialization Issues\n');
|
|
|
|
// Retrieve analysis from memory
|
|
const analysis = await memoryStore.retrieve('aqe/test-analysis/failures', {
|
|
partition: 'coordination'
|
|
});
|
|
|
|
if (!analysis) {
|
|
console.error('❌ No test analysis found. Run analyze-test-failures.ts first.');
|
|
process.exit(1);
|
|
}
|
|
|
|
const loggerCategory = analysis.categories.find((c: any) =>
|
|
c.name === 'Logger Path Initialization'
|
|
);
|
|
|
|
if (!loggerCategory) {
|
|
console.error('❌ No Logger Path Initialization category found.');
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log(`📊 Found ${loggerCategory.affectedFiles.length} affected files\n`);
|
|
|
|
const result: BatchFixResult = {
|
|
batchId: 'BATCH-001',
|
|
filesAttempted: 0,
|
|
filesFixed: 0,
|
|
testsPassed: 0,
|
|
testsFailed: 0,
|
|
fixPatterns: [],
|
|
errors: []
|
|
};
|
|
|
|
// Test files are already using jest.setup.ts which now has the path mock
|
|
// Let's run the tests to see if the fix worked
|
|
console.log('🧪 Running EventBus tests to verify fix...\n');
|
|
|
|
try {
|
|
const { stdout, stderr } = await execAsync(
|
|
'npm test -- tests/unit/EventBus.test.ts --verbose'
|
|
);
|
|
|
|
console.log(stdout);
|
|
if (stderr) console.error(stderr);
|
|
|
|
// Parse test results
|
|
const passMatch = stdout.match(/(\d+) passed/);
|
|
const failMatch = stdout.match(/(\d+) failed/);
|
|
|
|
result.testsPassed = passMatch ? parseInt(passMatch[1]) : 0;
|
|
result.testsFailed = failMatch ? parseInt(failMatch[1]) : 0;
|
|
result.filesFixed = result.testsFailed === 0 ? 1 : 0;
|
|
|
|
console.log(`\n✅ Tests passed: ${result.testsPassed}`);
|
|
console.log(`❌ Tests failed: ${result.testsFailed}`);
|
|
|
|
} catch (error: any) {
|
|
console.error('❌ Error running tests:', error.message);
|
|
result.errors.push(error.message);
|
|
}
|
|
|
|
// Store results in memory
|
|
await memoryStore.store('tasks/BATCH-001/results', result, {
|
|
partition: 'coordination',
|
|
ttl: 86400
|
|
});
|
|
|
|
await eventBus.emit('test:batch-fix:complete', {
|
|
batchId: 'BATCH-001',
|
|
filesFixed: result.filesFixed,
|
|
testsPassed: result.testsPassed
|
|
});
|
|
|
|
console.log('\n📦 Batch fix results stored in SwarmMemoryManager');
|
|
|
|
await memoryStore.close();
|
|
process.exit(result.testsFailed === 0 ? 0 : 1);
|
|
}
|
|
|
|
fixLoggerTests().catch(console.error);
|