Skip to content

fix(web): refresh internal boot onboarding state#1913

Merged
elibosley merged 4 commits intomainfrom
codex/internal-boot-onboarding-refresh
Mar 15, 2026
Merged

fix(web): refresh internal boot onboarding state#1913
elibosley merged 4 commits intomainfrom
codex/internal-boot-onboarding-refresh

Conversation

@elibosley
Copy link
Member

@elibosley elibosley commented Mar 15, 2026

Summary

  • fetch internal-boot onboarding visibility/context from the network so drive eligibility does not get stuck on stale Apollo cache
  • show drive serial numbers in internal-boot selection and summary labels instead of transient device names
  • update onboarding tests and generated GraphQL typings for the new query shape

Testing

  • pnpm codegen
  • pnpm test OnboardingInternalBootStep.test.ts
  • pnpm test OnboardingSummaryStep.test.ts

Summary by CodeRabbit

  • Tests

    • Updated tests and mocks to validate network-based loading and verify drive serial numbers appear in onboarding screens.
  • New Features

    • Onboarding step supports optional Skip/Back controls and a saving-state indicator.
  • Refactor

    • Onboarding now fetches boot context from the network for fresher data.
    • Boot context now surfaces disk serial numbers so drives are labeled with identifiable IDs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 15, 2026

Walkthrough

Adds disk serialNum to GetInternalBootContext, switches onboarding components to use generated GraphQL documents (GetInternalBootContextDocument / GetInternalBootStepVisibilityDocument) with network-only fetchPolicy, replaces local types with generated types, updates tests and expands OnboardingInternalBootStep Props.

Changes

Cohort / File(s) Summary
GraphQL schema & generated types
web/src/components/Onboarding/graphql/getInternalBootContext.query.ts, web/src/composables/gql/gql.ts, web/src/composables/gql/graphql.ts
Adds serialNum to disk selection in GetInternalBootContext; updates Documents mapping and graphql overloads/types so generated GetInternalBootContextQuery and GetInternalBootContextDocument include serialNum.
Onboarding components
web/src/components/Onboarding/OnboardingModal.vue, web/src/components/Onboarding/steps/OnboardingInternalBootStep.vue, web/src/components/Onboarding/steps/OnboardingSummaryStep.vue
Replaces internal query constants with generated Document nodes; changes fetchPolicy from cache-first to network-only; removes local internal-boot interfaces in favor of GetInternalBootContextQuery; computes displayId from serialNum/emhttpDeviceId/device; expands Props for OnboardingInternalBootStep (adds onSkip, onBack, showSkip, showBack, isSavingStep).
Tests
web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts, web/__test__/components/Onboarding/OnboardingSummaryStep.test.ts
Updates mocks to use GetInternalBootContextDocument, types GetInternalBootContextQuery; adds serialNum and DiskInterfaceType enum values to disk fixtures; exposes useQueryMock for Apollo mocking; adds/adjusts assertions for serial-number-based labels and fetchPolicy behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A tiny serial hops into view,
Documents swapped and types made new,
From cache to network the queries leap,
Tests updated, no bugs to keep,
I nibble code crumbs — a joyous chew!

