From 0b034c43fb40c4dc80086e8e3d10d13c1902e6a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Tue, 7 Apr 2026 13:54:35 -0600 Subject: [PATCH 1/4] Phase 1: bypass suggestedFollowups beta for MANAGE_TEAM + MICRO cohort Co-Authored-By: Claude Opus 4.6 (1M context) --- src/libs/ReportUtils.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index fa4eb376dbc6..f3295ef7a91c 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -11725,8 +11725,11 @@ function prepareOnboardingOnyxData({ // Only the MANAGE_TEAM onboarding action uses the #admins room (with a guide); TRACK_WORKSPACE uses Concierge. Excludes emails that have a '+'. const shouldPostTasksInAdminsRoom = isPostingTasksInAdminsRoom(engagementChoice); - // When posting to admins room and the user is in the suggestedFollowups beta, we skip tasks in favor of backend-generated followups. - const shouldUseFollowupsInsteadOfTasks = shouldPostTasksInAdminsRoom && Permissions.isBetaEnabled(CONST.BETAS.SUGGESTED_FOLLOWUPS, betas, betaConfiguration); + // Phase 1 cohort (MANAGE_TEAM + MICRO company size) bypasses the beta gate — the backend + // handles gating via NVP, so all MICRO users get followups without needing the beta flag. + const isPhase1Cohort = companySize === CONST.ONBOARDING_COMPANY_SIZE.MICRO; + // When posting to admins room and the user is in the suggestedFollowups beta (or Phase 1 cohort), we skip tasks in favor of backend-generated followups. + const shouldUseFollowupsInsteadOfTasks = shouldPostTasksInAdminsRoom && (Permissions.isBetaEnabled(CONST.BETAS.SUGGESTED_FOLLOWUPS, betas, betaConfiguration) || isPhase1Cohort); const adminsChatReport = deprecatedAllReports?.[`${ONYXKEYS.COLLECTION.REPORT}${adminsChatReportID}`]; const targetChatReport = shouldPostTasksInAdminsRoom ? (adminsChatReport ?? {reportID: adminsChatReportID, policyID: onboardingPolicyID, chatType: CONST.REPORT.CHAT_TYPE.POLICY_ADMINS}) From 0c14d62a1eb7ee9a122c6eb6dcac85264785d52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Tue, 7 Apr 2026 16:20:42 -0600 Subject: [PATCH 2/4] Fix test: use non-MICRO company size for without-beta test path The test for "without suggestedFollowups beta" was using MICRO company size, but our change makes MICRO + MANAGE_TEAM users bypass the beta gate. Changed to SMALL so the test still validates the beta gate for non-cohort users. Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/unit/ReportUtilsTest.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index 061ada5226b5..f1a1a1c77d0a 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -779,9 +779,10 @@ describe('ReportUtils', () => { }, adminsChatReportID, selectedInterestedFeatures: ['areCompanyCardsEnabled'], - companySize: CONST.ONBOARDING_COMPANY_SIZE.MICRO, + companySize: CONST.ONBOARDING_COMPANY_SIZE.SMALL, }); - // Without the beta, tasks SHOULD be generated (old behavior) + // Without the beta, tasks SHOULD be generated (old behavior) — uses SMALL (not MICRO) + // because MICRO + MANAGE_TEAM users bypass the beta gate and get followups directly expect(result?.guidedSetupData).toHaveLength(3); const taskReportIDs = result?.guidedSetupData.reduce((acc, item) => { From 3b542d6f9fa8d28cdb4f1513833f95ecfefec697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Ch=C3=A1vez?= Date: Mon, 13 Apr 2026 12:32:56 -0600 Subject: [PATCH 3/4] Forward bespokeWelcomeMessage to CreateWorkspace API The createWorkspace path generates bespokeWelcomeMessage and optimisticConciergeReportActionID when shouldUseFollowupsInsteadOfTasks is true, but never sends them to the server. This causes the optimistic Concierge message to appear client-side but never persist. The completeOnboarding path already forwards these correctly. Add both fields to CreateWorkspaceParams and pass them from buildPolicyData so the server can persist the bespoke welcome message and generate suggested followups for the createWorkspace flow. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/libs/API/parameters/CreateWorkspaceParams.ts | 2 ++ src/libs/actions/Policy/Policy.ts | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libs/API/parameters/CreateWorkspaceParams.ts b/src/libs/API/parameters/CreateWorkspaceParams.ts index 59b7c973f121..557de5ccd744 100644 --- a/src/libs/API/parameters/CreateWorkspaceParams.ts +++ b/src/libs/API/parameters/CreateWorkspaceParams.ts @@ -20,6 +20,8 @@ type CreateWorkspaceParams = { features?: string; shouldAddGuideWelcomeMessage?: boolean; areDistanceRatesEnabled?: boolean; + bespokeWelcomeMessage?: string; + optimisticConciergeReportActionID?: string; }; export default CreateWorkspaceParams; diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 119cf0e270f3..6a6782f6defe 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -2904,10 +2904,19 @@ function buildPolicyData(options: BuildPolicyDataOptions): OnyxData Date: Sat, 18 Apr 2026 09:26:26 +0900 Subject: [PATCH 4/4] Update phase1 cohort to include MICRO_SMALL and MICRO_MEDIUM MICRO is deprecated on main in favor of MICRO_SMALL (1-4) and MICRO_MEDIUM (5-10). Update the phase1 cohort check to match all micro company sizes, keeping the deprecated MICRO for backwards compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/libs/ReportUtils.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 2624a63ad304..48499ce9578c 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -11781,9 +11781,11 @@ function prepareOnboardingOnyxData({ // Only the MANAGE_TEAM onboarding action uses the #admins room (with a guide); TRACK_WORKSPACE uses Concierge. Excludes emails that have a '+'. const shouldPostTasksInAdminsRoom = isPostingTasksInAdminsRoom(engagementChoice); - // Phase 1 cohort (MANAGE_TEAM + MICRO company size) bypasses the beta gate — the backend - // handles gating via NVP, so all MICRO users get followups without needing the beta flag. - const isPhase1Cohort = companySize === CONST.ONBOARDING_COMPANY_SIZE.MICRO; + // Phase 1 cohort (MANAGE_TEAM + micro company size) bypasses the beta gate — the backend + // handles gating via NVP, so all micro users get followups without needing the beta flag. + // Includes MICRO_SMALL, MICRO_MEDIUM, and the deprecated MICRO for backwards compatibility. + const isPhase1Cohort = + companySize === CONST.ONBOARDING_COMPANY_SIZE.MICRO_SMALL || companySize === CONST.ONBOARDING_COMPANY_SIZE.MICRO_MEDIUM || companySize === CONST.ONBOARDING_COMPANY_SIZE.MICRO; // When posting to admins room and the user is in the suggestedFollowups beta (or Phase 1 cohort), we skip tasks in favor of backend-generated followups. const shouldUseFollowupsInsteadOfTasks = shouldPostTasksInAdminsRoom && (Permissions.isBetaEnabled(CONST.BETAS.SUGGESTED_FOLLOWUPS, betas, betaConfiguration) || isPhase1Cohort); const adminsChatReport = deprecatedAllReports?.[`${ONYXKEYS.COLLECTION.REPORT}${adminsChatReportID}`];