Feature ETP-4958: Route SSO login through caller-owned continuation - #137
Open
sebastianbarrozo wants to merge 1 commit into
Open
Feature ETP-4958: Route SSO login through caller-owned continuation#137sebastianbarrozo wants to merge 1 commit into
sebastianbarrozo wants to merge 1 commit into
Conversation
LoginStep carried two independent copies of the post-authentication continuation, one per authentication branch. When the caller-owned onAuthenticated prop was introduced only the password copy was updated, so an SSO login on the invitation page persisted the session and then stopped: the caller never got its callback and the user was stranded on the login form with an unconsumed invitation token. Extract the continuation into a single exported helper that both branches call, so the two paths can no longer diverge. Add the missing onAuthenticated entry to the handleSsoProviderLogin dependency array, which otherwise captured a stale callback for any caller that memoizes config. Replace the previous source-text assert.match regression test with behavioural unit tests covering routing suppression, persistence-before- handover ordering, forwarded arguments, error propagation and the no-continuation default.
Contributor
|
📦 Preview packages published — dist-tag To exercise the published-package path (no make bump-core-version VERSION=0.3.36-preview.feature-ETP-4958.20260821105932.27b99ccRe-posted on each push to this branch; supersedes older previews. |
This was referenced Aug 21, 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.

0 New Issues
0 Fixed Issues
0 Accepted Issues
No data about coverage
ETP-4958 — SSO login on the invitation page never resumes the invitation flow
https://etendoproject.atlassian.net/browse/ETP-4958
Symptom
Accepting a company invitation as an existing account via SSO (Google) authenticated the user but left the login form on screen — nothing appeared to happen and the invitation was never consumed. Email + password on the very same screen worked correctly.
Root cause
LoginStepis a shared authentication surface with two independent authentication branches —handleLogin(password) andhandleSsoProviderLogin(SSO) — and each carried its own copy of the post-authentication continuation.ETP-4894 introduced the caller-owned
onAuthenticatedprop so a consumer can take over what happens after login instead of the default environment routing.InviteAcceptancePagepasses it and depends on it to flipexistingAuthenticatedand render the acceptance action. Only the password copy was updated; the SSO branch kept the original call:So an SSO login persisted the token to
localStorageand then stopped.existingAuthenticatedstayedfalse, the page re-rendered the sameLoginStep, and the user was stranded with a valid session and an unconsumed invitation token.The invitation page passes no
routeByEnvironments, so the failure surfaced as a silent dead end rather than a wrong redirect. A caller passing both props would additionally have been navigated out of its own flow.The underlying defect is the duplicated contract: two copies that must be hand-synchronised, where the second copy is where the bug landed.
Changes
src/onboarding/postAuth.jscompleteAuthentication()— the single post-auth continuation: persist auth state → route only when the caller has not taken ownership → hand over to the caller.src/onboarding/steps/LoginStep.jsxonAuthenticatedentry to thehandleSsoProviderLogindependency array — it otherwise captured a stale callback for any caller that memoizesconfig.test/postAuthContinuation.test.jstest/onboardingOwnership.test.jsassert.match()regression test (see below).docs/feedback.mdOn the previous regression test
The original protection for this bug asserted on the literal source text of
LoginStep.jsx:That is a change detector, not a behavioural test. It passes even if the code path is unreachable, breaks on harmless reformatting or a variable rename, and verifies neither ordering nor arguments. It is replaced with real tests of the extracted contract: routing suppression, persistence-before-handover ordering, forwarded token/account, error propagation, and the no-continuation default.
Verification
npm testinpackages/etendo-go-core: 188 passed / 0 failed.postAuth.jsreverted to the pre-fix behaviour (always route, never call the continuation), 6 of the 7 new tests fail; restored, all 7 pass.Known coverage gaps (not closed here)
Recorded on the Jira issue as follow-ups; each needs work outside this fix's scope:
LoginStep's two branches actually route through it.packages/etendo-go-coreruns plainnode --testwith no JSX/jsdom runner, so the component cannot be rendered here.packages/app-shell-corealready has vitest + Testing Library configured and is the template if we want to add one.tools/app-shell/src/pages/__tests__/InviteAcceptancePage.vitest.jsx(functional repo) replacesLoginStepwith a stub that always callsonAuthenticated, so the real SSO branch is rendered in neither repo — this is why the bug reached a user.user-invitation.mocked.spec.jsanduser-invitation.email.integration.spec.jscontain zero SSO references.Downstream
Core-only change. The functional repo consumes
@etendosoftware/etendo-go-coreat a pinned preview version, so it needs a pin bump to a build containing this commit before the fix reaches the app.