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

Enable customer_balance feature toggle to all users #7363

Merged

Conversation

sauloperez
Copy link
Contributor

@sauloperez sauloperez commented Apr 9, 2021

What? Why?

Closes #6699

It changes the toggle logic to have it enabled in all environments but testing. This makes the tests still pass, which rely on the off-branch logic of the toggle. We'll work on them next.

So, when we deploy this, if anything goes wrong we can simply revert this commit and we'll get back to the former state: balances enabled only for UK and FR and the individual users that we have configured in ofn-install for all the other instances.

If we wish to disable it for UK and FR too, we'll need to reprovision a new BETA_TESTERS var for them though at this point, I hardly doubt we'll encounter any outstanding issue.

What should we test?

We should see the new balances, the ones that consider canceled orders, in /account but without having to enable the toggle manually.

Release notes

Release customer balances to all users
Changelog Category: User facing changes

This however makes the tests still pass, which rely on the off-branch
logic of the toggle. We'll work on them next.
@sauloperez sauloperez self-assigned this Apr 9, 2021
@codecov
Copy link

codecov bot commented Apr 9, 2021

Codecov Report

Merging #7363 (ec49d96) into master (199efb1) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head ec49d96 differs from pull request most recent head 95f29e4. Consider uploading reports for the commit 95f29e4 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7363   +/-   ##
=======================================
  Coverage   93.08%   93.08%           
=======================================
  Files         633      633           
  Lines       18142    18134    -8     
=======================================
- Hits        16887    16880    -7     
+ Misses       1255     1254    -1     
Impacted Files Coverage Δ
app/models/spree/order.rb 95.31% <ø> (-0.05%) ⬇️
app/models/spree/adjustment.rb 100.00% <100.00%> (+1.58%) ⬆️
app/models/spree/return_authorization.rb 95.31% <100.00%> (+0.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 199efb1...95f29e4. Read the comment docs.

@@ -3,11 +3,7 @@
beta_testers = ENV['BETA_TESTERS']&.split(/[\s,]+/) || []
Copy link
Contributor

Choose a reason for hiding this comment

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

You keep this line just for the record?

Copy link
Member

Choose a reason for hiding this comment

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

I would remove it in the same commit. So if we needed to revert this, it's done in one step.

These no longer make sense since we're enabling customer_balance
unconditionally.
else
beta_testers.include?(user.email)
end
!Rails.env.test?
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes me a bit uncomfortable...

Copy link
Member

Choose a reason for hiding this comment

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

Me too. It would have been good modify the specs in a way that they still pass. The simplest way would be to stub this method in related tests. That would make sure that all the other specs, which we think are not affected by this, are still passing and there is no surprising side effect.

Copy link
Contributor

@andrewpbrett andrewpbrett left a comment

Choose a reason for hiding this comment

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

I agree with Matt's comment - wouldn't merging this mean merging something into production that doesn't have passing specs?

@filipefurtad0
Copy link
Contributor

Hey @sauloperez ,
I staged this in staging-ES and can confirm it enables customer balances 👍
The reviews seem a bit in the gray-zone, not sure this is good to merge as is...

@@ -3,11 +3,7 @@
beta_testers = ENV['BETA_TESTERS']&.split(/[\s,]+/) || []
Copy link
Member

Choose a reason for hiding this comment

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

I would remove it in the same commit. So if we needed to revert this, it's done in one step.

else
beta_testers.include?(user.email)
end
!Rails.env.test?
Copy link
Member

Choose a reason for hiding this comment

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

Me too. It would have been good modify the specs in a way that they still pass. The simplest way would be to stub this method in related tests. That would make sure that all the other specs, which we think are not affected by this, are still passing and there is no surprising side effect.

@andrewpbrett andrewpbrett merged commit e90420b into openfoodfoundation:master Apr 12, 2021
@sauloperez sauloperez deleted the release-balances-to-all-users branch April 12, 2021 06:57
@sauloperez
Copy link
Contributor Author

sorry guys, I took the shortcut to have it done quickly and get it into the release. No bugs were reported in FR and UK for the last few weeks (except for the one we fixed) and running the specs with the feature on a separate branch didn't reveal any unexpected issues either.

sauloperez added a commit to coopdevs/openfoodnetwork that referenced this pull request Apr 12, 2021
This makes all tests exercise the new branch that `OrderBalance`
abstracts. It follows up openfoodfoundation#7363 addressing code review comments.
@sauloperez
Copy link
Contributor Author

I addressed all these comments in #7396

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release new customer balance calculation to the entire userbase
6 participants