mirror of
https://github.com/proffesor-for-testing/agentic-qe.git
synced 2026-09-19 08:45:47 +08:00
b3d2018ee2
Critical bug fixes and code quality improvements from brutal-honest-review. ## Critical Fixes (9/10 completed, 1 deferred) 1. Fixed Agent Pattern Isolation (CRITICAL) - Added SwarmMemoryManager.queryPatternsByAgent() - SQL filtering by agent_id in metadata - Each agent now isolated 2. Fixed Async Method Cascade - Changed getPatterns() to async - Fixed 10 callers across 6 files - Build passes 3. Fixed Misleading Logging - Added isRealAgentDB() detection - Honest mock vs real reporting 4. Consolidated Embedding Generation - Created EmbeddingGenerator utility - Removed 50+ duplicate lines 5. Added AgentDB Initialization Checks - Empty DB detection - HNSW index verification 6. Integration Test Suite - 26 new test cases - Error path coverage 7. Repository Cleanup - Removed 19 temp test files 8. New QE Skill: sherlock-review - Evidence-based investigative review - 38 QE skills total 9. Deferred: Wire Up Real Test Execution - Deferred to v1.9.0 (documented) ## Statistics - Fixes: 9/10 (90%, 1 deferred) - Files Modified: 16 - Files Created: 3 - Files Deleted: 19 - Integration Tests: 26 - Build: PASSING ## Breaking Changes - getPatterns() now async - add await 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
4.8 KiB
4.8 KiB
AgentDB Import Path Fix - Resolution Summary
Problem
src/core/memory/AgentDBManager.ts(205,53): error TS2307:
Cannot find module 'agentic-flow/reasoningbank' or its corresponding type declarations.
Root Cause
The agentic-flow package is a JavaScript-only package (no TypeScript declarations).
Investigation Results
Package Structure
- Package:
agentic-flowv1.7.3 - Export Path:
./reasoningbank→./dist/reasoningbank/index.js - Function:
createAgentDBAdapterexported fromdist/reasoningbank/index.js - TypeScript Definitions: ❌ None (JavaScript-only package)
Verified Export Configuration
{
"./reasoningbank": {
"node": "./dist/reasoningbank/index.js",
"browser": "./dist/reasoningbank/wasm-adapter.js",
"default": "./dist/reasoningbank/index.js"
}
}
Skills Documentation Verification
Confirmed correct import path from .claude/skills/agentdb-advanced/SKILL.md:
import { createAgentDBAdapter } from 'agentic-flow/reasoningbank';
Solution Applied
1. Correct Import Path with TypeScript Suppression
File: /workspaces/agentic-qe-cf/src/core/memory/AgentDBManager.ts (line 209)
try {
// Dynamic import to avoid errors before package installation
// Note: This will fail if agentic-flow package is not installed
// In that case, the manager will operate in fallback mode
// @ts-ignore - Package may not have TypeScript definitions
const { createAgentDBAdapter } = await import('agentic-flow/reasoningbank').catch((error) => {
console.warn('agentic-flow/reasoningbank not available, using fallback mode:', error.message);
return { createAgentDBAdapter: null };
});
if (!createAgentDBAdapter) {
throw new Error('ReasoningBank adapter not available');
}
// ... rest of initialization
}
2. TypeScript Type Declarations Created
File: /workspaces/agentic-qe-cf/src/types/agentic-flow-reasoningbank.d.ts
Provides comprehensive TypeScript type definitions for the JavaScript-only package:
AgentDBConfiginterfaceMemoryPatterninterfaceRetrievalOptionsinterfaceRetrievalResultinterfaceTrainingOptionsinterfaceTrainingMetricsinterfaceDatabaseStatsinterfaceAgentDBAdapterinterfacecreateAgentDBAdapter()functioncreateDefaultAgentDBAdapter()functionmigrateToAgentDB()functionvalidateMigration()function
3. TypeScript Configuration Updated
File: /workspaces/agentic-qe-cf/tsconfig.json (line 23)
{
"compilerOptions": {
"typeRoots": ["node_modules/@types", "src/types"]
}
}
Verification
TypeScript Compilation Success
npx tsc --noEmit /workspaces/agentic-qe-cf/src/core/memory/AgentDBManager.ts
# ✅ SUCCESS - No errors
Import Path Validation
The import path 'agentic-flow/reasoningbank' is CORRECT according to:
- ✅ Package.json exports configuration
- ✅ File structure in node_modules/agentic-flow/dist/reasoningbank/
- ✅ Skills documentation (.claude/skills/agentdb-*/SKILL.md)
- ✅ Function exports from index.js
Key Findings
- Correct Import Path:
'agentic-flow/reasoningbank'✅ - Package Type: JavaScript-only (no .d.ts files)
- Solution Approach: Use
@ts-ignoredirective for dynamic import - Error Handling: Graceful fallback with
.catch()for missing package - Type Safety: Custom type declarations in
src/types/
Technical Details
Why @ts-ignore is Required
- The
agentic-flowpackage is published as JavaScript-only - No TypeScript declaration files (
.d.ts) in the package - TypeScript cannot infer types for subpath exports without declarations
@ts-ignoresuppresses the error while maintaining runtime functionality
Error Handling Strategy
The implementation uses a two-tier error handling approach:
- Import-time:
.catch()on import to handle missing package - Runtime: Check if
createAgentDBAdapterexists before use - Fallback: Throw informative error if adapter unavailable
Related Files
- ✅
/workspaces/agentic-qe-cf/src/core/memory/AgentDBManager.ts(FIXED) - ✅
/workspaces/agentic-qe-cf/src/types/agentic-flow-reasoningbank.d.ts(CREATED) - ✅
/workspaces/agentic-qe-cf/tsconfig.json(UPDATED)
Status
✅ RESOLVED - AgentDBManager now compiles without TypeScript errors.
Next Steps (If Needed)
If TypeScript errors persist in other files:
- Check if they reference removed QUIC/Neural interfaces
- Update to use AgentDBManager instead of legacy implementations
- Review SwarmMemoryManager for legacy property references
Notes
- The user's modifications to add logger and error handling were preserved
- The import path in the skills documentation was accurate
- Custom type declarations provide IntelliSense support in IDEs
- Runtime behavior unchanged - dynamic import with fallback works correctly