Skip to content

fix(onboarding): auto-open incomplete onboarding on 7.3+#1940

Merged
Ajit-Mehrotra merged 2 commits intomainfrom
codex/onboarding-gating-behavior
Mar 20, 2026
Merged

fix(onboarding): auto-open incomplete onboarding on 7.3+#1940
Ajit-Mehrotra merged 2 commits intomainfrom
codex/onboarding-gating-behavior

Conversation

@Ajit-Mehrotra
Copy link
Contributor

@Ajit-Mehrotra Ajit-Mehrotra commented Mar 19, 2026

Summary

  • auto-open onboarding for any incomplete user on supported versions (7.3.0+)
  • preserve the existing close lifecycle so dismissing an auto-opened modal still marks onboarding complete
  • update onboarding service specs for the licensed-user path and refresh the onboarding behavior docs

Why

Licensed users upgrading from 7.2.x to 7.3.x could remain incomplete but never see the onboarding modal because auto-open was limited to fresh-install (ENOKEYFILE) states.

Validation

  • pnpm lint
  • pnpm test
  • pnpm type-check

Summary by CodeRabbit

  • Improvements
    • Onboarding modal now auto-opens for any incomplete onboarding on supported versions (broader than fresh-install-only).
  • Documentation
    • Updated onboarding docs to reflect the revised auto-open visibility rules.
  • Tests
    • Adjusted and added tests to cover auto-open and close behavior for licensed users on supported versions.

- Purpose: show the onboarding modal once for any incomplete user on supported versions, including licensed users upgrading from 7.2.x to 7.3.x.
- Before: auto-open and close-to-complete behavior only applied when registration state looked like a fresh install (ENOKEYFILE).
- Problem: licensed users who had never completed onboarding stayed gated out of the modal after upgrading to 7.3.x.
- Change: remove the fresh-install requirement from the backend auto-open and close lifecycle predicates so incomplete 7.3+ users are treated consistently.
- Coverage: add service specs for licensed incomplete users and update the onboarding docs to match the actual behavior.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 88fce00f-a6c5-456f-9bbf-8371463f1d3b

📥 Commits

Reviewing files that changed from the base of the PR and between 7bf7f20 and 564176a.

📒 Files selected for processing (3)
  • api/src/unraid-api/graph/resolvers/customization/onboarding.service.spec.ts
  • api/src/unraid-api/graph/resolvers/customization/onboarding.service.ts
  • web/src/components/Onboarding/UPGRADE_ONBOARDING.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • api/src/unraid-api/graph/resolvers/customization/onboarding.service.ts
  • api/src/unraid-api/graph/resolvers/customization/onboarding.service.spec.ts
  • web/src/components/Onboarding/UPGRADE_ONBOARDING.md

Walkthrough

Auto-open logic now triggers for any incomplete onboarding on supported versions; fresh-install checks no longer gate auto-open or completion marking. Tests were adjusted and extended for licensed-user scenarios, and documentation updated to reflect the new auto-open rules.

Changes

