Skip to content

fix: preserve registration device limits after refresh#1905

Merged
elibosley merged 1 commit intomainfrom
codex/fix-registration-device-limit
Mar 12, 2026
Merged

fix: preserve registration device limits after refresh#1905
elibosley merged 1 commit intomainfrom
codex/fix-registration-device-limit

Conversation

@elibosley
Copy link
Member

@elibosley elibosley commented Mar 12, 2026

Summary

  • normalize GraphQL registration type values before storing them in the web server store
  • derive device limits from a shared helper so enum-style types like UNLEASHED still map to unlimited devices
  • add regression coverage for the normalization and the unlimited attached storage devices text

Testing

  • pnpm --dir web test test/utils/registration.test.ts test/components/Registration.test.ts
  • pnpm --dir web type-check

Summary by CodeRabbit

  • New Features

    • Enhanced registration type display formatting for improved readability
    • Improved device limit handling across license types with proper support for unlimited devices
  • Tests

    • Added comprehensive test coverage for registration utilities and display logic

@elibosley elibosley requested a review from ljm42 March 12, 2026 19:10
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 12, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b5026934-c13e-4a57-8b0e-8ef94f1d1237

📥 Commits

Reviewing files that changed from the base of the PR and between 298da54 and b1066e0.

📒 Files selected for processing (4)
  • web/__test__/components/Registration.test.ts
  • web/__test__/utils/registration.test.ts
  • web/src/store/server.ts
  • web/src/utils/registration.ts

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


Walkthrough

A new registration utility module is introduced with functions for normalizing registration types and computing device limits. The server store is refactored to use these utilities instead of inline switch logic, with corresponding test coverage added.

Changes

Cohort / File(s) Summary
Registration Utilities
web/src/utils/registration.ts, web/__test__/utils/registration.test.ts
New utility module exports normalizeRegistrationType() and getRegistrationDeviceLimit() functions with private label and device limit mappings. Three test cases verify type normalization and device limit logic for various registration types.
Server Store Refactoring
web/src/store/server.ts
Imports and delegates regDevs computed value to getRegistrationDeviceLimit() utility, replacing switch logic. Normalizes incoming regTy data via normalizeRegistrationType() before assignment.
Component Test
web/__test__/components/Registration.test.ts
Adds test case validating "Attached Storage Devices" renders "8 out of unlimited devices" when license has no device cap.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A utility extracted, logic so neat,
Registration functions make refactoring sweet,
Device limits and types in their own happy place,
Tests validate all with a smile on my face! ✨

✨ 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/fix-registration-device-limit
📝 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 12, 2026

Codecov Report

❌ Patch coverage is 92.68293% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.81%. Comparing base (298da54) to head (b1066e0).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
web/src/utils/registration.ts 94.73% 1 Missing and 1 partial ⚠️
web/src/store/server.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1905      +/-   ##
==========================================
+ Coverage   50.77%   50.81%   +0.03%     
==========================================
  Files        1022     1023       +1     
  Lines       70513    70534      +21     
  Branches     7646     7649       +3     
==========================================
+ Hits        35806    35840      +34     
+ Misses      34584    34570      -14     
- Partials      123      124       +1     

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

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

@elibosley elibosley merged commit 234bfc7 into main Mar 12, 2026
12 of 13 checks passed
@elibosley elibosley deleted the codex/fix-registration-device-limit branch March 12, 2026 19:24
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