Skip to content

ref(onboarding): Make onboarding session exits explicit - #121022

Merged
jaydgoss merged 1 commit into
masterfrom
feat/vdy-140-onboarding-session-semantics
Aug 5, 2026
Merged

ref(onboarding): Make onboarding session exits explicit#121022
jaydgoss merged 1 commit into
masterfrom
feat/vdy-140-onboarding-session-semantics

Conversation

@jaydgoss

@jaydgoss jaydgoss commented Jul 31, 2026

Copy link
Copy Markdown
Member

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 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 — 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.

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. 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 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. Reachable when no platform was detected and the manual picker is showing.

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.

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

@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
Base automatically changed from feat/vdy-140-scm-messaging-experiment-flag to master August 4, 2026 16:25
@jaydgoss
jaydgoss force-pushed the feat/vdy-140-onboarding-session-semantics branch from f09dc21 to 1fd0e34 Compare August 4, 2026 16:59
`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
jaydgoss force-pushed the feat/vdy-140-onboarding-session-semantics branch from 1fd0e34 to b3d95f7 Compare August 4, 2026 18:10
@jaydgoss
jaydgoss marked this pull request as ready for review August 4, 2026 18:17
@jaydgoss
jaydgoss requested a review from a team as a code owner August 4, 2026 18:17
@jaydgoss
jaydgoss merged commit c731622 into master Aug 5, 2026
71 of 72 checks passed
@jaydgoss
jaydgoss deleted the feat/vdy-140-onboarding-session-semantics branch August 5, 2026 15:58
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.

2 participants