Skip to content
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

fix(idempotency): record validation not using hash #1502

Merged
merged 3 commits into from
Jun 15, 2023

Conversation

dreamorosi
Copy link
Contributor

Description of your changes

As reported in the linked issue, the persistence layer for the Idempotency utility was not using the payload hash when payload validation was enabled. This was caused by two issues:

  • While the hash for the payload was saved in DynamoDB under the attribute validation, on subsequent requests the value was discarded at runtime and not used when instantiating the IdempotencyRecord
  • The hash being generated and stored was using the full payload even when a JMESPath expression was specified, instead of using the expression to identify a subset of the payload. This would have caused the validation to always fail since the JMESPath expression was used in the control item but not in the stored one.

Both issues have been fixed in this PR. The PR also contains an unrelated change that aligns the name of the in progress expiry attribute with the reference implementation (in_progress_expiration).

Related issues, RFCs

Issue number: #1499

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my change is effective and works
  • The PR title follows the conventional commit semantics

Breaking change checklist

Is it a breaking change?: NO

  • I have documented the migration process
  • I have added, implemented necessary warnings (if it can live side by side)

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.

@dreamorosi dreamorosi self-assigned this Jun 15, 2023
@boring-cyborg boring-cyborg bot added idempotency This item relates to the Idempotency Utility tests PRs that add or change tests labels Jun 15, 2023
@pull-request-size pull-request-size bot added the size/S PR between 10-29 LOC label Jun 15, 2023
@dreamorosi dreamorosi requested a review from am29d June 15, 2023 00:50
@github-actions github-actions bot added the bug Something isn't working label Jun 15, 2023
@boring-cyborg boring-cyborg bot added the dependencies Changes that touch dependencies, e.g. Dependabot, etc. label Jun 15, 2023
@pull-request-size pull-request-size bot added size/M PR between 30-99 LOC and removed size/S PR between 10-29 LOC labels Jun 15, 2023
@dreamorosi dreamorosi removed the dependencies Changes that touch dependencies, e.g. Dependabot, etc. label Jun 15, 2023
@brianhyder
Copy link

I pulled the branch and tested it. This fixes the issue I was seeing earlier. Thank you, all!

@dreamorosi dreamorosi merged commit f475bd0 into main Jun 15, 2023
@dreamorosi dreamorosi deleted the 1499-bug-payload-hash-dropped branch June 15, 2023 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working idempotency This item relates to the Idempotency Utility size/M PR between 30-99 LOC tests PRs that add or change tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Payload Hash is Not Set on IdempotentRecord When Retrieving from Dynamo & Failing Validation
2 participants