Skip to content

Add checks on reserved names#2632

Open
SimonFair wants to merge 4 commits intounraid:masterfrom
SimonFair:ZFS-reserved-name-check-
Open

Add checks on reserved names#2632
SimonFair wants to merge 4 commits intounraid:masterfrom
SimonFair:ZFS-reserved-name-check-

Conversation

@SimonFair
Copy link
Copy Markdown
Contributor

@SimonFair SimonFair commented May 8, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved pool-name validation: trims input, uses case-insensitive comparisons, and supports prefix-style reserved entries (e.g., foo* blocks foo, foobar, etc.) including common prefixes like mirror/raidz/spare.
  • New Features

    • Added a client-side helper to centralize reserved-name checks.
    • Tightened UI rendering: BTRFS pool status shown only for top-level BTRFS pools; ZFS pool status summary shown only for actual pools.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 8, 2026

Review Change Stack
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: c650565e-4246-4311-9dda-92bd87a26705

📥 Commits

Reviewing files that changed from the base of the PR and between 0166772 and 71ab00e.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/DeviceInfo.page
🚧 Files skipped from review as they are similar to previous changes (1)
  • emhttp/plugins/dynamix/DeviceInfo.page

Walkthrough

A normalized helper is added to match reserved pool names with exact and *-suffix prefix rules; both pages now trim pool names early and use the helper in validate(poolname). PHP template checks were tightened so BTRFS and ZFS status sections only render for top-level pools.

Changes

Reserved Pool Name Validation Enhancement

Layer / File(s) Summary
Helper Function Definition
emhttp/plugins/dynamix/CacheDevices.page, emhttp/plugins/dynamix/DeviceInfo.page
New isReservedPoolName(poolname, reserved) trims and lowercases the candidate, checks exact matches and reserved entries ending in * as prefix matches, and recognizes a small set of reserved prefixes.
Validation Integration
emhttp/plugins/dynamix/CacheDevices.page, emhttp/plugins/dynamix/DeviceInfo.page
Both validate(poolname) functions trim the input early and replace reserved.includes(poolname) with isReservedPoolName(poolname, reserved); other validation steps are unchanged.
Template Conditional Tightening
emhttp/plugins/dynamix/DeviceInfo.page
BTRFS Pool Status form is emitted only when fsType('btrfs') and isPool($name); ZFS Pool Status Summary rendering now also requires isPool($name) in addition to existing checks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I trim and lower, hop in line,
Wildcards guard a name that's mine,
Templates peek where top pools play,
Validation tidy — hip hooray,
A little rabbit cheers the day 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add checks on reserved names' directly describes the main change: introducing validation logic to check against reserved pool names across both PHP and JavaScript files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2026.05.08.1101
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2632/webgui-pr-2632.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates
  • Post-merge behavior: This preview stays available after merge until preview storage expires or it is manually cleaned up

📝 Modified Files:

Click to expand file list
emhttp/plugins/dynamix/CacheDevices.page
emhttp/plugins/dynamix/DeviceInfo.page

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2632, or run:

plugin remove webgui-pr-2632

🤖 This comment is automatically generated and will be updated with each new push to this PR.

Copy link
Copy Markdown
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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@emhttp/plugins/dynamix/DeviceInfo.page`:
- Around line 203-210: The reserved-name check is incorrectly treating
non-wildcard entries as prefix matches; inside the reserved.some(...) anonymous
function (variables reservedName and name) change the non-wildcard branch to
require an exact match only (return name === reservedName) while preserving the
current wildcard branch (reservedName.endsWith('*') ->
name.startsWith(reservedName.slice(0, -1))). Ensure you still normalize case via
(entry || '').toLowerCase() and keep the early return for empty reservedName.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fc7affa6-0e02-40df-99de-5731549d3916

📥 Commits

Reviewing files that changed from the base of the PR and between c72475e and 4236ba4.

📒 Files selected for processing (2)
  • emhttp/plugins/dynamix/CacheDevices.page
  • emhttp/plugins/dynamix/DeviceInfo.page

Comment thread emhttp/plugins/dynamix/DeviceInfo.page
@SimonFair SimonFair marked this pull request as ready for review May 8, 2026 11:20
@SimonFair SimonFair added the 7.3 label May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant