fix: prevent infinite loop in pagination when storage returns phantom items

- Fix FileSystemStorage counting non-existent files in totalCount
- Add safety check in BaseStorage to prevent hasMore:true with empty items
- Ensure pagination terminates correctly even with corrupted storage state
This commit is contained in:
David Snelling 2025-09-16 10:35:07 -07:00
parent 8f7eed05e0
commit 5f10f8d9ab
10 changed files with 340 additions and 22 deletions

View file

@ -189,7 +189,9 @@ export const PATTERNS_METADATA = {
}
}
console.log(\`🧠 Brainy Pattern Library loaded: \${EMBEDDED_PATTERNS.length} patterns, \${(PATTERNS_METADATA.sizeBytes.total / 1024).toFixed(1)}KB total\`)
// Only log if not suppressed - controlled by logging configuration
import { prodLog } from '../utils/logger.js'
prodLog.info(\`🧠 Brainy Pattern Library loaded: \${EMBEDDED_PATTERNS.length} patterns, \${(PATTERNS_METADATA.sizeBytes.total / 1024).toFixed(1)}KB total\`)
`
// Write the TypeScript file