fix: check mdState to determine array stopped during onboarding#1969
fix: check mdState to determine array stopped during onboarding#1969
Conversation
…istory # Conflicts: # web/__test__/components/Onboarding/OnboardingInternalBootStandalone.test.ts # web/__test__/components/Onboarding/OnboardingSummaryStep.test.ts # web/src/components/Onboarding/OnboardingModal.vue # web/src/components/Onboarding/standalone/OnboardingInternalBoot.standalone.vue
The onboarding wizard was incorrectly reporting "array must be stopped" during internal boot because it only checked fsState (filesystem state). During internal boot, the boot pool keeps fsState as 'Started' even when the array (mdState) is actually STOPPED. Now checks mdState === STOPPED as the primary indicator, falling back to fsState === 'Stopped'. Fixes: Onboarding Wizard says array is running when it isn't
WalkthroughThe server identity update validation logic now checks both Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8236be82f7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const mdState = currentEmhttp.var?.mdState; | ||
| const fsState = currentEmhttp.var?.fsState; | ||
| if (fsState !== 'Stopped') { | ||
| const arrayStopped = mdState === ArrayState.STOPPED || fsState === 'Stopped'; |
There was a problem hiding this comment.
Gate rename on mdState before fsState fallback
The new arrayStopped check uses mdState === STOPPED || fsState === 'Stopped', which means a stale fsState value can still allow renaming even when mdState indicates the array is running. Since this change makes mdState the primary signal, fsState should only be consulted when mdState is unavailable; otherwise the guard can be bypassed in mixed-state conditions and the mutation may permit name changes while the array is effectively started.
Useful? React with 👍 / 👎.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1969 +/- ##
==========================================
+ Coverage 52.03% 52.05% +0.02%
==========================================
Files 1030 1030
Lines 71349 71352 +3
Branches 8057 8062 +5
==========================================
+ Hits 37125 37145 +20
+ Misses 34100 34083 -17
Partials 124 124 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This plugin has been deployed to Cloudflare R2 and is available for testing. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
api/src/unraid-api/graph/resolvers/servers/server.service.spec.ts (1)
114-114: Prefer a typed fixture over double casting in this mock return.
as unknown as ReturnType<...>weakens type safety in this test path. A typed fixture/helper would keep this strict without double casts.As per coding guidelines, "Avoid using casting whenever possible, prefer proper typing from the start".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@api/src/unraid-api/graph/resolvers/servers/server.service.spec.ts` at line 114, Replace the double-cast "as unknown as ReturnType<typeof getters.emhttp>" with a properly typed fixture: define a constant (e.g., emhttpFixture) typed as ReturnType<typeof getters.emhttp> and populate its fields to match the mocked shape, then return that fixture from the mock instead of casting; update the test file's mock return where the cast is used and reference the getter function name getters.emhttp to ensure the fixture type aligns exactly with the expected return type.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@api/src/unraid-api/graph/resolvers/servers/server.service.spec.ts`:
- Line 114: Replace the double-cast "as unknown as ReturnType<typeof
getters.emhttp>" with a properly typed fixture: define a constant (e.g.,
emhttpFixture) typed as ReturnType<typeof getters.emhttp> and populate its
fields to match the mocked shape, then return that fixture from the mock instead
of casting; update the test file's mock return where the cast is used and
reference the getter function name getters.emhttp to ensure the fixture type
aligns exactly with the expected return type.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0bb03a15-0d96-43b1-ba1e-05118f24db02
📒 Files selected for processing (2)
api/src/unraid-api/graph/resolvers/servers/server.service.spec.tsapi/src/unraid-api/graph/resolvers/servers/server.service.ts
Summary
UpdateServerIdentitymutation was checking onlyfsState(filesystem state) to determine if the array was stopped. During internal boot, the boot pool keepsfsStateasStartedeven when the disk array (mdState) isSTOPPED. Now checksmdState === ArrayState.STOPPEDas the primary indicator, falling back tofsState === 'Stopped'for backward compatibility.mdState=STOPPED+fsState=Startedshould allow server name changes.mdStateto existing test mock so the "array running" test explicitly asserts againstmdState=STARTED.Context
Bug report: "Onboarding Wizard: says array is running when it isn't" — tested on 7.3.0-beta.1.2 with Connect 2026.03.25.2146. After booting into internal boot, the onboarding wizard incorrectly blocked server name changes because the boot pool kept
fsStateasStartedeven though the array was stopped.Root cause: The boot pool (ZFS pool used for internal boot) runs its own filesystem layer, keeping
fsStateasStarted. The actual disk array state is tracked bymdState, which correctly showsSTOPPED.Test Coverage
Pre-Landing Review
No issues found.
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit