ref(onboarding): Make onboarding session exits explicit - #121022
Merged
Conversation
Base automatically changed from
feat/vdy-140-scm-messaging-experiment-flag
to
master
August 4, 2026 16:25
jaydgoss
force-pushed
the
feat/vdy-140-onboarding-session-semantics
branch
from
August 4, 2026 16:59
f09dc21 to
1fd0e34
Compare
`setSelectedPlatform(undefined)` was routed through `removeOnboarding()`, so a setter named after one field wiped the entire session. That coupling was invisible at every call site, and it made the setter unsafe for any state that should outlive a platform change. `OnboardingContextProvider` now exposes `resetOnboarding` alongside the existing `clearDerivedState`, and `setSelectedPlatform` behaves like every sibling setter: it writes one field. The four full-flow exits that relied on the destructive overload call `resetOnboarding` directly - the global Skip Onboarding link in `onboarding.tsx`, back-from-`select-platform` and project deletion without state preservation in `useBackActions`, and the legacy cleanup in `useConfigureSdk`. Behavior at those sites is unchanged; only the intent is now greppable. The one user-visible consequence is in `scmPlatformFeaturesCore`, whose clearable platform Select calls `onPlatformChange(undefined)`. That control previously destroyed the SCM integration and repository selection as a side effect of clearing a platform; it now leaves them intact. New coverage in `onboardingContext.spec.tsx` pins both halves: clearing a field preserves the rest of the session, and `resetOnboarding` clears persisted state. The reset test seeds `sessionStorage` directly rather than using the `initialValue` prop, because `useSessionStorage`'s `removeItem` restores in-memory state back to `initialValue` - a seeded prop would be restored rather than cleared, which the real provider never does since it passes no `initialValue`. Refs VDY-140
jaydgoss
force-pushed
the
feat/vdy-140-onboarding-session-semantics
branch
from
August 4, 2026 18:10
1fd0e34 to
b3d95f7
Compare
jaydgoss
marked this pull request as ready for review
August 4, 2026 18:17
evanpurkhiser
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Clearing the selected platform in SCM onboarding no longer discards the connected repository and every other staged choice. The four exits that genuinely want a clean slate now say so explicitly, with no change to their behavior.
Details
setSelectedPlatform(undefined)was routed throughremoveOnboarding(), so a setter named after one field wiped the entire session. That coupling was invisible at every call site, and it made the setter unsafe for any state that should outlive a platform change — which is the blocker for the messaging destination VDY-140 stacks on top of this. The refactor lands on its own because it changes legacy onboarding behavior and deserves review on those terms, not buried in the experiment work.OnboardingContextProvidernow exposesresetOnboardingalongside the existingclearDerivedState, andsetSelectedPlatformbehaves like every sibling setter: it writes one field. The four full-flow exits that relied on the destructive overload callresetOnboardingdirectly — the global Skip Onboarding link inonboarding.tsx, back-from-select-platformand project deletion without state preservation inuseBackActions, and the legacy cleanup inuseConfigureSdk. Each of those is a 1-for-1 rename: behavior is unchanged, only the intent is now greppable.Routing the exits through a named function rather than keeping the overload means the destructive call is greppable and each site states its intent. The alternative — leaving the setter destructive and adding a second non-destructive setter — preserves the trap for the next caller who reasonably assumes a field setter touches one field.
The one user-visible consequence is in
scmPlatformFeaturesCore, whose clearable platform Select callsonPlatformChange(undefined). That control previously destroyed the SCM integration and repository selection as a side effect of clearing a platform; it now leaves them intact. Reachable when no platform was detected and the manual picker is showing.New coverage in
onboardingContext.spec.tsxpins both halves: clearing a field preserves the rest of the session, andresetOnboardingclears persisted state. The reset test seedssessionStoragedirectly rather than using theinitialValueprop, becauseuseSessionStorage'sremoveItemrestores in-memory state back toinitialValue— a seeded prop would be restored rather than cleared, which the real provider never does since it passes noinitialValue.Two session-exit behavior changes that an earlier revision of this PR carried have moved to #120992, the messaging-route PR that actually requires them, so this PR is a pure refactor.
Refs VDY-140