Closed Bug 1668124 Opened 5 years ago Closed 2 years ago

[beta tree] Intermittent toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js | test_prefs - [test_prefs : 141] We must be able to upload after the policy is accepted. - false == true

Categories

(Thunderbird :: Testing Infrastructure, defect, P5)

defect

Tracking

(thunderbird115 fixed)

RESOLVED FIXED
116 Branch
Tracking Status
thunderbird115 --- fixed

People

(Reporter: intermittent-bug-filer, Assigned: rjl)

References

Details

(Keywords: intermittent-failure)

Attachments

(1 file)

Filed by: thunderbird [at] calypsoblue.org
Parsed log: https://treeherder.mozilla.org/logviewer.html#?job_id=317062374&repo=comm-beta
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/WI2Pl0GBSVGfOr7wb6ueCQ/runs/0/artifacts/public/logs/live_backing.log


Seeing this on beta releases on all platforms. I don't see it on esr78 however.```
Flags: needinfo?(khushil324)
Summary: Intermittent toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js | test_prefs - [test_prefs : 141] We must be able to upload after the policy is accepted. - false == true → [beta tree] Intermittent toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js | test_prefs - [test_prefs : 141] We must be able to upload after the policy is accepted. - false == true
Assignee: nobody → khushil324
Flags: needinfo?(khushil324)

I am not able to reproduce this failure on the local machine with Beta.

Assignee: khushil324 → nobody
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME

This still happens on every beta on every platform. It would be nice if it didn't.

Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---

hasn't happened in over 5 months -> WFM

Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → WORKSFORME

I don't know what everyone else is looking at, but we get this test failure on every Thunderbird beta build. On every platform. Every build for 3 years.

Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Assignee: nobody → rob

The Thunderbird Privacy Policy was updated on March 16, 2021. That should
have triggered a policy version bump to display the new version. This is
the long awaited policy version bump.
This also fixes a perma-fail telemetry test that only occurs on comm-beta
builds every time for the last 3 years.

Explanation of the submitted patch:

The failing function call in test_TelemetryReportingPolicy.js is TelemetryReportingPolicy.canUpload(). The reason why that call returns false is unfortunately wiped out and never displayed anywhere in the output or console log though.

Eventually, canUpload() will call isUserNotifiedOfCurrentPolicy(). That has this code:

// The accepted policy version should not be less than the minimum policy version.
if (this.dataSubmissionPolicyAcceptedVersion < this.minimumPolicyVersion) {
  return false;
}

At this point in the test, the "user" has just accepted the "currentPolicyVersion". For Thunderbird, that is 1. The minimumPolicyVersion is not explicitly set in Thunderbird's prefs, but it is set in all.js.

#ifdef MOZ_DATA_REPORTING
  pref("datareporting.policy.dataSubmissionEnabled", true);
  pref("datareporting.policy.dataSubmissionPolicyNotifiedTime", "0");
  pref("datareporting.policy.dataSubmissionPolicyAcceptedVersion", 0);
  pref("datareporting.policy.dataSubmissionPolicyBypassNotification", false);
  pref("datareporting.policy.currentPolicyVersion", 2);
  pref("datareporting.policy.minimumPolicyVersion", 1);
  pref("datareporting.policy.minimumPolicyVersion.channel-beta", 2);
  pref("datareporting.policy.firstRunURL", "https://www.mozilla.org/privacy/firefox/");
#endif

But, as the astute reader will no doubt notice, (1 < 1) is false, so the test fails and the function returns true... right?

Not exactly... minimumPolicyVersion is not so simple.

  get minimumPolicyVersion() {
    const minPolicyVersion = Services.prefs.getIntPref(
      TelemetryUtils.Preferences.MinimumPolicyVersion,
      1
    );

    // First check if the current channel has a specific minimum policy version. If not,
    // use the general minimum policy version.
    let channel = "";
    try {
      channel = TelemetryUtils.getUpdateChannel();
    } catch (e) {
      this._log.error(
        "minimumPolicyVersion - Unable to retrieve the current channel."
      );
      return minPolicyVersion;
    }
    const channelPref =
      TelemetryUtils.Preferences.MinimumPolicyVersion + ".channel-" + channel;
    return Services.prefs.getIntPref(channelPref, minPolicyVersion);
  },

The real minimumPolicyVersion for beta build (Firefox and Thunderbird) is in the pref datareporting.policy.minimumPolicyVersion.channel-beta. So, it's 2, and 1 < 2.

You'll notice that currentPolicyVersion as set in all.js is 2 and Thunderbird's all-thunderbird.js overrides it and sets it to 1. (That code is from 2019 and predates this bug, so timeline-wise this all makes sense.)

So the fix is to make the versions align with test expectations. As noted in the commit message, Thunderbird's Privacy Policy was updated in March 2021, and the currentVersion pref was never bumped.

Alternatively, all-thunderbird.js could explicitly set currentPolicyVersion, minimumPolicyVersion, minimumPolicyVersion.channel-beta to completely different values. (Could even have a minimumPolicyVersion.channel-release and minimumPolicyVersion.channel-esr if desired.) Arguably, perhaps that should be done anyway since it's coincidence that the version numbers align with the Firefox ones right now. I'll leave that up to the data stewards. I just want the test permafail to go away.

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/29e74e8a589e
Update privacy policy version. r=sancus

Status: REOPENED → RESOLVED
Closed: 4 years ago2 years ago
Resolution: --- → FIXED

Comment on attachment 9337931 [details]
Bug 1668124 - Update privacy policy version. r=sancus

[Approval Request Comment]
Regression caused by (bug #): N/A
User impact if declined: none
Testing completed (on c-c, etc.):
Risk to taking this patch (and alternatives if risky):
This is to fix a perma fail orange test only seen on comm-beta for the past 3 years or something insane. The effect will be that users will get prompted to view the privacy policy again. Note that the policy was updated in 2021 for the Mailfence partnership and Thunderbird did not bump the version number in order to force the prompt.

Attachment #9337931 - Flags: approval-comm-beta?

Comment on attachment 9337931 [details]
Bug 1668124 - Update privacy policy version. r=sancus

[Triage Comment]
Approved for beta

Attachment #9337931 - Flags: approval-comm-beta? → approval-comm-beta+
Target Milestone: --- → 116 Branch

\o/
Thanks Rob, for getting this cleared up!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: