From 3cd0cefd30bcfbb04c7faf706cee4bf39e01baa1 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 30 Oct 2023 13:55:07 +0100 Subject: [PATCH] Gradual rollout of new compile timeout to existing users (#15478) * Rollout compile timeout to existing users * Update copy for compile timeout messages GitOrigin-RevId: bada02efb3fc506ae6e35bdb7871a58ef4295cbe --- .../src/Features/Compile/CompileManager.js | 16 +++- .../Features/Editor/EditorHttpController.js | 14 +++- .../web/frontend/extracted-translations.json | 13 ++-- .../compile-timeout-changing-soon.tsx | 35 +++++---- .../components/timeout-upgrade-prompt-new.tsx | 75 ++++++++++++------- services/web/locales/en.json | 13 ++-- .../unit/src/Compile/CompileManagerTests.js | 25 +++++++ 7 files changed, 137 insertions(+), 54 deletions(-) diff --git a/services/web/app/src/Features/Compile/CompileManager.js b/services/web/app/src/Features/Compile/CompileManager.js index 1d63308911..7d9f03a022 100644 --- a/services/web/app/src/Features/Compile/CompileManager.js +++ b/services/web/app/src/Features/Compile/CompileManager.js @@ -220,9 +220,23 @@ module.exports = CompileManager = { if (assignment?.variant === '20s') { if (owner.signUpDate > timeoutEnforcedCutoff) { limits.timeout = 20 + callback(null, limits) + } else { + SplitTestHandler.getAssignmentForMongoUser( + owner, + 'compile-timeout-20s-existing-users', + (err, assignmentExistingUsers) => { + if (err) return callback(err) + if (assignmentExistingUsers?.variant === '20s') { + limits.timeout = 20 + } + callback(null, limits) + } + ) } + } else { + callback(null, limits) } - callback(null, limits) } ) } else { diff --git a/services/web/app/src/Features/Editor/EditorHttpController.js b/services/web/app/src/Features/Editor/EditorHttpController.js index 3958e86e21..719a71b192 100644 --- a/services/web/app/src/Features/Editor/EditorHttpController.js +++ b/services/web/app/src/Features/Editor/EditorHttpController.js @@ -109,8 +109,18 @@ async function joinProject(req, res, next) { // New users will see a 10s warning and compile fail at 20s project.showNewCompileTimeoutUI = 'active' } else { - // Older users aren't limited to 20s, but will see a notice of upcoming changes if compile >20s - project.showNewCompileTimeoutUI = 'changing' + 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' + } } } } diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 640bafb455..44316b2797 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -102,7 +102,6 @@ "browser": "", "bulk_accept_confirm": "", "bulk_reject_confirm": "", - "but_note_that_free_compile_timeout_limit_will_be_reduced_on_x_date": "", "by_subscribing_you_agree_to_our_terms_of_service": "", "can_edit": "", "can_link_institution_email_acct_to_institution_acct": "", @@ -168,7 +167,7 @@ "comment": "", "commit": "", "common": "", - "common_causes_of_compile_timeouts_are": "", + "common_causes_of_compile_timeouts_include": "", "commons_plan_tooltip": "", "compact": "", "company_name": "", @@ -179,8 +178,8 @@ "compile_larger_projects": "", "compile_mode": "", "compile_terminated_by_user": "", - "compile_timeout_will_be_reduced_project_exceeds_limit_speed_up_compile": "", "compiler": "", + "compiles_on_our_free_plan_are_now_on_faster_servers": "", "compiling": "", "configure_sso": "", "confirm": "", @@ -779,7 +778,6 @@ "organize_projects": "", "other_logs_and_files": "", "other_output_files": "", - "other_ways_to_prevent_compile_timeouts": "", "output_file": "", "overall_theme": "", "overleaf": "", @@ -895,6 +893,7 @@ "ready_to_join_x": "", "ready_to_join_x_in_group_y": "", "realtime_track_changes": "", + "reasons_for_compile_timeouts": "", "reauthorize_github_account": "", "recaptcha_conditions": "", "recent_commits_in_github": "", @@ -1341,6 +1340,10 @@ "we_sent_new_code": "", "wed_love_you_to_stay": "", "welcome_to_sl": "", + "were_in_the_process_of_reducing_compile_timeout_which_may_affect_this_project": "", + "were_in_the_process_of_reducing_compile_timeout_which_may_affect_your_project": "", + "weve_recently_reduced_the_compile_timeout_limit_which_may_have_affected_this_project": "", + "weve_recently_reduced_the_compile_timeout_limit_which_may_have_affected_your_project": "", "what_does_this_mean": "", "what_does_this_mean_for_you": "", "what_happens_when_sso_is_enabled": "", @@ -1376,7 +1379,7 @@ "you_have_been_invited_to_transfer_management_of_your_account": "", "you_have_been_invited_to_transfer_management_of_your_account_to": "", "you_have_been_removed_from_this_project_and_will_be_redirected_to_project_dashboard": "", - "you_may_be_able_to_prevent_a_compile_timeout": "", + "you_may_be_able_to_fix_issues_to_speed_up_the_compile": "", "you_need_to_configure_your_sso_settings": "", "you_will_be_able_to_reassign_subscription": "", "youll_get_best_results_in_visual_but_can_be_used_in_source": "", diff --git a/services/web/frontend/js/features/pdf-preview/components/compile-timeout-changing-soon.tsx b/services/web/frontend/js/features/pdf-preview/components/compile-timeout-changing-soon.tsx index 2f9f487b27..5f6cd56498 100644 --- a/services/web/frontend/js/features/pdf-preview/components/compile-timeout-changing-soon.tsx +++ b/services/web/frontend/js/features/pdf-preview/components/compile-timeout-changing-soon.tsx @@ -17,7 +17,7 @@ export const CompileTimeoutChangingSoon: FC<{ }> = ({ isProjectOwner = false, handleDismissChangingSoon }) => { const { t } = useTranslation() - const compileTimeoutBlogLinks = [ + const compileTimeoutChangesBlogLink = ( /* eslint-disable-next-line jsx-a11y/anchor-has-content */ , + /> + ) + + const fixingCompileTimeoutsLearnLink = ( /* eslint-disable-next-line jsx-a11y/anchor-has-content */ , - ] + /> + ) if (isProjectOwner) { return ( @@ -56,11 +59,14 @@ export const CompileTimeoutChangingSoon: FC<{

+

+

+ {' '}

{' '} +

diff --git a/services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt-new.tsx b/services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt-new.tsx index ef3d8ef043..a6d15d42f5 100644 --- a/services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt-new.tsx +++ b/services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt-new.tsx @@ -42,6 +42,7 @@ function TimeoutUpgradePromptNew() { compileTimeChanging={compileTimeChanging} handleEnableStopOnFirstErrorClick={handleEnableStopOnFirstErrorClick} lastCompileOptions={lastCompileOptions} + isProjectOwner={isProjectOwner} /> ) @@ -123,12 +124,14 @@ type PreventTimeoutHelpMessageProps = { compileTimeChanging?: boolean lastCompileOptions: any handleEnableStopOnFirstErrorClick: () => void + isProjectOwner: boolean } const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({ compileTimeChanging, lastCompileOptions, handleEnableStopOnFirstErrorClick, + isProjectOwner, }: PreventTimeoutHelpMessageProps) { const { t } = useTranslation() @@ -139,38 +142,56 @@ const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({ }) } + const compileTimeoutChangesBlogLink = ( + /* eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key */ + + ) + return (

- {t('you_may_be_able_to_prevent_a_compile_timeout')} - {compileTimeChanging && ( - <> - {' '} - , - ]} - values={{ date: 'October 27 2023' }} - shouldUnescape - tOptions={{ interpolation: { escapeValue: true } }} - /> - - )} + + {compileTimeChanging ? ( + <> + {isProjectOwner ? ( + + ) : ( + + )} + + ) : ( + <> + {isProjectOwner ? ( + + ) : ( + + )} + + )} +

