[web] Remove split-tests compile-backend-class* and compile-timeout-20s* (#17700)

* Remove split-tests of `compile-timeout-20s` and `compile-timeout-20s-existing-users`

* Remove `NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF` variables

* Revert timeout override `60` -> `20`

* Update settings.overrides.saas.js: `compileTimeout: 20`

* Remove `compile-backend-class-n2d`

* Remove `force_new_compile_timeout`

* Remove `showNewCompileTimeoutUI`

* Remove `compileTimeChanging`

* Simplify code by removing segmentation object

* Remove `CompileTimeoutChangingSoon`

* Remove `user.features.compileTimeout = '20 (with 10s prompt)'`

* Remove `CompileTimeWarning`

* Remove `TimeoutUpgradePrompt` (old)

* Remove `compile-backend-class`

* Remove unused translations

* Update tests

* Fix: Show `CompileTimeout` even if `!window.ExposedSettings.enableSubscriptions`

* Create script to migrate users to 20s compileTimeout

* migration script: exclude `compileTimeout: 20` from the match

* migration script: use `batchedUpdate`

* Remove `showFasterCompilesFeedbackUI` and `FasterCompilesFeedback`

Helped-by: Jakob Ackermann <jakob.ackermann@overleaf.com>

* Remove `_getCompileBackendClassDetails`, simplify definition of `limits` object

* Remove `Settings.apis.clsi.defaultBackendClass`

* Remove unnecessary second scan of the whole user collection in dry mode

* Override `timeout` to 20 for users having `compileGroup === 'standard' && compileTimeout <= 60`

* Remove second `logCount`: re-run the script in dry-mode if you want to see that count

* Use secondary readPreference when counting users

* Fix script setup and exit 0

* Fix: Remove `user.` from query path!

* Add acceptance test on script migration_compile_timeout_60s_to_20s.js

GitOrigin-RevId: 3cb65130e6d7fbd9c54005f4c213066d0473e9d8
This commit is contained in:
Antoine Clausse
2024-04-15 08:04:24 +00:00
committed by Copybot
parent 03fb015f8f
commit 2dd10c7fee
27 changed files with 302 additions and 980 deletions
@@ -120,7 +120,6 @@ describe('ClsiManager', function () {
},
clsi: {
url: `http://${CLSI_HOST}`,
defaultBackendClass: 'e2',
submissionBackendClass: 'n2d',
},
clsi_priority: {
@@ -32,7 +32,6 @@ describe('CompileController', function () {
apis: {
clsi: {
url: 'http://clsi.example.com',
defaultBackendClass: 'e2',
submissionBackendClass: 'n2d',
},
clsi_priority: {
@@ -23,7 +23,7 @@ describe('CompileManager', function () {
requires: {
'@overleaf/settings': (this.settings = {
apis: {
clsi: { defaultBackendClass: 'e2', submissionBackendClass: 'n2d' },
clsi: { submissionBackendClass: 'n2d' },
},
redis: { web: { host: 'localhost', port: 42 } },
rateLimit: { autoCompile: {} },
@@ -235,9 +235,8 @@ describe('CompileManager', function () {
.calledWith(null, {
timeout: this.timeout,
compileGroup: this.group,
compileBackendClass: 'e2',
compileBackendClass: 'c2d',
ownerAnalyticsId: 'abc',
showFasterCompilesFeedbackUI: false,
})
.should.equal(true)
})
@@ -303,7 +302,7 @@ describe('CompileManager', function () {
this.callback
)
this.callback
.calledWith(null, sinon.match({ timeout: 60 }))
.calledWith(null, sinon.match({ timeout: 20 }))
.should.equal(true)
})
describe('user is in the compile-timeout-20s-existing-users treatment', function () {
@@ -388,20 +387,12 @@ describe('CompileManager', function () {
this.callback
)
this.callback
.calledWith(null, sinon.match({ timeout: 60 }))
.calledWith(null, sinon.match({ timeout: 20 }))
.should.equal(true)
})
})
describe('user signed up after the second phase rollout', function () {
beforeEach(function () {
const signUpDate = new Date(
this.CompileManager.NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF_DEFAULT_BASELINE
)
signUpDate.setDate(signUpDate.getDate() + 1)
this.user.signUpDate = signUpDate
})
it('should reduce compile timeout to 20s', function () {
this.CompileManager.getProjectCompileLimits(
this.project_id,
@@ -441,13 +432,12 @@ describe('CompileManager', function () {
variant: 'default',
})
})
it('should return the e2 class and disable the ui', function (done) {
it('should return the n2d class and disable the ui', function (done) {
this.CompileManager.getProjectCompileLimits(
this.project_id,
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
(err, { compileBackendClass }) => {
if (err) return done(err)
expect(compileBackendClass).to.equal('e2')
expect(showFasterCompilesFeedbackUI).to.equal(false)
expect(compileBackendClass).to.equal('n2d')
done()
}
)
@@ -463,10 +453,9 @@ describe('CompileManager', function () {
it('should return the n2d class and disable the ui', function (done) {
this.CompileManager.getProjectCompileLimits(
this.project_id,
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
(err, { compileBackendClass }) => {
if (err) return done(err)
expect(compileBackendClass).to.equal('n2d')
expect(showFasterCompilesFeedbackUI).to.equal(false)
done()
}
)
@@ -489,10 +478,9 @@ describe('CompileManager', function () {
it('should return the default class and disable ui', function (done) {
this.CompileManager.getProjectCompileLimits(
this.project_id,
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
(err, { compileBackendClass }) => {
if (err) return done(err)
expect(compileBackendClass).to.equal('e2')
expect(showFasterCompilesFeedbackUI).to.equal(false)
expect(compileBackendClass).to.equal('c2d')
done()
}
)
@@ -510,10 +498,9 @@ describe('CompileManager', function () {
it('should return the default class and enable ui', function (done) {
this.CompileManager.getProjectCompileLimits(
this.project_id,
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
(err, { compileBackendClass }) => {
if (err) return done(err)
expect(compileBackendClass).to.equal('e2')
expect(showFasterCompilesFeedbackUI).to.equal(true)
expect(compileBackendClass).to.equal('c2d')
done()
}
)
@@ -530,10 +517,9 @@ describe('CompileManager', function () {
it('should return the c2d class and enable ui', function (done) {
this.CompileManager.getProjectCompileLimits(
this.project_id,
(err, { compileBackendClass, showFasterCompilesFeedbackUI }) => {
(err, { compileBackendClass }) => {
if (err) return done(err)
expect(compileBackendClass).to.equal('c2d')
expect(showFasterCompilesFeedbackUI).to.equal(true)
done()
}
)