Repository navigation
fix(checkpoint): coerce non-str store keys in AsyncBatchedBaseStore - #9624
Closed
manasa1508 wants to merge 1 commit into
Closed
manasa1508 wants to merge 1 commit into
manasa1508 wants to merge 1 commit into
Conversation
`BaseStore` builds its get/put/delete ops with `str(key)`, but `AsyncBatchedBaseStore` overrides `aget`/`aput`/`adelete` and passed the key through unchanged. With `AsyncSqliteStore`, `aput(ns, 42, ...)` stored the item under "42" while `aget(ns, 42)` returned `None`; the sync stores and `InMemoryStore` find it. Coerce non-str keys the same way. str subclasses (e.g. `class Key(str, Enum)`) are passed through unchanged so keys already written through the async stores stay reachable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 tasks done
Contributor
|
This PR has been automatically closed because you are not assigned to the linked issue. External contributors must be assigned to an issue before opening a PR for it. Please:
Maintainers: reopen this PR or remove the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9521
AsyncBatchedBaseStore.aget/aput/adeletenow coerce non-str keys withstr(), asBaseStorehas done since #3739, soAsyncSqliteStore/AsyncPostgresStorefind items by the same key as the sync stores andInMemoryStore. str subclasses (e.g.class Key(str, Enum)) are passed through unchanged, becausestr()on them gives"Key.A"and would make keys already written through the async stores unreachable.No JS change needed.
How I verified
test_async_batch_store_coerces_key_to_strinlibs/checkpoint/tests/test_store.pychecks the keys passed toabatchfor an int key and a(str, Enum)key. It fails on main and passes with the fix.make format,make lint, and thelibs/checkpointsuite pass. Thelibs/checkpoint-sqlitesuite also passes against this change, and the repro from the issue now finds the item throughAsyncSqliteStore.