feat(dynamodb): optimistic concurrency on update() (#24) - #255
Merged
codeforstartups merged 1 commit intoSep 25, 2026
Merged
codeforstartups merged 1 commit into
codeforstartups merged 1 commit into
Conversation
update() now stores a version attribute on the DynamoDB item and writes it with a ConditionExpression, so a concurrent change raises ConflictError (nothing written) instead of being silently overwritten. - DynamoDBStore.put_versioned: conditional put_item that bumps the version; ConditionalCheckFailedException -> ConflictError - DynamoDBStore.get_versioned: strongly consistent GetItem incl. version - Dynavec.update: optional expected_version=, returns the new version on UpsertResult.version; writes DynamoDB before S3 Vectors so a conflict leaves both stores untouched - Plain upsert() stays last-writer-wins and drops the version - moto-backed store tests + in-memory client tests for conflicts
Collaborator
codeforstartups
approved these changes
Sep 25, 2026
codeforstartups
left a comment
Owner
There was a problem hiding this comment.
Excellent — real optimistic concurrency for update() (#24). Each item carries a version, and updates write with a ConditionExpression so a concurrent change raises ConflictError (nothing written) instead of a silent lost update. Nice touches: expected_version= to guard across your own read/modify/write cycle, UpsertResult.version returning the new version, and upsert() deliberately staying last-writer-wins. Verified locally: ruff clean, 58 tests pass, CI green. Docs + CHANGELOG updated. Merging — thanks @R3108! 🙌
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.
update() now stores a version attribute on the DynamoDB item and writes it with a ConditionExpression, so a concurrent change raises ConflictError (nothing written) instead of being silently overwritten.
Description
Related issue
Fixes #
Changes
Testing
Checklist