[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-12 10:40:09 +02:00
committed by Copybot
parent 03fb015f8f
commit 2dd10c7fee
27 changed files with 302 additions and 980 deletions
@@ -13,12 +13,6 @@ const Errors = require('../Errors/Errors')
const DocstoreManager = require('../Docstore/DocstoreManager')
const logger = require('@overleaf/logger')
const { expressify } = require('@overleaf/promise-utils')
const SplitTestHandler = require('../SplitTests/SplitTestHandler')
const {
NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF,
NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF_DEFAULT_BASELINE,
} = require('../Compile/CompileManager')
const UserGetter = require('../User/UserGetter')
module.exports = {
joinProject: expressify(joinProject),
@@ -72,58 +66,6 @@ async function joinProject(req, res, next) {
if (!project) {
return res.sendStatus(403)
}
// Compile timeout 20s test
if (project.features?.compileTimeout <= 60) {
const compileAssignment =
await SplitTestHandler.promises.getAssignmentForUser(
project.owner._id,
'compile-backend-class-n2d'
)
if (compileAssignment?.variant === 'n2d') {
const timeoutAssignment =
await SplitTestHandler.promises.getAssignmentForUser(
project.owner._id,
'compile-timeout-20s'
)
if (timeoutAssignment?.variant === '20s') {
// users who were on the 'default' servers at time of original rollout
// will have a later cutoff date for the 20s timeout in the next phase
// we check the backend class at version 8 (baseline)
const owner = await UserGetter.promises.getUser(project.owner._id, {
_id: 1,
'splitTests.compile-backend-class-n2d': 1,
})
const backendClassHistory =
owner.splitTests?.['compile-backend-class-n2d'] || []
const backendClassBaselineVariant = backendClassHistory.find(
version => {
return version.versionNumber === 8
}
)?.variantName
const timeoutEnforcedCutoff =
backendClassBaselineVariant === 'default'
? NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF_DEFAULT_BASELINE
: NEW_COMPILE_TIMEOUT_ENFORCED_CUTOFF
if (project.owner.signUpDate > timeoutEnforcedCutoff) {
// New users will see a 10s warning and compile fail at 20s
project.showNewCompileTimeoutUI = 'active'
} else {
const existingUserTimeoutAssignment =
await SplitTestHandler.promises.getAssignmentForUser(
project.owner._id,
'compile-timeout-20s-existing-users'
)
if (existingUserTimeoutAssignment?.variant === '20s') {
// Older users in treatment see 10s warning and compile fail at 20s
project.showNewCompileTimeoutUI = 'active'
} else {
// Older users in control aren't limited to 20s, but will see a notice of upcoming changes if compile >20s
project.showNewCompileTimeoutUI = 'changing'
}
}
}
}
}
// Hide sensitive data if the user is restricted
if (isRestrictedUser) {
project.owner = { _id: project.owner._id }