🚥 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 PR title accurately summarizes the main objective: refreshing internal boot onboarding state by fetching from network instead of stale cache, which is the core change across all modified files.
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 (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/internal-boot-onboarding-refresh
📝 Coding Plan
  • Generate coding plan for human review comments

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

@codecov
Copy link

codecov bot commented Mar 15, 2026

Codecov Report

❌ Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 50.97%. Comparing base (36c56f7) to head (40ba1a0).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...ts/Onboarding/steps/OnboardingInternalBootStep.vue 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1913      +/-   ##
==========================================
+ Coverage   50.94%   50.97%   +0.02%     
==========================================
  Files        1023     1023              
  Lines       70542    70556      +14     
  Branches     7681     7699      +18     
==========================================
+ Hits        35941    35964      +23     
+ Misses      34477    34466      -11     
- Partials      124      126       +2     

☔ 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts (1)

436-438: ⚠️ Potential issue | 🟠 Major

Update stale label expectations to serial-based values.

Line 436 and Line 437 still assert old emhttpDeviceId labels, which now fail after switching UI labels to disk serials.

Proposed fix
-    expect(deviceSelect.text()).toContain('eligible-disk');
-    expect(deviceSelect.text()).toContain('usb-disk');
+    expect(deviceSelect.text()).toContain('ELIGIBLE-1');
+    expect(deviceSelect.text()).toContain('USB-1');
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts` around
lines 436 - 438, The test assertions in OnboardingInternalBootStep.test
reference old emhttpDeviceId labels ('eligible-disk', 'usb-disk', 'cache-disk');
update the three expectations to assert against the disk serial values used in
the test fixtures/mocks instead (use the serial fields from the mocked device
objects used in this test, e.g. the entries in the devices/mockDevices array or
the deviceFixtures referenced in the setup) so deviceSelect.text() checks for
the actual serial strings for the eligible and usb devices and does not contain
the cache device's serial.
web/__test__/components/Onboarding/OnboardingSummaryStep.test.ts (1)

1091-1105: ⚠️ Potential issue | 🟡 Minor

Fix test assertions to match the new displayId logic.

The pipeline is failing because the test expects 'diskA - 500 GB (sda)' but the component now displays the serialNum field ('DISK-A') per the new displayId priority logic (serialNum → emhttpDeviceId → device).

Since the test data at lines 325 and 332 sets serialNum: 'DISK-A' and serialNum: 'DISK-B', the assertions should match this behavior.

🐛 Proposed fix
     const { wrapper } = mountComponent();
 
-    expect(wrapper.text()).toContain('diskA - 500 GB (sda)');
-    expect(wrapper.text()).toContain('diskB - 250 GB (sdb)');
+    expect(wrapper.text()).toContain('DISK-A - 500 GB (sda)');
+    expect(wrapper.text()).toContain('DISK-B - 250 GB (sdb)');
   });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/__test__/components/Onboarding/OnboardingSummaryStep.test.ts` around
lines 1091 - 1105, Update the failing test assertions to expect the component's
new displayId priority (serialNum → emhttpDeviceId → device): in the test that
sets draftStore.internalBootSelection (uses serialNum 'DISK-A' and 'DISK-B'),
change the two expects on wrapper.text() to assert for 'DISK-A - 500 GB (sda)'
and 'DISK-B - 250 GB (sdb)' (keep the size and device name parts but replace the
leading device id with the serialNum values); locate the assertions in the test
case that calls mountComponent() and references draftStore and
internalBootSelection.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts`:
- Around line 436-438: The test assertions in OnboardingInternalBootStep.test
reference old emhttpDeviceId labels ('eligible-disk', 'usb-disk', 'cache-disk');
update the three expectations to assert against the disk serial values used in
the test fixtures/mocks instead (use the serial fields from the mocked device
objects used in this test, e.g. the entries in the devices/mockDevices array or
the deviceFixtures referenced in the setup) so deviceSelect.text() checks for
the actual serial strings for the eligible and usb devices and does not contain
the cache device's serial.

In `@web/__test__/components/Onboarding/OnboardingSummaryStep.test.ts`:
- Around line 1091-1105: Update the failing test assertions to expect the
component's new displayId priority (serialNum → emhttpDeviceId → device): in the
test that sets draftStore.internalBootSelection (uses serialNum 'DISK-A' and
'DISK-B'), change the two expects on wrapper.text() to assert for 'DISK-A - 500
GB (sda)' and 'DISK-B - 250 GB (sdb)' (keep the size and device name parts but
replace the leading device id with the serialNum values); locate the assertions
in the test case that calls mountComponent() and references draftStore and
internalBootSelection.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 959d0404-e98c-4886-8035-64c075780b08

📥 Commits

Reviewing files that changed from the base of the PR and between c3e9767 and fae627a.

📒 Files selected for processing (8)
  • web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts
  • web/__test__/components/Onboarding/OnboardingSummaryStep.test.ts
  • web/src/components/Onboarding/OnboardingModal.vue
  • web/src/components/Onboarding/graphql/getInternalBootContext.query.ts
  • web/src/components/Onboarding/steps/OnboardingInternalBootStep.vue
  • web/src/components/Onboarding/steps/OnboardingSummaryStep.vue
  • web/src/composables/gql/gql.ts
  • web/src/composables/gql/graphql.ts

@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/PR1913/dynamix.unraid.net.plg

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.

🧹 Nitpick comments (1)
web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts (1)

178-189: Consider whether this test is too implementation-focused.

This test verifies internal implementation details (exact query parameters and fetchPolicy) rather than observable behavior. Per coding guidelines, tests should focus on component behavior and output rather than implementation details.

A more behavior-focused alternative would test that fresh data is displayed after mount (e.g., by changing the mock result and verifying the component reflects it), rather than asserting on the exact useQuery call signature.

That said, verifying fetchPolicy: 'network-only' does validate an important PR requirement (fetching fresh data instead of using stale cache), so this may be acceptable as an exception.

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

In `@web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts` around
lines 178 - 189, The test is too implementation-focused by asserting the exact
useQuery call (useQueryMock with GetInternalBootContextDocument and
fetchPolicy), so either rewrite it to assert observable behavior (mountComponent
then change the mock response and assert the rendered output updates to reflect
fresh data), or if preserving the fetchPolicy assertion is required, add an
explanatory comment and keep a minimal behavior assertion as well; update the
test around mountComponent, useQueryMock, and GetInternalBootContextDocument to
verify rendered output changes for different mocked query results (or retain the
fetchPolicy check only with a comment noting the exception).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts`:
- Around line 178-189: The test is too implementation-focused by asserting the
exact useQuery call (useQueryMock with GetInternalBootContextDocument and
fetchPolicy), so either rewrite it to assert observable behavior (mountComponent
then change the mock response and assert the rendered output updates to reflect
fresh data), or if preserving the fetchPolicy assertion is required, add an
explanatory comment and keep a minimal behavior assertion as well; update the
test around mountComponent, useQueryMock, and GetInternalBootContextDocument to
verify rendered output changes for different mocked query results (or retain the
fetchPolicy check only with a comment noting the exception).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 97180410-9ec8-4614-8334-3066731794be

📥 Commits

Reviewing files that changed from the base of the PR and between fae627a and 40ba1a0.

📒 Files selected for processing (2)
  • web/__test__/components/Onboarding/OnboardingInternalBootStep.test.ts
  • web/__test__/components/Onboarding/OnboardingSummaryStep.test.ts

@elibosley elibosley merged commit 1ca2129 into main Mar 15, 2026
13 checks passed
@elibosley elibosley deleted the codex/internal-boot-onboarding-refresh branch March 15, 2026 20:51
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