-

{t('common_causes_of_compile_timeouts_are')}:

+

{t('common_causes_of_compile_timeouts_include')}:

  • } // @ts-ignore - entryAriaLabel={t('other_ways_to_prevent_compile_timeouts')} + entryAriaLabel={t('reasons_for_compile_timeouts')} level="raw" /> ) diff --git a/services/web/locales/en.json b/services/web/locales/en.json index 1f79333056..6c64b7da60 100644 --- a/services/web/locales/en.json +++ b/services/web/locales/en.json @@ -177,7 +177,6 @@ "built_in": "Built-In", "bulk_accept_confirm": "Are you sure you want to accept the selected __nChanges__ changes?", "bulk_reject_confirm": "Are you sure you want to reject the selected __nChanges__ changes?", - "but_note_that_free_compile_timeout_limit_will_be_reduced_on_x_date": "But note that the free compile timeout limit <0>will be reduced on __date__.", "buy_now_no_exclamation_mark": "Buy now", "by": "by", "by_registering_you_agree_to_our_terms_of_service": "By registering, you agree to our <0>terms of service.", @@ -269,7 +268,7 @@ "comment": "Comment", "commit": "Commit", "common": "Common", - "common_causes_of_compile_timeouts_are": "Common causes of compile timeouts are", + "common_causes_of_compile_timeouts_include": "Common causes of compile timeouts include", "commons_plan_tooltip": "You’re on the __plan__ plan because of your affiliation with __institution__. Click to find out how to make the most of your Overleaf premium features.", "compact": "Compact", "company_name": "Company Name", @@ -287,8 +286,8 @@ "compile_timeout_short": "Compile timeout", "compile_timeout_short_info": "This is how much time you get to compile your project on the Overleaf servers. For short and simple projects, 1 minute should be enough, but you may need longer for complex or longer projects", "compile_timeout_short_info_basic": "This is how much time you get to compile your project on the Overleaf servers. You may need additional time for longer or more complex projects.", - "compile_timeout_will_be_reduced_project_exceeds_limit_speed_up_compile": "The compile timeout limit on our free plan <0>will be reduced on __date__ and this project currently exceeds the new limit. You may be able to fix issues to <1>speed up the compile.", "compiler": "Compiler", + "compiles_on_our_free_plan_are_now_on_faster_servers": "Compiles on our free plan are now on faster servers, and we’re gradually <0>introducing a shorter compile timeout limit. This project currently exceeds the new limit, so it might not compile in future.", "compiling": "Compiling", "complete": "Complete", "compliance": "Compliance", @@ -1218,7 +1217,6 @@ "other_logs_and_files": "Other logs and files", "other_output_files": "Download other output files", "other_sessions": "Other Sessions", - "other_ways_to_prevent_compile_timeouts": "Other ways to prevent compile timeouts", "our_values": "Our values", "output_file": "Output file", "over": "over", @@ -1390,6 +1388,7 @@ "realtime_track_changes": "Real-time track changes", "realtime_track_changes_info": "Now you don’t have to choose between tracked changes and typesetting in LaTeX. Leave comments, keep track of TODOs, and accept or reject others’ changes.", "realtime_track_changes_info_v2": "Switch on track changes to see who made every change, accept or reject others’ changes, and write comments.", + "reasons_for_compile_timeouts": "Reasons for compile timeouts", "reauthorize_github_account": "Reauthorize your GitHub Account", "recaptcha_conditions": "The site is protected by reCAPTCHA and the Google <1>Privacy Policy and <2>Terms of Service apply.", "recent": "Recent", @@ -2003,6 +2002,10 @@ "website_status": "Website status", "wed_love_you_to_stay": "We’d love you to stay", "welcome_to_sl": "Welcome to __appName__!", + "were_in_the_process_of_reducing_compile_timeout_which_may_affect_this_project": "We’re in the process of <0>reducing the compile timeout limit on our free plan, which may affect this project in future.", + "were_in_the_process_of_reducing_compile_timeout_which_may_affect_your_project": "We’re in the process of <0>reducing the compile timeout limit on our free plan, which may affect your project in future.", + "weve_recently_reduced_the_compile_timeout_limit_which_may_have_affected_this_project": "We’ve recently <0>reduced the compile timeout limit on our free plan, which may have affected this project.", + "weve_recently_reduced_the_compile_timeout_limit_which_may_have_affected_your_project": "We’ve recently <0>reduced the compile timeout limit on our free plan, which may have affected your project.", "what_does_this_mean": "What does this mean?", "what_does_this_mean_for_you": "This means:", "what_happens_when_sso_is_enabled": "What happens when SSO is enabled?", @@ -2058,7 +2061,7 @@ "you_have_been_removed_from_this_project_and_will_be_redirected_to_project_dashboard": "You have been removed from this project, and will no longer have access to it. You will be redirected to your project dashboard momentarily.", "you_introed_high_number": " You’ve introduced <0>__numberOfPeople__ people to __appName__. Good job!", "you_introed_small_number": " You’ve introduced <0>__numberOfPeople__ person to __appName__. Good job, but can you get some more?", - "you_may_be_able_to_prevent_a_compile_timeout": "You may be able to prevent a compile timeout using the following tips.", + "you_may_be_able_to_fix_issues_to_speed_up_the_compile": "You may be able to fix issues to <0>speed up the compile.", "you_need_to_configure_your_sso_settings": "You need to configure your SSO settings before enabling SSO", "you_not_introed_anyone_to_sl": "You’ve not introduced anyone to __appName__ yet. Get sharing!", "you_plus_1": "You + 1", diff --git a/services/web/test/unit/src/Compile/CompileManagerTests.js b/services/web/test/unit/src/Compile/CompileManagerTests.js index 47572c9a4a..f63e1f6be5 100644 --- a/services/web/test/unit/src/Compile/CompileManagerTests.js +++ b/services/web/test/unit/src/Compile/CompileManagerTests.js @@ -298,6 +298,31 @@ describe('CompileManager', function () { .calledWith(null, sinon.match({ timeout: 60 })) .should.equal(true) }) + describe('user is in the compile-timeout-20s-existing-users treatment', function () { + beforeEach(function () { + this.getAssignmentForMongoUser.callsFake((user, test, cb) => { + if (test === 'compile-backend-class-n2d') { + cb(null, { variant: 'n2d' }) + } + if (test === 'compile-timeout-20s') { + cb(null, { variant: '20s' }) + } + if (test === 'compile-timeout-20s-existing-users') { + cb(null, { variant: '20s' }) + } + }) + }) + + it('should reduce compile timeout to 20s', function () { + this.CompileManager.getProjectCompileLimits( + this.project_id, + this.callback + ) + this.callback + .calledWith(null, sinon.match({ timeout: 20 })) + .should.equal(true) + }) + }) }) describe('user registered after the cut off date', function () { beforeEach(function () {