From cc83d640f09b4da8edb1716c7956bc25f47f8334 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 22 Jun 2021 10:14:45 +0200 Subject: [PATCH] Merge pull request #4237 from overleaf/jpa-pdf-caching-full [misc] roll out pdf caching in full -- send metrics for 5% of users GitOrigin-RevId: 12ae5a61ef39d206980681b54fe9c871ca1b86b4 --- .../src/Features/Project/ProjectController.js | 7 ++- services/web/config/settings.defaults.js | 12 +++--- .../src/Project/ProjectControllerTests.js | 43 ++----------------- 3 files changed, 13 insertions(+), 49 deletions(-) diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js index e3f9daa94c..f93979d01b 100644 --- a/services/web/app/src/Features/Project/ProjectController.js +++ b/services/web/app/src/Features/Project/ProjectController.js @@ -712,10 +712,10 @@ const ProjectController = { }, pdfCachingFeatureFlag(cb) { if (!Settings.enablePdfCaching) return cb(null, '') - if (!userId) return cb(null, '') + if (!userId) return cb(null, 'enable-caching-only') SplitTestHandler.getTestSegmentation( userId, - 'pdf_caching_5', + 'pdf_caching_full', (err, segmentation) => { if (err) { // Do not fail loading the editor. @@ -812,8 +812,7 @@ const ProjectController = { // The feature is disabled globally. return false } - const canSeeFeaturePreview = - user.alphaProgram || pdfCachingFeatureFlag.includes(flag) + const canSeeFeaturePreview = pdfCachingFeatureFlag.includes(flag) if (!canSeeFeaturePreview) { // The user is not in the target group. return false diff --git a/services/web/config/settings.defaults.js b/services/web/config/settings.defaults.js index 6047f4e7d2..23b7ad823e 100644 --- a/services/web/config/settings.defaults.js +++ b/services/web/config/settings.defaults.js @@ -347,17 +347,17 @@ module.exports = { ], }, { - id: 'pdf_caching_5', - active: process.env.SPLIT_TEST_PDF_CACHING_5_ACTIVE === 'true', + id: 'pdf_caching_full', + active: process.env.SPLIT_TEST_PDF_CACHING_FULL_ACTIVE === 'true', variants: [ - { - id: 'collect-metrics-only', - rolloutPercent: 5, - }, { id: 'collect-metrics-and-enable-caching', rolloutPercent: 5, }, + { + id: 'enable-caching-only', + rolloutPercent: 95, + }, ], }, ], diff --git a/services/web/test/unit/src/Project/ProjectControllerTests.js b/services/web/test/unit/src/Project/ProjectControllerTests.js index 27ebaa1d17..aa25df5e49 100644 --- a/services/web/test/unit/src/Project/ProjectControllerTests.js +++ b/services/web/test/unit/src/Project/ProjectControllerTests.js @@ -1225,30 +1225,11 @@ describe('ProjectController', function () { .returns(false) }) } - function tagAlpha() { - beforeEach(function () { - this.user.alphaProgram = true - }) - } beforeEach(function () { this.settings.enablePdfCaching = true }) - describe('alpha rollout', function () { - describe('regular user', function () { - expectToNotBeEnrolledAtAll() - }) - describe('anonymous user', function () { - tagAnonymous() - expectToNotBeEnrolledAtAll() - }) - describe('alpha user', function () { - tagAlpha() - expectToCollectMetricsAndCachePDF() - }) - }) - describe('during regular roll-out', function () { describe('disabled', function () { showNoVariant() @@ -1258,11 +1239,7 @@ describe('ProjectController', function () { }) describe('anonymous user', function () { tagAnonymous() - expectToNotBeEnrolledAtAll() - }) - describe('alpha user', function () { - tagAlpha() - expectToCollectMetricsAndCachePDF() + expectToCachePDFOnly() }) }) @@ -1274,11 +1251,7 @@ describe('ProjectController', function () { }) describe('anonymous user', function () { tagAnonymous() - expectToNotBeEnrolledAtAll() - }) - describe('alpha user', function () { - tagAlpha() - expectToCollectMetricsAndCachePDF() + expectToCachePDFOnly() }) }) @@ -1290,11 +1263,7 @@ describe('ProjectController', function () { }) describe('anonymous user', function () { tagAnonymous() - expectToNotBeEnrolledAtAll() - }) - describe('alpha user', function () { - tagAlpha() - expectToCollectMetricsAndCachePDF() + expectToCachePDFOnly() }) }) @@ -1306,11 +1275,7 @@ describe('ProjectController', function () { }) describe('anonymous user', function () { tagAnonymous() - expectToNotBeEnrolledAtAll() - }) - describe('alpha user', function () { - tagAlpha() - expectToCollectMetricsAndCachePDF() + expectToCachePDFOnly() }) }) })