Skip to content

Report an unresolvable user onboarding flow instead of redirecting - #5419

Open
Dilusha-Madushan wants to merge 1 commit into
thunder-id:mainfrom
Dilusha-Madushan:fix/remove-dead-user-creation-fallback
Open

Dilusha-Madushan wants to merge 1 commit into
thunder-id:mainfrom
Dilusha-Madushan:fix/remove-dead-user-creation-fallback

Conversation

@Dilusha-Madushan

@Dilusha-Madushan Dilusha-Madushan commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Purpose

When the user onboarding flow cannot be resolved, the Add User page navigated to a "manual user creation" page. That page executed the same onboarding flow that had just been reported missing, and carried no handling for that failure.

The result was that a missing flow produced a silent redirect followed by a second, less specific failure. The fallback made the outcome worse than no fallback at all.

Three checks established that the fallback could never have worked:

  • UserCreatePage contains no user-creation call. No useCreateUser, no POST to /users, no
    mutation. It renders the same InviteUser component, which pins flowType: USER_ONBOARDING.
  • UserCreatePage contains no missing-flow handling. isMissingOnboardingFlow appears zero times.
  • UserCreatePage was reachable only from this fallback. The Add User button calls
    routes.add(); routes.addCreate() had exactly one caller.

Approach

Report the condition in place rather than navigating away. The Add User page now sets an unavailable state when the flow cannot be resolved, and returns early with a message naming the two things to check: that a user onboarding flow is configured, and that the flow it names exists.

The early return replaces the wizard rather than overlaying it, so no step remains interactive behind the message. A test asserts the step heading is gone, not merely covered.

One state rather than two. The agent onboarding page distinguishes NOT_CONFIGURED from FLOW_MISSING, because it resolves the configured handle itself before starting. The Add User page cannot: it detects the condition reactively from the flow execution error, and the backend returns a single code, FLM-1003 "Flow not found", carrying no cause. Splitting the message would mean adding a server-config fetch to this page, which is new data-fetching behaviour rather than a fix, so the message covers both causes instead.

Detection is unchanged. isMissingOnboardingFlow already recognised the condition at both the onError and onFlowChange call sites. Only the response to it changed, so the matching logic keeps its existing coverage.

Removal. UserCreatePage and its test are deleted, along with the index.ts export, the lazy import and route in App.tsx, and addCreate from RouteConfig.ts and useUserRoutes.ts. Two stale references were cleaned up in passing: App.test.tsx mocked ../features/users/pages/UserCreatePage, a path that stopped existing when the pages moved into the package, and RouteConfig.test.ts asserted the now-removed route.

Tests. Two existing tests asserted the redirect and were rewritten. Two were added: that the wizard is replaced rather than rendered alongside the message, and that an error which is not a missing flow leaves the wizard intact so a recoverable failure stays recoverable. The new tests were verified by mutation: removing the state assignment fails three of the four.

Related Issues

Related PRs

  • N/A

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
    • Ran Vale and fixed all errors and warnings
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards in WSO2 Secure Coding Guidelines
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

Summary by CodeRabbit

  • Bug Fixes

    • User onboarding now shows a clear full-screen error when the configured flow cannot be found, instead of redirecting to manual user creation.
    • Other onboarding flow errors continue to display the wizard.
  • Changes

    • Removed the separate manual user-creation page and route.
    • User creation is now handled through the standard user-add flow.
  • Documentation

    • Added English translations for onboarding flow resolution errors.

Signed-off-by: Dilusha-Madushan <dilushamadushan9912@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 714f579f-5a04-463a-a6d3-ae744d9ccaed

📥 Commits

Reviewing files that changed from the base of the PR and between 8f64ffc and 16e43c3.

📒 Files selected for processing (11)
  • frontend/apps/console/src/App.tsx
  • frontend/apps/console/src/__tests__/App.test.tsx
  • frontend/apps/console/src/configs/RouteConfig.ts
  • frontend/apps/console/src/configs/__tests__/RouteConfig.test.ts
  • frontend/packages/configure-users/src/hooks/useUserRoutes.ts
  • frontend/packages/configure-users/src/index.ts
  • frontend/packages/configure-users/src/pages/UserAddPage.tsx
  • frontend/packages/configure-users/src/pages/UserCreatePage.tsx
  • frontend/packages/configure-users/src/pages/__tests__/UserAddPage.test.tsx
  • frontend/packages/configure-users/src/pages/__tests__/UserCreatePage.test.tsx
  • frontend/packages/i18n/src/locales/en-US.ts
💤 Files with no reviewable changes (8)
  • frontend/apps/console/src/configs/tests/RouteConfig.test.ts
  • frontend/packages/configure-users/src/pages/UserCreatePage.tsx
  • frontend/packages/configure-users/src/pages/tests/UserCreatePage.test.tsx
  • frontend/packages/configure-users/src/index.ts
  • frontend/apps/console/src/tests/App.test.tsx
  • frontend/apps/console/src/configs/RouteConfig.ts
  • frontend/packages/configure-users/src/hooks/useUserRoutes.ts
  • frontend/apps/console/src/App.tsx

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The manual user creation page and route were removed. UserAddPage now handles missing onboarding flows by stopping the wizard and rendering an error message. Route definitions, exports, tests, and English translations were updated.

Changes

User creation flow

Layer / File(s) Summary
Remove the manual creation route
frontend/apps/console/src/App.tsx, frontend/apps/console/src/configs/RouteConfig.ts, frontend/packages/configure-users/src/hooks/useUserRoutes.ts, frontend/packages/configure-users/src/index.ts, frontend/packages/configure-users/src/pages/UserCreatePage.tsx, frontend/apps/console/src/__tests__/App.test.tsx, frontend/apps/console/src/configs/__tests__/RouteConfig.test.ts, frontend/packages/configure-users/src/pages/__tests__/UserCreatePage.test.tsx
The /users/add/create route, UserCreatePage, its public export, route path members, mocks, and tests were removed.
Handle unavailable onboarding flows
frontend/packages/configure-users/src/pages/UserAddPage.tsx, frontend/packages/configure-users/src/pages/__tests__/UserAddPage.test.tsx, frontend/packages/i18n/src/locales/en-US.ts
UserAddPage now stops the wizard and renders an unavailable-flow error when the onboarding flow is missing. Tests cover both callback paths and unrelated errors. English translations provide the error title and description.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant InviteUser
  participant UserAddPage
  participant ErrorAlert
  InviteUser->>UserAddPage: report missing onboarding flow
  UserAddPage->>UserAddPage: set isFlowUnavailable and log error
  UserAddPage->>ErrorAlert: render unavailable-flow message
Loading

Merge Risk: ⚪ Minimal · up to 16e43

The removed manual-creation entry points have no remaining repository consumers, and the retained onboarding route handles unavailable flows with the intended error state.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: reporting an unresolvable user onboarding flow instead of redirecting to manual creation.
Description check ✅ Passed The description provides a detailed purpose, implementation approach, related issue, test coverage, and removal details. It follows the template structure. The checklist remains unchecked, and the pub…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

frontend/packages/configure-users/src/pages/UserAddPage.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

frontend/packages/configure-users/src/pages/__tests__/UserAddPage.test.tsx

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

frontend/packages/i18n/src/locales/en-US.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Dilusha-Madushan

Copy link
Copy Markdown
Contributor Author
image

this is how error shows now the flow is missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant