Closed ckhsponge closed 6 months ago
@andrykonchin I made some updates to the transaction API and now there is no longer a mess of hashes being passed around. Your feedback would be appreciated. Some minor cleanup and tests are still needed.
Attention: 6 lines
in your changes are missing coverage. Please review.
Comparison is base (
4520343
) 90.32% compared to head (a5b7640
) 90.89%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@andrykonchin Another round of feedback would be appreciated. I believe all issues were covered although adding block support for updates is something that could still be done. This might be a cleaner place to add add() expressions.
I'd like to get to a v1 candidate at some point with unit tests included.
@andrykonchin Thanks for the feedback. There are now proper delete and destroys. Upsert is working like an upsert as well.
Looks good so we can move on and and add specs.
@andrykonchin There's now a collection of specs for the transaction writes. Can you run them on github or give me permission to run them?
What else is needed to get v1 released?
Thanks!
The new specs look good, but I would prefer to have more granular test cases that check only one aspect of a method behaviour (ideally only one check/assert per case)
The new specs look good, but I would prefer to have more granular test cases that check only one aspect of a method behaviour (ideally only one check/assert per case)
Yeah, I usually put 4 or 5 syntax checks in each case. I'll split those out.
@andrykonchin Thanks for the specs review. What are your thoughts on this one? https://github.com/Dynamoid/dynamoid/pull/688#discussion_r1436639724
A failing spec is fixed on master.
@andrykonchin update() and upsert() no longer allow a key to be specified separate from the attributes. A key must always be included in the model or in the attributes. This simplifies the method signatures and makes them consistent with the other transaction actions.
I believe I covered all your feedback on the specs so another round of review would be good. Thanks!!!
@andrykonchin More tests were added for rollbacks and callbacks. Instance usage tests for upsert were removed.
I removed the named parameter for options. This simplifies the brackets for expected usage e.g.:
save!( instance, skip_callbacks: true)
create!( klass, name: 'hi')
create!( klass, {name: 'hi'}, {skip_callbacks: true})
instead of:
save!( instance, options: {skip_callbacks: true})
create!( klass, {name: 'hi'})
create!( klass, {name: 'hi'}, options: {skip_callbacks: true})
@andrykonchin I believe all feedback has been addressed and further review would be appreciated.
@andrykonchin Anything blocking this? Thanks.
Could you please fix Rubocop issues (related to the changes only - there are some existing issues on master - I will address them myself) and squash all the working commits into one or more atomic ones?
I want to release a new version without transactions now and release transactions in the next version. The last release was a year ago and I was already asked for new version.
@andrykonchin I squashed the commits and I believe Rubocops will pass. Anything else I need to do? There are Codeclimate complexity issues.
Merged! :tada: Great work!
That's great news! Thanks for the support.
This is a first attempt at dynamodb transactions that can span tables. Create, update, upsert and delete are supported. See README_transact.md for examples of the proposed API.
Tests have not yet been implemented.