Skip to content

fix(checkpoint-redis): resolve key generation inconsistency in shallo… #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2025

Conversation

bsbodden
Copy link
Contributor

…w savers

Fix incomplete cleanup of blobs and writes in ShallowRedisSaver and AsyncShallowRedisSaver
due to inconsistent key generation between base class and shallow cleanup patterns.

The base class uses storage-safe transformations (to_storage_safe_id/to_storage_safe_str)
which convert empty checkpoint_ns to "empty", while shallow cleanup patterns used
raw empty strings, causing cleanup operations to miss actual keys.

Changes:

  • Update _make_shallow_redis_checkpoint_blob_key_pattern to use to_storage_safe_id/to_storage_safe_str
  • Update _make_shallow_redis_checkpoint_writes_key_pattern to use same transformations
  • Apply fixes to both sync (shallow.py) and async (ashallow.py) implementations
  • Add comprehensive tests to verify cleanup behavior and key generation consistency

Fixes prevent memory leaks where old blob versions and writes accumulated instead
of being properly cleaned up during checkpoint operations.

…w savers

  Fix incomplete cleanup of blobs and writes in ShallowRedisSaver and AsyncShallowRedisSaver
  due to inconsistent key generation between base class and shallow cleanup patterns.

  The base class uses storage-safe transformations (to_storage_safe_id/to_storage_safe_str)
  which convert empty checkpoint_ns to "__empty__", while shallow cleanup patterns used
  raw empty strings, causing cleanup operations to miss actual keys.

  Changes:
  - Update _make_shallow_redis_checkpoint_blob_key_pattern to use to_storage_safe_id/to_storage_safe_str
  - Update _make_shallow_redis_checkpoint_writes_key_pattern to use same transformations
  - Apply fixes to both sync (shallow.py) and async (ashallow.py) implementations
  - Add comprehensive tests to verify cleanup behavior and key generation consistency

  Fixes prevent memory leaks where old blob versions and writes accumulated instead
  of being properly cleaned up during checkpoint operations.
@bsbodden bsbodden merged commit 33d974b into main Jun 18, 2025
19 checks passed
@bsbodden bsbodden deleted the bsb/fix-cleanup-blobs-and-writes-for-shallow-classes branch June 18, 2025 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant