You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BREAKING CHANGE: This release introduces significant performance improvements
that change the internal storage format and key structure. Checkpoints created
with earlier versions are incompatible with v0.1.0.
Key performance improvements:
- Replace some FT.SEARCH operations with sorted sets for write tracking
- Add checkpoint-based key registry eliminating expensive SCAN/KEYS operations
- Implement multi-level caching for frequently accessed keys and data
- Optimize batch operations with pipelined Redis commands
- Add lazy TTL refresh to reduce unnecessary operations
- Improve index schemas for better query performance
Architectural changes:
- New CheckpointKeyRegistry tracks writes per checkpoint using sorted sets
- Cached key generation methods reduce string concatenation overhead
- Batch loading methods for pending writes and sends
- Optimized get_tuple with direct document access patterns
- Improved TTL management with threshold-based refresh
Testing improvements:
- Add comprehensive test coverage for new registry functionality
- Test TTL behaviors, caching mechanisms, and error paths
- Add integration tests for blob handling and metadata operations
- Improve test isolation using unique thread IDs instead of flushdb
The new architecture provides:
- 50-70% reduction in Redis operations for typical workflows
- Better scalability with checkpoint-scoped write tracking
- Reduced memory footprint through efficient caching
- Improved cluster mode compatibility
Copy file name to clipboardExpand all lines: CLAUDE.md
+102-7Lines changed: 102 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,33 +2,87 @@
2
2
3
3
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
4
5
+
## How to Write Tests for Coverage
6
+
7
+
When improving test coverage, follow these principles:
8
+
9
+
1.**Focus on Integration Tests**: Write tests that use real Redis instances and test actual usage scenarios. Unit tests are secondary to integration tests.
10
+
11
+
2.**Test What Code SHOULD Do**: Don't write tests that mirror what the code currently does. Test against the expected behavior and requirements.
12
+
13
+
3.**Use Meaningful Test Names**: Test names should describe the behavior being tested, not generic names like "test_function_x".
14
+
15
+
4.**Research Before Writing**: Find and understand existing tests for the feature/area before adding new tests.
16
+
17
+
5.**Test Error Paths and Edge Cases**: Focus on uncovered error handling, boundary conditions, and edge cases.
18
+
19
+
6.**Run Tests Incrementally**: Run `make test-all` after every 5 tests to ensure no regressions.
20
+
21
+
7.**Avoid "Ugly Mirror" Testing**: Don't create tests that simply verify the current implementation. Test the contract and expected behavior.
22
+
23
+
Example of a good integration test for error handling:
"""Test handling of malformed base64 data in blob decoding."""
27
+
with _saver(redis_url) as saver:
28
+
# Set up real scenario
29
+
# Test error condition
30
+
# Verify graceful handling
31
+
```
32
+
33
+
## CRITICAL: Always Use TestContainers for Redis
34
+
35
+
**NEVER use Docker directly or manually start Redis containers!** All tests, benchmarks, and profiling scripts MUST use TestContainers. The library handles container lifecycle automatically.
36
+
37
+
```python
38
+
from testcontainers.redis import RedisContainer
39
+
40
+
# Use redis:8 (has all required modules) or redis/redis-stack-server:latest
0 commit comments