fix(parity): resume continues from saved position instead of restarting - #2009
Conversation
emhttpd identifies parity-check actions by the form-field NAME, not the value. Posting `cmdCheck=Resume` falls through to the plain `cmdCheck` submit handler (start a fresh check), discarding the saved mdResyncPos and restarting the parity from byte 0. Realign the action map with the dynamic field names the Unraid web UI actually submits (see /usr/local/emhttp/plugins/dynamix/ ArrayOperation.page:330-338): pause -> cmdCheckPause: '' resume -> cmdCheckResume: '' cancel -> cmdCheckCancel: '' start -> cmdCheck: 'Check' (unchanged) Add a parity.service.spec.ts covering each state and a regression test that fails if `cmdCheck=Resume` is reintroduced. Closes unraid#1815
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR fixes parity check resume restarting from the beginning instead of continuing. The implementation switches ChangesParity Resume Field Naming
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Pull request overview
Fixes parity-check resume behavior so it continues from the saved mdResyncPos rather than restarting from byte 0, aligning the API’s emcmd payload with the Unraid web UI’s expected (name-based) form fields.
Changes:
- Update
ParityService.updateParityCheckto sendcmdCheckPause,cmdCheckResume, andcmdCheckCancel(empty values) instead of value-driven fields. - Add Vitest coverage for each parity-check state plus a regression test to prevent reintroducing
cmdCheck=Resume.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| api/src/unraid-api/graph/resolvers/array/parity.service.ts | Switches parity pause/resume/cancel commands to the Unraid web UI’s field-name-based payloads so resume doesn’t restart. |
| api/src/unraid-api/graph/resolvers/array/parity.service.spec.ts | Adds unit tests validating the exact emcmd payload for each parity action, including a regression for the resume bug. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2009 +/- ##
==========================================
+ Coverage 52.59% 52.68% +0.09%
==========================================
Files 1033 1033
Lines 71682 71688 +6
Branches 8181 8201 +20
==========================================
+ Hits 37698 37769 +71
+ Misses 33858 33793 -65
Partials 126 126 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🤖 I have created a release *beep* *boop* --- ## [4.35.0](v4.34.0...v4.35.0) (2026-05-29) ### Features * Add read-only network metrics API ([#2003](#2003)) ([a1d1eea](a1d1eea)) ### Bug Fixes * **cpu:** add legacy telemetry fallbacks ([#2011](#2011)) ([97f5425](97f5425)) * forked plugin publish workflow ([#2014](#2014)) ([eb60d4d](eb60d4d)) * **parity:** resume continues from saved position instead of restarting ([#2009](#2009)) ([329f66f](329f66f)) --- 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>
Fixes #1815.
Root cause
emhttpdidentifies parity-check actions by the form field NAME, not the value. The current resolver postscmdCheck=Resume, which falls through to the plaincmdChecksubmit handler (start a fresh check) and discardsmdResyncPos, so a resumed parity restarts from byte 0.The Unraid web UI submits dynamic field names with empty values (see
/usr/local/emhttp/plugins/dynamix/ArrayOperation.page:330-338):Fix
Realign
ParityService.updateParityCheckto match the web UI's field names:pauseandcancelpreviously usedcmdNoCheck=Pause/cmdNoCheck=Cancel, which seem to have worked via fallback handling in emhttpd — they're realigned here too so the API contract matches the web UI exactly.Tests
Adds
parity.service.spec.tscovering each state and a regression test that fails ifcmdCheck=Resumeis reintroduced. 8 tests pass.Manual verification
Tested live on Unraid 7.3.0 by patching the running bundle and exercising start → pause → resume via GraphQL:
mdResyncPosSummary by CodeRabbit
Bug Fixes
Tests