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
This commit is contained in:
Jakob Ackermann 2021-06-22 10:14:45 +02:00 committed by Copybot
parent b2bc589ad1
commit cc83d640f0
3 changed files with 13 additions and 49 deletions

View file

@ -712,10 +712,10 @@ const ProjectController = {
}, },
pdfCachingFeatureFlag(cb) { pdfCachingFeatureFlag(cb) {
if (!Settings.enablePdfCaching) return cb(null, '') if (!Settings.enablePdfCaching) return cb(null, '')
if (!userId) return cb(null, '') if (!userId) return cb(null, 'enable-caching-only')
SplitTestHandler.getTestSegmentation( SplitTestHandler.getTestSegmentation(
userId, userId,
'pdf_caching_5', 'pdf_caching_full',
(err, segmentation) => { (err, segmentation) => {
if (err) { if (err) {
// Do not fail loading the editor. // Do not fail loading the editor.
@ -812,8 +812,7 @@ const ProjectController = {
// The feature is disabled globally. // The feature is disabled globally.
return false return false
} }
const canSeeFeaturePreview = const canSeeFeaturePreview = pdfCachingFeatureFlag.includes(flag)
user.alphaProgram || pdfCachingFeatureFlag.includes(flag)
if (!canSeeFeaturePreview) { if (!canSeeFeaturePreview) {
// The user is not in the target group. // The user is not in the target group.
return false return false

View file

@ -347,17 +347,17 @@ module.exports = {
], ],
}, },
{ {
id: 'pdf_caching_5', id: 'pdf_caching_full',
active: process.env.SPLIT_TEST_PDF_CACHING_5_ACTIVE === 'true', active: process.env.SPLIT_TEST_PDF_CACHING_FULL_ACTIVE === 'true',
variants: [ variants: [
{
id: 'collect-metrics-only',
rolloutPercent: 5,
},
{ {
id: 'collect-metrics-and-enable-caching', id: 'collect-metrics-and-enable-caching',
rolloutPercent: 5, rolloutPercent: 5,
}, },
{
id: 'enable-caching-only',
rolloutPercent: 95,
},
], ],
}, },
], ],

View file

@ -1225,30 +1225,11 @@ describe('ProjectController', function () {
.returns(false) .returns(false)
}) })
} }
function tagAlpha() {
beforeEach(function () {
this.user.alphaProgram = true
})
}
beforeEach(function () { beforeEach(function () {
this.settings.enablePdfCaching = true 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('during regular roll-out', function () {
describe('disabled', function () { describe('disabled', function () {
showNoVariant() showNoVariant()
@ -1258,11 +1239,7 @@ describe('ProjectController', function () {
}) })
describe('anonymous user', function () { describe('anonymous user', function () {
tagAnonymous() tagAnonymous()
expectToNotBeEnrolledAtAll() expectToCachePDFOnly()
})
describe('alpha user', function () {
tagAlpha()
expectToCollectMetricsAndCachePDF()
}) })
}) })
@ -1274,11 +1251,7 @@ describe('ProjectController', function () {
}) })
describe('anonymous user', function () { describe('anonymous user', function () {
tagAnonymous() tagAnonymous()
expectToNotBeEnrolledAtAll() expectToCachePDFOnly()
})
describe('alpha user', function () {
tagAlpha()
expectToCollectMetricsAndCachePDF()
}) })
}) })
@ -1290,11 +1263,7 @@ describe('ProjectController', function () {
}) })
describe('anonymous user', function () { describe('anonymous user', function () {
tagAnonymous() tagAnonymous()
expectToNotBeEnrolledAtAll() expectToCachePDFOnly()
})
describe('alpha user', function () {
tagAlpha()
expectToCollectMetricsAndCachePDF()
}) })
}) })
@ -1306,11 +1275,7 @@ describe('ProjectController', function () {
}) })
describe('anonymous user', function () { describe('anonymous user', function () {
tagAnonymous() tagAnonymous()
expectToNotBeEnrolledAtAll() expectToCachePDFOnly()
})
describe('alpha user', function () {
tagAlpha()
expectToCollectMetricsAndCachePDF()
}) })
}) })
}) })