Skip to content

fix(auth,organizations): surface failures in org-create and email-verification flows - #4451

Merged
PierreBrisorgueil merged 1 commit into
masterfrom
fix/4447-surface-error-paths
Jul 16, 2026
Merged

PierreBrisorgueil merged 1 commit into
masterfrom
fix/4447-surface-error-paths

Conversation

@PierreBrisorgueil

Copy link
Copy Markdown
Collaborator

Summary

  • What changed:
    • organization.create.view.vue: the create() catch block only logged to the console, leaving the user with no feedback on failure. It now surfaces err.response.data.message (with err.message / generic fallbacks) via a closable v-alert, mirroring the existing pattern in organizationSetup.component.vue.
    • verifyEmail.view.vue: regains its stay-on-page bail-out via a !authStore.user guard after the post-verification token() soft-refresh. token() never throws (unlike the refreshAbilities() it replaced in fix(auth,organizations): soft-refresh (token) at onboarding sites to prevent silent sign-out #4431), so a failed soft-refresh previously fell through into the redirect branch and showed "Redirecting..." on stale state instead of the verified-success message.
    • auth.store.js: token() now also populates pendingRequests from the response (superset of what refreshAbilities() carried), so the org-required wall's join-banner/duplicate-request guard stays accurate after a soft-refresh.
  • Why: both flows swallowed failures silently, leaving users with dead ends and no error signal.
  • Related issues: Closes 🐛 Surface failures in org-create and email-verification flows #4447

Scope

  • Modules impacted: auth, organizations
  • Cross-module impact: none
  • Risk level: low

Validation

  • npm run lint
  • npm run test:unit — 2463 tests green, including 7 new state-asserting tests covering both flows
  • npm run build
  • Manual checks done (if applicable)

Guardrails check

  • No secrets or credentials introduced (.env*, secrets/**, keys, tokens)
  • No risky rename/move of core stack paths
  • Changes remain merge-friendly for downstream projects
  • Tests added or updated when behavior changed

Notes for reviewers

https://claude.ai/code/session_01WfNC8bt1TgL4AsiYgCEGup

…ification flows

- organization.create.view.vue: the create() catch only logged to the
  console, leaving the user with no feedback on failure. Surface
  err.response.data.message (with fallbacks) via a v-alert, mirroring
  the pattern applied to organizationSetup.component.vue (f92003d).
- verifyEmail.view.vue: the refreshAbilities() -> token() swap (#4431)
  dropped the "stay on page if the refresh fails" bail-out, since
  token() never throws. After the soft-refresh, bail out (no
  redirecting UI, no navigation) unless the store actually has a
  populated user, mirroring the isLoggedIn/!user check app.router.js
  already uses to detect a stale/failed refresh.

Closes #4447

Claude-Session: https://claude.ai/code/session_01WfNC8bt1TgL4AsiYgCEGup
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@PierreBrisorgueil, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4377b4a8-7f36-481f-a87a-8cc247aa03b2

📥 Commits

Reviewing files that changed from the base of the PR and between 41cc887 and 3835d55.

📒 Files selected for processing (5)
  • ERRORS.md
  • src/modules/auth/tests/auth.verifyEmail.view.unit.tests.js
  • src/modules/auth/views/verifyEmail.view.vue
  • src/modules/organizations/tests/organization.create.view.unit.tests.js
  • src/modules/organizations/views/organization.create.view.vue
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/4447-surface-error-paths

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.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.56%. Comparing base (0b40e8c) to head (3835d55).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4451   +/-   ##
=======================================
  Coverage   99.56%   99.56%           
=======================================
  Files          35       35           
  Lines        1391     1391           
  Branches      436      436           
=======================================
  Hits         1385     1385           
  Misses          6        6           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PierreBrisorgueil
PierreBrisorgueil marked this pull request as ready for review July 16, 2026 14:07
@PierreBrisorgueil
PierreBrisorgueil merged commit b161df5 into master Jul 16, 2026
7 checks passed
@PierreBrisorgueil
PierreBrisorgueil deleted the fix/4447-surface-error-paths branch July 16, 2026 14:11
PierreBrisorgueil added a commit that referenced this pull request Jul 16, 2026
…t race (#4464)

* fix(auth,organizations): guard soft-refresh navigation and the signout race

organization.create.view.vue's create() awaited authStore.token() (a
soft-refresh that never throws on failure) and then pushed unconditionally.
A transient blip left authStore.user.currentOrganization falsy, and the
app-router org-guard bounced the just-created org straight back to
/organization-required. Guard the navigation on currentOrganization being
populated, mirroring organizations.required.view.vue's refresh()/
acceptInvitation() and verifyEmail.view.vue's bail (#4451). On a stalled
refresh the organization already exists server-side, so it's kept for a
manual retry instead of being lost behind a dead-end error.

auth.store.js's signout() had no guard against an in-flight token()/
refreshAbilities() resolving after it and re-populating auth=true/user/
localStorage. Added a module-scope generation counter (mirrors the
isRefreshingAbilities dedup flag in lib/services/axios.js): signout() bumps
it synchronously before anything else; token()/refreshAbilities() capture
it before their network await and drop stale continuations that resolve
after a concurrent signout already ran.

Closes #4459

Claude-Session: https://claude.ai/code/session_01WfNC8bt1TgL4AsiYgCEGup

* fix(organizations): prevent duplicate org creation on pending-refresh retry

Phase-0 review findings on #4459's soft-refresh guard:

- HIGH: the error alert's `closable`/@click:close only cleared `error`,
  never `pendingOrg`. Dismissing the banner instead of clicking its inline
  Retry left the still-enabled primary "Create Organization" button wired
  to create() — clicking it called createOrganization() a second time
  with the same data, duplicating the org server-side. The primary button
  now routes through handlePrimaryAction(): while pendingOrg is set it
  always calls retryRefresh(), regardless of whether the alert was
  dismissed, and its label switches to "Retry" to match.

- LOW: auth.store.js's refreshAbilities() catch path unconditionally
  called signout() + rethrew, even when the /token request only failed
  because a concurrent signout() had already invalidated the generation
  (e.g. the session cookie is gone). That could surface a stale "session
  expired" error right after a deliberate signout. The catch now checks
  the same generation guard as the success path and swallows silently
  when stale.

Claude-Session: https://claude.ai/code/session_01WfNC8bt1TgL4AsiYgCEGup

* docs(auth): scope the generation-guard comment to what it actually covers

The doc comment implied signout() invalidates any concurrent soft-refresh
continuation. It only covers calls captured before signout()'s synchronous
bump — a call starting during signout()'s own async window is not guarded.
No logic change, comment-only clarification.
PierreBrisorgueil pushed a commit that referenced this pull request Aug 1, 2026
# [2.3.0](v2.2.0...v2.3.0) (2026-08-01)

### Bug Fixes

* **auth,organizations:** guard soft-refresh navigation and the signout race ([#4464](#4464)) ([6a2546e](6a2546e)), closes [#4451](#4451) [#4459](#4459)
* **auth,organizations:** soft-refresh (token) at onboarding sites to prevent silent sign-out ([#4431](#4431)) ([5d88766](5d88766))
* **auth,organizations:** surface failures in org-create and email-verification flows ([#4451](#4451)) ([b161df5](b161df5)), closes [#4431](#4431) [#4447](#4447)
* **auth:** surface requestJoin failures in the org-setup alert ([#4389](#4389)) ([#4397](#4397)) ([f92003d](f92003d))
* **auth:** token() soft-refresh also carries pendingRequests ([#4436](#4436)) ([0b40e8c](0b40e8c))
* **billing:** config-source the upgrade-prompt pricing copy ([#4465](#4465)) ([9cb370d](9cb370d)), closes [#4460](#4460)
* **billing:** meter-mode upgrade prompt copy + single-entry route ([#4410](#4410)) ([df396cf](df396cf)), closes [pricing#units](https://github.com/pricing/issues/units) [pricing#units](https://github.com/pricing/issues/units)
* **billing:** migrate default packs to the V4 pricing-card schema ([#4463](#4463)) ([84789b8](84789b8)), closes [pricing#units](https://github.com/pricing/issues/units) [#4458](#4458)
* **core,organizations:** config-gate org-required header + unify first-org redirect ([#4423](#4423)) ([7adb298](7adb298)), closes [#4421](#4421) [#4422](#4422)
* **core:** wire the computed theme into Vuetify so auto dark-mode works ([#4466](#4466)) ([ed35252](ed35252)), closes [#4462](#4462)
* **prerender:** strip local server origin from captured HTML + fail-hard leak assert ([#4502](#4502)) ([#4503](#4503)) ([dbcf8d7](dbcf8d7))
* **skills:** flip PR to ready before waiting on CodeRabbit to avoid a draft deadlock ([#4473](#4473)) ([a733998](a733998)), closes [#4450](#4450)

### Features

* **billing:** pricing feature rows wrap + explicit ✗ not-included marker ([#4390](#4390)) ([4bc2515](4bc2515))
* **invitations:** show invite form when user-facing invitations enabled with open signup ([#4501](#4501)) ([daa6688](daa6688)), closes [#4500](#4500)
* **skills:** /feature non-interactive invocation — structured SKIP/STOP instead of prompts ([#4455](#4455)) ([197c5f3](197c5f3)), closes [#N](https://github.com/pierreb-devkit/Vue/issues/N) [#failure](https://github.com/pierreb-devkit/Vue/issues/failure) [#4454](#4454)
* **ui:** config-overridable loader, plan-badge set, and copy strings ([#4475](#4475)) ([688911a](688911a)), closes [#4474](#4474)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Surface failures in org-create and email-verification flows

1 participant