Skip to content

Usage data payload reply_by_email_enabled possible issue

What does this MR do?

Fix reply_by_email_enabled value in usage data payload

Problem

Investigating this I see

      def enabled?
        config.enabled && config.address
      end

# where
Gitlab.config.incoming_email.enabled => false
Gitlab.config.incoming_email.address => "gitlab-incoming+%{key}@gmail.com"

# in ruby we have
=> "gitlab-incoming+%{key}@gmail.com"
[8] pry(main)> false && "gitlab-incoming+%{key}@gmail.com"
=> false
[9] pry(main)> true && "gitlab-incoming+%{key}@gmail.com"
=> "gitlab-incoming+%{key}@gmail.com"

When we have incoming_email enabled: true enabled? method is going to return the string in config

When this is posted to version-app in raw_usage_data we save

 RawUsageData.last.payload["reply_by_email_enabled"]
  RawUsageData Load (10.0ms)  SELECT  "raw_usage_data".* FROM "raw_usage_data" ORDER BY "raw_usage_data"."id" DESC LIMIT 1
=> "gitlab-incoming+%{key}@gmail.com"
[7] pry(main)> 

and in usage_data we save

 UsageData.find(13315).reply_by_email_enabled
  UsageData Load (14.7ms)  SELECT  "usage_data".* FROM "usage_data" WHERE "usage_data"."id" = 13315 LIMIT 1
=> true

I think in the end we have correct result saved in usage data and incorrect in raw_usage_data and we should fix this

In tests we have

      it 'returns true' do
        expect(described_class.enabled?).to be_truthy
      end
expect("string").to be_truthy # passes

Closes #230603 (closed)

Edited by Alina Mihaila

Merge request reports