Openfoodnetwork: Some Mail Method Settings disappear after deployment (copy and intercept)

Created on 19 Aug 2020  路  5Comments  路  Source: openfoodfoundation/openfoodnetwork

Description


While testing #5733, it was noticed that some Mail Method Settings were not retained after staging pull-requests. This concerns specifically the fields:

  • Send Copy of All Mails To
  • Intercept Email Address

This was checked on staging servers-UK and -FR. Not sure it affects production.

Expected Behavior

These settings should be retained after staging additional PRs.

Actual Behaviour

Previously set email addresses disappear, after subsequent deployments

Steps to Reproduce




  1. Log in as superadmin
  2. Go to Configuration > Mail Method Settings (/admin/mail_methods/edit)
  3. Set up mail addresses for copy and interception
  4. Make sure you click update
  5. Refresh the page, making sure changes were saved.
  6. Go to semaphore and stage the current master or some other PR
  7. After deployment, go back to your browser, and refresh the page
  8. See the previously set fields are empty

Workaround

Retyping the settings after each deployment.

Severity

I don't know if this is a v3-regression. Maybe bug-s3?
Update: this bug was observed in production already, as discussed here.

Your Environment

  • Version used: v3.2.3
  • Browser name and version: Firefox 79
  • Operating System and version (desktop or mobile): Desktop / Ubuntu 20.04

Possible Fix

When rolling out v3, some configurations were verified to disappear with deployment, as discussed in Slack under this channel. Could this be related?

bug-s4

Most helpful comment

We have master build broken after merging #5733 with specs broken in the mail interceptor.
So this is introduced by 5733.
I'll have a look tomorrow.

All 5 comments

We have master build broken after merging #5733 with specs broken in the mail interceptor.
So this is introduced by 5733.
I'll have a look tomorrow.

I've noticed other lib loading bugs in the last day or so in master, specs failing that suddenly needed explicit require statements for missing classes...

Is there something spree does to autoload lib files that we're somehow missing now?

Just dropping a line to confirm that these settings disappear upon re-deployment on versions 3.2.2 and 3.2.3. Here's how I ran the test:

  • deploy v3.2.3 on staging UK
  • added email settings
  • redeployed v3.2.3

Repeated for v3.2.2 for staging-fr and checked that in both cases settings are wiped out.

Chatting with @luisramos0 we conclude this may relate to ofn-install issues. Further investigating.

ok, I think I know what's happening.
mail_bcc is a setting in ofn-install since 2018 https://github.com/openfoodfoundation/ofn-install/pull/203/files
if this is defined in secrets, the value will be overridden on every deploy.
if the value is not defined, the value will be wiped out as per https://github.com/openfoodfoundation/openfoodnetwork/blob/master/db/seeds.rb#L16

This is happening in staging because staging secrets do not have mail_bcc, this is not a problem in prod as the correct values from prod secrets are overridden on every deploy.

the issue is then: if a admin changes mail_bcc field in prod, on the next deploy, the value will be overrided by the value in ofn-install.

options:

  • we can remove the ofn-install setting - I'd vote on this one
  • we can remove the field from config - I dont think there's much risk related to this field so I think we can keep it in the admin page
  • we can write some code in seeds.rb that will override the value only if mail_bcc is defined in secrets and leave it if there isnt a setting in secrets

we now know how this works and it's not a serious problem. I am moving to s4 now.

Was this page helpful?
0 / 5 - 0 ratings