mirror of
https://github.com/proffesor-for-testing/agentic-qe.git
synced 2026-09-19 08:45:47 +08:00
2253d05618
Remove the nested v3/ subdirectory by moving all active source code, tests, configs, and assets directly to the project root. Archive v2/ (dead code, 847MB) to v2-archive.tar.gz. Key changes: - Move v3/src/ → src/, v3/tests/ → tests/, v3/packages/ → packages/ - Move v3/tsconfig.json, v3/vitest.config.ts to root - Merge v3/package.json into root package.json (ESM, scripts, deps, exports) - Merge v3/scripts/ into scripts/, v3/implementation/ into docs/implementation/ - Update all CI workflows to remove "cd v3 &&" and v3/ path prefixes - Fix all init installer path resolution (3-level-up → 2-level-up) - Fix hooks to use "node ./dist/cli/bundle.js" instead of bare "aqe" - Update settings.json ADR/DDD directories to docs/implementation/ - Fix helper scripts (statusline, adr-compliance, ddd-tracker, guidance-hooks) - Update 58 agent definitions: aqe/v3/ → aqe/ memory namespaces - Update 15 guidance shards: v3/src/ → src/ path references - Fix sync interfaces: remove v3/ and v2/ path references - Fix test path calculations (process.cwd() + '..' no longer needed) - Fix flaky perf test threshold (500ms → 1000ms for CI environments) - Fix complexity-analyzer test to match ADR-051 keyword-based eligibility Build passes, 17,901 tests pass, CLI and MCP bundles verified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
133 lines
4.7 KiB
TypeScript
133 lines
4.7 KiB
TypeScript
/**
|
|
* Test migrated V2 patterns with V3 SQLite Pattern Store
|
|
* Direct test without HNSW dependency
|
|
*/
|
|
|
|
import { createSQLitePatternStore } from '../src/learning/sqlite-persistence.js';
|
|
import type { QEDomain } from '../src/learning/qe-patterns.js';
|
|
import type { QEPattern } from '../src/learning/qe-patterns.js';
|
|
|
|
async function main() {
|
|
console.log('=== Testing Migrated V2 Patterns with V3 SQLite Store ===\n');
|
|
|
|
// Initialize SQLite Pattern Store
|
|
console.log('1. Initializing SQLite Pattern Store...');
|
|
const patternStore = createSQLitePatternStore({
|
|
dbPath: '.agentic-qe/memory.db',
|
|
});
|
|
|
|
await patternStore.initialize();
|
|
console.log(' Initialized');
|
|
|
|
// Get statistics
|
|
console.log('\n2. Getting Statistics...');
|
|
const stats = patternStore.getStats();
|
|
console.log(' Total Patterns:', stats.totalPatterns);
|
|
console.log(' By Domain:');
|
|
for (const [domain, count] of Object.entries(stats.byDomain)) {
|
|
console.log(' -', domain + ':', count);
|
|
}
|
|
console.log(' By Tier:');
|
|
for (const [tier, count] of Object.entries(stats.byTier)) {
|
|
console.log(' -', tier + ':', count);
|
|
}
|
|
|
|
// Test pattern retrieval
|
|
console.log('\n3. Testing Pattern Retrieval...');
|
|
const allPatterns = patternStore.getAllPatterns(100);
|
|
console.log(' Retrieved', allPatterns.length, 'patterns');
|
|
|
|
if (allPatterns.length > 0) {
|
|
console.log('\n Sample patterns (by domain):');
|
|
const byDomain: Record<string, QEPattern[]> = {};
|
|
for (const p of allPatterns) {
|
|
if (!byDomain[p.qeDomain]) byDomain[p.qeDomain] = [];
|
|
byDomain[p.qeDomain].push(p);
|
|
}
|
|
|
|
for (const [domain, patterns] of Object.entries(byDomain).slice(0, 4)) {
|
|
console.log(' ', domain + ':', patterns.length, 'patterns');
|
|
const sample = patterns[0];
|
|
console.log(' -', sample.name, '(tier:', sample.tier + ', confidence:', sample.confidence + ')');
|
|
}
|
|
}
|
|
|
|
// Test high-quality patterns
|
|
console.log('\n4. Finding High-Quality Patterns...');
|
|
const highQuality = allPatterns
|
|
.filter(p => p.qualityScore > 0.7)
|
|
.sort((a, b) => b.qualityScore - a.qualityScore)
|
|
.slice(0, 10);
|
|
|
|
console.log(' Found', highQuality.length, 'high-quality patterns (quality > 0.7)');
|
|
for (const p of highQuality.slice(0, 5)) {
|
|
console.log(' -', '[' + p.qeDomain + ']', p.name);
|
|
console.log(' Confidence:', p.confidence.toFixed(2), ', Success Rate:', p.successRate.toFixed(2), ', Quality:', p.qualityScore.toFixed(2));
|
|
}
|
|
|
|
// Test patterns by domain
|
|
console.log('\n5. Testing Domain-Specific Retrieval...');
|
|
const testGenPatterns = patternStore.getPatternsByDomain('test-generation', 5);
|
|
console.log(' test-generation patterns:', testGenPatterns.length);
|
|
for (const p of testGenPatterns.slice(0, 3)) {
|
|
console.log(' -', p.name, '(usage:', p.usageCount + ', tier:', p.tier + ')');
|
|
}
|
|
|
|
const codeIntelPatterns = patternStore.getPatternsByDomain('code-intelligence', 5);
|
|
console.log(' code-intelligence patterns:', codeIntelPatterns.length);
|
|
for (const p of codeIntelPatterns.slice(0, 3)) {
|
|
console.log(' -', p.name, '(usage:', p.usageCount + ', tier:', p.tier + ')');
|
|
}
|
|
|
|
// Test pattern promotion
|
|
console.log('\n6. Testing Pattern Promotion...');
|
|
if (allPatterns.length > 0) {
|
|
const testPattern = allPatterns.find(p => p.tier === 'short-term') || allPatterns[0];
|
|
console.log(' Promoting:', testPattern.name);
|
|
console.log(' Old tier:', testPattern.tier);
|
|
|
|
patternStore.promotePattern(testPattern.id);
|
|
const updated = patternStore.getPattern(testPattern.id);
|
|
console.log(' New tier:', updated?.tier || 'unknown');
|
|
}
|
|
|
|
// Test storing a new pattern
|
|
console.log('\n7. Testing New Pattern Storage...');
|
|
const newPattern: QEPattern = {
|
|
id: 'test-v3-migration-' + Date.now(),
|
|
patternType: 'test-template',
|
|
qeDomain: 'test-generation',
|
|
domain: 'test-generation',
|
|
name: 'V3 Migration Test Pattern',
|
|
description: 'Test pattern created during V3 migration verification',
|
|
confidence: 0.9,
|
|
usageCount: 0,
|
|
successRate: 1.0,
|
|
qualityScore: 0.9,
|
|
tier: 'short-term',
|
|
context: {
|
|
framework: 'vitest',
|
|
language: 'typescript',
|
|
},
|
|
};
|
|
|
|
patternStore.storePattern(newPattern);
|
|
console.log(' Stored new pattern:', newPattern.id);
|
|
|
|
const retrieved = patternStore.getPattern(newPattern.id);
|
|
console.log(' Retrieved:', retrieved?.name || 'not found');
|
|
|
|
// Final stats
|
|
console.log('\n8. Final Statistics...');
|
|
const finalStats = patternStore.getStats();
|
|
console.log(' Total Patterns:', finalStats.totalPatterns);
|
|
console.log(' Total Successful Uses:', finalStats.totalSuccessfulUses);
|
|
|
|
console.log('\n=== All Tests Passed ===');
|
|
}
|
|
|
|
main().catch(error => {
|
|
console.error('Test failed:', error);
|
|
process.exit(1);
|
|
});
|