From f463ee3fe233793d1ba0690a744349dda70df72e Mon Sep 17 00:00:00 2001 From: David Snelling Date: Tue, 2 Sep 2025 15:02:50 -0700 Subject: [PATCH] fix: remove dangerous count methods from interface - Removed countNouns() and countVerbs() from BaseStorageAdapter - These methods would be dangerous with millions of entries - We already have incremental statistics tracking via incrementStatistic() - Statistics are maintained in cache and updated as items are added/removed - Much more scalable than iterating through all items The existing statistics system is the proper way to get counts: - Uses incrementStatistic('noun'/'verb', service) on add - Uses decrementStatistic() on delete - Access via getStatistics() which returns cached counts - No iteration through millions of items needed --- src/storage/adapters/baseStorageAdapter.ts | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/storage/adapters/baseStorageAdapter.ts b/src/storage/adapters/baseStorageAdapter.ts index 53964bb9..d7a53b5a 100644 --- a/src/storage/adapters/baseStorageAdapter.ts +++ b/src/storage/adapters/baseStorageAdapter.ts @@ -145,24 +145,6 @@ export abstract class BaseStorageAdapter implements StorageAdapter { nextCursor?: string }> - /** - * Count total number of nouns (optional) - * WARNING: Implementations should be efficient for large datasets. - * Consider caching counts or using database COUNT operations. - * @param filter Optional filter criteria - * @returns Promise that resolves to the count - */ - countNouns?(filter?: any): Promise - - /** - * Count total number of verbs (optional) - * WARNING: Implementations should be efficient for large datasets. - * Consider caching counts or using database COUNT operations. - * @param filter Optional filter criteria - * @returns Promise that resolves to the count - */ - countVerbs?(filter?: any): Promise - // Statistics cache protected statisticsCache: StatisticsData | null = null