Cohort / File(s) Summary
Onboarding Service Logic
api/src/unraid-api/graph/resolvers/customization/onboarding.service.ts
Removed use of onboardingState.isFreshInstall from shouldAutoOpen/completion gating; auto-open now uses isVersionSupported(currentVersion) && !state.completed.
Test Suite Updates
api/src/unraid-api/graph/resolvers/customization/onboarding.service.spec.ts
Renamed tests to reference "supported versions". Added tests covering licensed-user scenarios that verify getOnboardingResponse() returns shouldOpen: true and closeOnboarding() marks incomplete onboarding complete without calling setForceOpen.
Documentation
web/src/components/Onboarding/UPGRADE_ONBOARDING.md
Updated onboarding auto-display docs: auto-open applies to any INCOMPLETE state on supported versions (7.3.0+) and is backend-driven via shouldOpen, removing the fresh-install/upgrade-specific wording.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐇 I hopped through code at dawn's first light,
Found flags and versions in a tangled plight.
Now incomplete paths on supported ground,
Will open gently—no fresh-tag bound.
Paws up, I celebrate this subtle flight. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(onboarding): auto-open incomplete onboarding on 7.3+' is directly related to the main change: enabling auto-open of incomplete onboarding on supported versions (7.3.0+) for all users, not just fresh installs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/onboarding-gating-behavior
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.51%. Comparing base (f58fcc0) to head (564176a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1940      +/-   ##
==========================================
- Coverage   51.52%   51.51%   -0.01%     
==========================================
  Files        1025     1025              
  Lines       70467    70460       -7     
  Branches     7791     7790       -1     
==========================================
- Hits        36307    36297      -10     
- Misses      34037    34040       +3     
  Partials      123      123              

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
web/src/components/Onboarding/UPGRADE_ONBOARDING.md (1)

5-5: Consider tightening ownership wording for visibility decisions.

Line 5 can read as if visibility is fully client-owned, while later notes correctly emphasize backend shouldOpen. Consider clarifying that backend computes shouldOpen, and the client applies final UI guards.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/src/components/Onboarding/UPGRADE_ONBOARDING.md` at line 5, The wording
implies the client fully decides modal visibility; update the copy to state that
the backend computes the recommended visibility flag (`shouldOpen`) based on
onboarding API fields (`completed`, `completedAtVersion`) and the web client
applies final UI guards (version checks, local UX rules) before showing the
modal; explicitly mention `shouldOpen` as backend-owned and the client as
applying presentation-level safeguards to avoid ambiguity.
api/src/unraid-api/graph/resolvers/customization/onboarding.service.spec.ts (1)

587-603: Make the “licensed” close-path test explicitly licensed.

The test title says “licensed” but setup only changes isFreshInstall. Consider setting registration mocks to PRO/registered as you did in Line 420-448, so the intent is unambiguous.

Suggested test-hardening tweak
         onboardingTrackerMock.getCurrentVersion.mockReturnValue('7.3.0');
+        onboardingStateMock.getRegistrationState.mockReturnValue('PRO');
+        onboardingStateMock.isRegistered.mockReturnValue(true);
+        onboardingStateMock.hasActivationCode.mockResolvedValue(false);
+        onboardingStateMock.requiresActivationStep.mockReturnValue(false);
         onboardingStateMock.isFreshInstall.mockReturnValue(false);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/src/unraid-api/graph/resolvers/customization/onboarding.service.spec.ts`
around lines 587 - 603, The test "marks licensed incomplete onboarding complete
when closed on supported versions" claims to exercise the licensed path but
doesn't set registration state; add the registration mock setup to explicitly
mark the instance as licensed/PRO (as done earlier in the suite) so the intent
is unambiguous. In this test, after configuring onboardingTrackerMock and
onboardingStateMock, set the registration mock (e.g., registrationServiceMock or
registrationMock used elsewhere in the file) to return a PRO/registered result
so the code path for licensed installs is exercised before calling
service.closeOnboarding(); keep existing assertions on
onboardingTrackerMock.markCompleted and setForceOpen unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@api/src/unraid-api/graph/resolvers/customization/onboarding.service.ts`:
- Around line 413-415: Remove the unnecessary await call to getOnboardingState()
in closeOnboarding(): the local variable onboardingState (from
getOnboardingState()) is never used, causing extra async work and potential
failures; delete the line "const onboardingState = await
this.getOnboardingState();" and ensure the closeOnboarding() logic continues to
use the existing state/currentVersion/isVersionSupported() checks (e.g., the
existing "state" and "shouldAutoOpen" computation) without referencing
onboardingState anywhere else.

---

Nitpick comments:
In `@api/src/unraid-api/graph/resolvers/customization/onboarding.service.spec.ts`:
- Around line 587-603: The test "marks licensed incomplete onboarding complete
when closed on supported versions" claims to exercise the licensed path but
doesn't set registration state; add the registration mock setup to explicitly
mark the instance as licensed/PRO (as done earlier in the suite) so the intent
is unambiguous. In this test, after configuring onboardingTrackerMock and
onboardingStateMock, set the registration mock (e.g., registrationServiceMock or
registrationMock used elsewhere in the file) to return a PRO/registered result
so the code path for licensed installs is exercised before calling
service.closeOnboarding(); keep existing assertions on
onboardingTrackerMock.markCompleted and setForceOpen unchanged.

In `@web/src/components/Onboarding/UPGRADE_ONBOARDING.md`:
- Line 5: The wording implies the client fully decides modal visibility; update
the copy to state that the backend computes the recommended visibility flag
(`shouldOpen`) based on onboarding API fields (`completed`,
`completedAtVersion`) and the web client applies final UI guards (version
checks, local UX rules) before showing the modal; explicitly mention
`shouldOpen` as backend-owned and the client as applying presentation-level
safeguards to avoid ambiguity.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4dfd6c05-c5b6-4536-991d-97e58cc51479

📥 Commits

Reviewing files that changed from the base of the PR and between f58fcc0 and 7bf7f20.

📒 Files selected for processing (3)
  • api/src/unraid-api/graph/resolvers/customization/onboarding.service.spec.ts
  • api/src/unraid-api/graph/resolvers/customization/onboarding.service.ts
  • web/src/components/Onboarding/UPGRADE_ONBOARDING.md

- Purpose: resolve the PR review items on the onboarding gating follow-up.
- Before: closeOnboarding() still performed an unused onboarding-state fetch, the licensed close-path spec did not explicitly mock a licensed state, and the upgrade onboarding doc blurred backend vs client ownership of modal visibility.
- Problem: the unused fetch added avoidable async work in the close path, the test intent was less explicit than its title, and the docs could mislead readers about how shouldOpen is computed.
- Change: removed the unused async fetch, made the licensed spec explicitly registered/PRO, and clarified that the API computes shouldOpen while the web layer applies final UI guards.
- Validation: pnpm --filter ./api exec vitest run src/unraid-api/graph/resolvers/customization/onboarding.service.spec.ts && pnpm lint
@github-actions
Copy link
Contributor

This plugin has been deployed to Cloudflare R2 and is available for testing.
Download it at this URL:

https://preview.dl.unraid.net/unraid-api/tag/PR1940/dynamix.unraid.net.plg

@Ajit-Mehrotra Ajit-Mehrotra marked this pull request as ready for review March 20, 2026 16:04
@Ajit-Mehrotra Ajit-Mehrotra merged commit f0241a8 into main Mar 20, 2026
13 checks passed
@Ajit-Mehrotra Ajit-Mehrotra deleted the codex/onboarding-gating-behavior branch March 20, 2026 16:04
elibosley pushed a commit that referenced this pull request Mar 23, 2026
🤖 I have created a release *beep* *boop*
---


## [4.31.0](v4.30.1...v4.31.0)
(2026-03-23)


### Features

* **api:** support encrypted array start inputs
([#1944](#1944))
([018a8d5](018a8d5))
* **onboarding:** add shared loading states
([#1945](#1945))
([776c8cc](776c8cc))
* Serverside state for onboarding display
([#1936](#1936))
([682d51c](682d51c))


### Bug Fixes

* **api:** reconcile emhttp state without spinning disks
([#1946](#1946))
([d3e0b95](d3e0b95))
* **onboarding:** auto-open incomplete onboarding on 7.3+
([#1940](#1940))
([f0241a8](f0241a8))
* **onboarding:** replace internal boot native selects
([#1942](#1942))
([d6ea032](d6ea032))
* preserve onboarding resume state on reload
([#1941](#1941))
([91f7fe9](91f7fe9))
* recover VM availability after reconnect
([#1947](#1947))
([e064de7](e064de7))
* Unify callback server payloads
([#1938](#1938))
([f58fcc0](f58fcc0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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