Skip to content

feat(onboarding): Add SCM messaging treatment route - #120992

Open
jaydgoss wants to merge 4 commits into
feat/vdy-140-onboarding-session-semanticsfrom
feat/vdy-140-treatment-route-state
Open

feat(onboarding): Add SCM messaging treatment route#120992
jaydgoss wants to merge 4 commits into
feat/vdy-140-onboarding-session-semanticsfrom
feat/vdy-140-treatment-route-state

Conversation

@jaydgoss

@jaydgoss jaydgoss commented Jul 31, 2026

Copy link
Copy Markdown
Member

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-experiment key 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 onComplete here would be deleted by VDY-141 and would strand users on a blank setup-docs, which renders off recentCreatedProject and 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 selected or skipped destination — VDY-143 adds the picker and VDY-141 adds Set 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. ScmPlatformFeatures keeps the existing control creation boundary but only stages platform and feature choices for treatment before advancing to scm-messaging; deferProjectCreation also 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. Stepper gained role="progressbar" with aria-valuemax, making the four- versus five-step split both accessible and assertable.

OnboardingContextProvider persists a typed unconfigured, 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. OnboardingSkipButton now calls resetOnboarding, which it previously did not do at all: 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. Neither exit affects anything downstream of onboarding: the onboarding sessionStorage 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

@linear-code

linear-code Bot commented Jul 31, 2026

Copy link
Copy Markdown

VDY-140

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 31, 2026
@jaydgoss
jaydgoss force-pushed the feat/vdy-140-treatment-route-state branch from 35e346f to 9601f27 Compare July 31, 2026 22:14
@jaydgoss
jaydgoss changed the base branch from feat/vdy-140-scm-messaging-experiment-flag to feat/vdy-140-onboarding-session-semantics July 31, 2026 22:14
@jaydgoss
jaydgoss force-pushed the feat/vdy-140-onboarding-session-semantics branch from f09dc21 to 1fd0e34 Compare August 4, 2026 16:59
@jaydgoss
jaydgoss force-pushed the feat/vdy-140-treatment-route-state branch from 9601f27 to 12140ea Compare August 4, 2026 16:59
@sentry

sentry Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
- - - - - - ✅ 451 uploaded

No base snapshots found to compare against. Make sure snapshots are uploaded from your main branch.

⚙️ sentry-frontend Snapshot Settings

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>
@jaydgoss
jaydgoss force-pushed the feat/vdy-140-onboarding-session-semantics branch from 1fd0e34 to b3d95f7 Compare August 4, 2026 18:10
@jaydgoss
jaydgoss force-pushed the feat/vdy-140-treatment-route-state branch from 4a1eaad to dd36973 Compare August 4, 2026 18:10
@jaydgoss
jaydgoss marked this pull request as ready for review August 4, 2026 20:26
@jaydgoss
jaydgoss requested a review from a team as a code owner August 4, 2026 20:26
Comment thread static/app/views/onboarding/components/onboardingSkipButton.tsx Outdated
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.
Comment on lines +460 to +464
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}/`)} />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant