Skip to content

feat: add support for ReturnValuesOnConditionCheckFailure in Idempotency #930

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

hjgraca
Copy link
Contributor

@hjgraca hjgraca commented Jul 17, 2025

Please provide the issue number

Issue number: #803

Summary

Changes

This pull request enhances the idempotency handling in the AWS Lambda Powertools library by introducing new functionality for processing existing records and improving exception handling. The changes include updates to the IdempotencyItemAlreadyExistsException class, modifications to the persistence layer for better validation and caching, and the addition of comprehensive tests to ensure correctness.

Enhancements to idempotency handling:

  • Improved exception handling in IdempotencyItemAlreadyExistsException:

    • Added a new Record property to store the existing record details when an exception is thrown.
    • Updated DynamoDBPersistenceStore to populate the Record property in the exception when a conditional check fails, enabling downstream validation and caching.
  • New method for processing existing records in BasePersistenceStore:

    • Introduced ProcessExistingRecord to validate an existing record against the current data payload and optionally cache it locally. This ensures data consistency and improves performance when local caching is enabled.
    • Updated IdempotencyAspectHandler to utilize the ProcessExistingRecord method for handling exceptions more effectively.

User experience

Please share what the user experience looks like before and after this change

Checklist

Please leave checklist items unchecked if they do not apply to your change.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

…ng record details and improve error handling in persistence layer
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 17, 2025
@github-actions github-actions bot added the feature New features or minor changes label Jul 17, 2025
@hjgraca hjgraca requested a review from dreamorosi July 17, 2025 16:26
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

Attention: Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.31%. Comparing base (e68f39c) to head (0e08856).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
...dempotency/Persistence/DynamoDBPersistenceStore.cs 91.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #930      +/-   ##
===========================================
+ Coverage    77.28%   77.31%   +0.03%     
===========================================
  Files          272      272              
  Lines        10875    10899      +24     
  Branches      1278     1281       +3     
===========================================
+ Hits          8405     8427      +22     
- Misses        2054     2055       +1     
- Partials       416      417       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dreamorosi
Copy link
Contributor

Hey Henrique, I'll review this tomorrow - thanks for working on this!

Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question - if the question is not valid, feel free to resolve and merge.

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/idempotency feature New features or minor changes size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: add support for ReturnValuesOnConditionCheckFailure in Idempotency
2 participants