feat(onboarding): Add SCM messaging treatment route - #120992
Conversation
35e346f to
9601f27
Compare
f09dc21 to
1fd0e34
Compare
9601f27 to
12140ea
Compare
Sentry Snapshot Testing
No base snapshots found to compare against. Make sure snapshots are uploaded from your main branch. |
12140ea to
4a1eaad
Compare
Adds the treatment-only fifth SCM onboarding step between platform/features and SDK setup, preserving the four-step control flow. The messaging destination slot persists in the onboarding session and survives refresh, Back, and repository/platform changes.
Two session-exit behaviors change here because the new step is what requires them. `OnboardingSkipButton` now calls `resetOnboarding`: treatment ends on scm-messaging, the last step before project creation, so skipping there must not leave a half-staged session for the next /onboarding visit to resume from. `useWelcomeAnalyticsEffect` stops resetting on the SCM path and clears only repo-derived state via `clearDerivedState`, because `messagingSetup` is organization-scoped and must survive a return to welcome.
Nothing outside static/app/views/onboarding/ reads this session state: the 'onboarding' sessionStorage key has a single reader in OnboardingContextProvider, mounted only under the /onboarding/:step/ route. The post-onboarding quick-start checklist is server-backed via /organizations/{org}/onboarding-tasks/, so neither exit affects it.
Revalidation of a restored destination is stacked separately: nothing can write a `selected` destination until VDY-143 adds the picker.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1fd0e34 to
b3d95f7
Compare
4a1eaad to
dd36973
Compare
The heading string was written twice: once as the step descriptor's title and once inside ScmMessaging. gettext keys on msgid so this was never two catalog entries, but the two copies could drift. Both now read SCM_MESSAGING_TITLE, matching the module-level title-constant convention in views/insights/pages/*/settings.ts. ScmMessagingAdapter's platform guard is documented as type-narrowing only. isInvalidMessagingStep redirects before the step renders without a platform, so the branch is unreachable and should not grow into an empty state. The stepper's aria-valuemax assertions moved out of the navigation and deferred-creation tests into two paired tests, so the four- versus five-step split fails legibly on its own. Verified non-vacuous: forcing the control step list for treatment fails with valuemax 4 instead of 5. Refs VDY-140
Document that skipping any treatment step exits the treatment and clears its staged onboarding session.
295494f to
75c146a
Compare
| const fallbackStep = isInvalidMessagingStep | ||
| ? OnboardingStepId.SCM_PLATFORM_FEATURES | ||
| : onboardingSteps[0]!.id; | ||
| return ( | ||
| <Redirect | ||
| to={normalizeUrl(`/onboarding/${organization.slug}/${onboardingSteps[0]!.id}/`)} | ||
| /> | ||
| <Redirect to={normalizeUrl(`/onboarding/${organization.slug}/${fallbackStep}/`)} /> |
There was a problem hiding this comment.
Bug: The isInvalidMessagingStep check can redirect legacy users to scm-platform-features, a step not in their flow, causing a double redirect before landing on the correct fallback page.
Severity: LOW
Suggested Fix
Update the redirect logic to ensure the fallback step exists in the current user's onboardingSteps array. One option is to gate the isInvalidMessagingStep check on hasScmMessaging. Alternatively, choose a safer fallback step, such as the first step in the current flow, which is guaranteed to exist.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: static/app/views/onboarding/onboarding.tsx#L460-L464
Potential issue: For users in the legacy onboarding flow, navigating to the
`scm-messaging` step without a `selectedPlatform` in context triggers the
`isInvalidMessagingStep` condition. This incorrectly redirects them to the
`scm-platform-features` step, which does not exist in the `legacyOnboardingSteps` array.
The application then performs a second redirect to the default `welcome` step. This
double-redirect occurs because the fallback logic for an invalid messaging step does not
account for different user onboarding flows and assumes the `scm-platform-features` step
is always available.
There was a problem hiding this comment.
Fixed in 882961a. The SCM-platform fallback now applies only when the messaging treatment is active, so inactive messaging routes use the current flow’s normal first-step fallback. Added a control-flow regression test.
Only the messaging treatment redirects missing messaging state to the SCM platform step. Other onboarding flows now use the standard invalid-step fallback. Refs VDY-140
TLDR
Adds the treatment-only fifth SCM onboarding step between platform/features and SDK setup, preserving the four-step control flow. The messaging destination slot persists in the onboarding session and survives refresh, Back, and repository/platform changes. Treatment entry creates no project.
Details
Stacked on #121022, which makes onboarding session exits explicit and is the prerequisite for persisting anything that must outlive a platform change; that in turn sat on #120981, which registered the distinct
onboarding-scm-messaging-experimentkey and has merged. The FlagPole config is getsentry/sentry-options-automator#9012, deliberately scoped to a single throwaway developer alias.This layer establishes only the route and the session contract. It has no forward navigation on completion by design: VDY-141 owns shared project and alert-rule creation on final Continue or Set up later, VDY-143 owns inline destination configuration, and VDY-146 owns exposure and interaction analytics. A placeholder
onCompletehere would be deleted by VDY-141 and would strand users on a blanksetup-docs, which renders offrecentCreatedProjectand bails when absent. Because treatment cannot complete yet, the flag must not widen beyond that alias until VDY-141 lands.Revalidation of a restored destination is stacked separately in #121187. Nothing in this PR can write a
selectedorskippeddestination — VDY-143 adds the picker and VDY-141 addsSet up later— so that logic has no reachable consumer yet and is better reviewed on its own.The onboarding host consumes the nested assignment without reporting exposure and selects separate control and treatment step descriptors from entry, sharing the Welcome and repository steps.
ScmPlatformFeatureskeeps the existing control creation boundary but only stages platform and feature choices for treatment before advancing toscm-messaging;deferProjectCreationalso drops the teams/projects store gate, which only the auto-create path needs. Global Skip resets the onboarding session and exits without creating a project.Steppergainedrole="progressbar"witharia-valuemax, making the four- versus five-step split both accessible and assertable.OnboardingContextProviderpersists a typedunconfigured,skipped, or completed messaging destination in the existing session value, as a discriminated union so a partially-filled destination is unrepresentable. Because #121022 made field setters local, SCM repository, platform, refresh, and Back paths all preserve organization-scoped messaging state.Two session-exit behavior changes live here rather than in #121022, because the new step is what requires them.
OnboardingSkipButtonnow callsresetOnboarding, which it previously did not do at all: treatment ends onscm-messaging, the last step before project creation, so skipping there must not leave a half-staged session for the next/onboardingvisit to resume from.useWelcomeAnalyticsEffectstops resetting on the SCM path and clears only repo-derived state viaclearDerivedState, becausemessagingSetupis organization-scoped and must survive a return to Welcome. Neither exit affects anything downstream of onboarding: theonboardingsessionStorage key has exactly one reader,OnboardingContextProvider, mounted only under the/onboarding/:step/route, and the post-onboarding quick-start checklist is server-backed via/organizations/{org}/onboarding-tasks/.Coverage exercises the four- versus five-step split, deferred creation, session remount and Back behavior, and global Skip.
Refs VDY-140