fix(core): resolve TypeScript compilation errors and test failures

- Add missing 'level' property to HNSWNoun objects in storage adapters
- Fix HNSWVerb type compatibility in CacheManager imports
- Clear statistics cache when clearing storage to prevent stale data
- Update test expectations to match actual HNSW index behavior (includes both nouns and verbs)
- Add StatisticsCollector utility for enhanced metrics tracking
- Improve statistics comparison in tests to handle volatile fields
This commit is contained in:
David Snelling 2025-08-04 20:00:38 -07:00
parent 649e452ff9
commit cfaf2f8b83
12 changed files with 668 additions and 112 deletions

View file

@ -440,7 +440,8 @@ export class S3CompatibleStorage extends BaseStorage {
const node = {
id: parsedNode.id,
vector: parsedNode.vector,
connections
connections,
level: parsedNode.level || 0
}
console.log(`Successfully retrieved node ${id}:`, node)
@ -1585,6 +1586,10 @@ export class S3CompatibleStorage extends BaseStorage {
// Delete all objects in the index directory
await deleteObjectsWithPrefix(this.indexPrefix)
// Clear the statistics cache
this.statisticsCache = null
this.statisticsModified = false
} catch (error) {
console.error('Failed to clear storage:', error)
throw new Error(`Failed to clear storage: ${error}`)