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

feat!: DeleteAll match pattern and v5 adjustments #174

Merged
merged 5 commits into from
Jul 30, 2024

Conversation

moritzraho
Copy link
Member

@moritzraho moritzraho commented Jul 16, 2024

Description

MAJOR: This will go in v5

Add support for a match pattern for deleting a selected set of keys.

Breaking changes:

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link

codecov bot commented Jul 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (709330b) to head (f4a2ccf).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #174   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          251       265   +14     
  Branches        43        48    +5     
=========================================
+ Hits           251       265   +14     

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

Copy link
Member

@shazron shazron left a comment

Choose a reason for hiding this comment

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

just double checking - if the dev just calls deleteAll(() it will fail right? (based on the regex) and they have to add * to match if they want to delete everything.

@shazron
Copy link
Member

shazron commented Jul 17, 2024

nvm - I see that the test is there where deleteAll should delete everything. Giving me nightmares if somehow I had a typo in there or wrong/null object. Perhaps as a "confirmation" step, where if you really want to deleteAll it should really be deleteAll({ match: '*' }) WDYT?

@moritzraho
Copy link
Member Author

moritzraho commented Jul 17, 2024

nvm - I see that the test is there where deleteAll should delete everything. Giving me nightmares if somehow I had a typo in there or wrong/null object. Perhaps as a "confirmation" step, where if you really want to deleteAll it should really be deleteAll({ match: '*' }) WDYT?

yes felt this too, now the issue is that we already exposed deleteAll()... and because this is already used as part of the deleteService we would need to make it a breaking change. Which could be acceptable at that point, wdyt?

Edit: Another alternative without requiring a breaking change would be state.delete('supports*pattern') and keeping state.deleteAll()

@shazron
Copy link
Member

shazron commented Jul 17, 2024

nvm - I see that the test is there where deleteAll should delete everything. Giving me nightmares if somehow I had a typo in there or wrong/null object. Perhaps as a "confirmation" step, where if you really want to deleteAll it should really be deleteAll({ match: '*' }) WDYT?

yes felt this too, now the issue is that we already exposed deleteAll()... and because this is already used as part of the deleteService we would need to make it a breaking change. Which could be acceptable at that point, wdyt?

Edit: Another alternative without requiring a breaking change would be state.delete('supports*pattern') and keeping state.deleteAll()

Let's put it up for discussion. Seeing that this is a "dangerous" function to use (with no going back), perhaps we need a guard rail in there imo, and it warrants a breaking change.

Copy link
Contributor

@MichaelGoberling MichaelGoberling left a comment

Choose a reason for hiding this comment

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

lgtm!

@moritzraho moritzraho changed the title feat: DeleteAll match pattern feat!: DeleteAll match pattern Jul 29, 2024
@moritzraho moritzraho changed the title feat!: DeleteAll match pattern feat!: DeleteAll match pattern and v5 adjustments Jul 29, 2024
@moritzraho moritzraho merged commit 2a84bcc into main Jul 30, 2024
9 checks passed
@moritzraho moritzraho deleted the feat/delete-all-match branch July 30, 2024 13:03
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.

3 participants