Skip to content

fix(pools): remove redundant hot-reload panel from decommission, add stripe geometry & failure alerts - #338

Merged
overtrue merged 2 commits into
mainfrom
fix/pool-expansion-ui-3412
Dec 5, 2026
Merged

overtrue merged 2 commits into
mainfrom
fix/pool-expansion-ui-3412

Conversation

@loverustfs

Copy link
Copy Markdown
Contributor

1. What Was Fixed

This PR cleans up pool lifecycle workflows and improves operational visibility across /pool-expand, /pool-decommission, and /rebalance:

  • Removed redundant hot-reload maintenance panel from /pool-decommission:
    • Removed <PoolMaintenancePanel mode="decommission" /> from app/(dashboard)/pool-decommission/page.tsx so pool decommission focuses exclusively on pool draining/clearing without duplicating the hot-expansion maintenance workflow.
    • Added a dedicated completion banner (Pool decommission completed) listing drained pool names that can be safely removed from cluster configuration while keeping surviving pools in order.
  • Uniform Erasure Stripe Geometry across all three pool pages:
    • Added formatPoolStripeGeometry() and findPoolGeometry() helpers in lib/pool-operations.ts (matching active pool geometry by trimmed pool command line with numeric poolIndex fallback, formatting as {setCount} x {drivesPerSet} (EC:{dataDrives}+{parityDrives}), or -- when unavailable).
    • Loaded maintenance status alongside pool overview/rebalance views via Promise.allSettled in lib/pool-decommission-load.ts, app/(dashboard)/pool-expand/page.tsx, and app/(dashboard)/rebalance/page.tsx so maintenance-status read errors degrade gracefully without blocking page load.
    • Rendered the Erasure Stripe Geometry column/field consistently in desktop tables, mobile cards, and the selected-pool summary banner across /pool-expand, /pool-decommission, and /rebalance, and reused formatPoolStripeGeometry() inside components/pools/maintenance-panel.tsx.
  • Visible inline failure & cross-operation conflict alerts:
    • Added persistent destructive inline alerts (actionError) in components/pools/maintenance-panel.tsx, app/(dashboard)/pool-decommission/page.tsx, and app/(dashboard)/rebalance/page.tsx so backend validation, preflight, hot-reload, start/stop, and decommission errors remain clearly visible alongside toast notifications.
    • Rendered detailed error lists (configReport.errors and preflightReport.errors) directly inside check/preflight failure alerts in PoolMaintenancePanel.
    • Added destructive Failed Status alerts when tracked decommission or rebalance tasks report backend failure messages.
    • Added cross-operation conflict guards and banners: active cluster maintenance mode now displays a destructive alert and disables starting decommission or rebalance; in-progress decommission displays an alert on /rebalance and blocks rebalance start (checking both pool.status === "decommissioning" and decommissionStatus).
  • Complete i18n coverage across all 15 locales:
    • Added 7 localized message keys across all 15 locale bundles (ar-MA, de-DE, en-US, es-ES, fr-FR, id-ID, it-IT, ja-JP, ko-KR, pt-BR, ru-RU, tr-TR, vi-VN, zh-CN, zh-TW), cleanly rebased onto main.

2. Testing & Implementation Steps

Automated Verification

Rebased onto origin/main (b6a829d), installed dependencies via pnpm install --frozen-lockfile, and ran the full Console verification suite:

  1. Targeted Pool Unit & Component Tests (64/64 passed):
    node --experimental-strip-types --import ./scripts/register-typescript-loader.mjs --test tests/lib/pool-*.test.{js,ts}
    • tests/lib/pool-maintenance.test.ts: validates formatPoolStripeGeometry() and findPoolGeometry() (multi-set, single-set, cmdLine match, poolIndex fallback, and empty/zeroed fallback).
    • tests/lib/pool-decommission-load.test.ts: validates graceful degradation when getMaintenanceStatus() rejects.
    • tests/lib/pool-decommission-page.test.js: verifies /pool-decommission excludes PoolMaintenancePanel and surfaces stripe geometry and conflict/failure alerts.
    • tests/lib/pool-expand-page.test.js: verifies /pool-expand integrates single-pool support, permission gating, actual stripe geometry, and maintenance panel.
    • tests/lib/pool-maintenance-components.test.ts: verifies PoolExpandPage renders Erasure Stripe Geometry (1 x 16 (EC:12+4)) and PoolMaintenancePanel renders visible destructive alerts on backend check, preflight, and hot-reload errors.
  2. Full Unit Test Suite (1353/1353 passed, including i18n-locales.test.js):
    pnpm run test:run
  3. TypeScript Type Check (0 errors):
    pnpm run type-check
  4. ESLint (0 errors):
    pnpm run lint
  5. Prettier Format Check (All matched files use Prettier code style!):
    pnpm run format:check
  6. Production Static Build (37/37 static routes built cleanly, including /pool-expand, /pool-decommission, and /rebalance):
    pnpm run build

Live Console Verification Steps

  1. Open /pool-expand on a cluster and verify each pool displays its actual Erasure Stripe Geometry (e.g., 1 x 16 (EC:12+4)) in both desktop table and mobile card views.
  2. Enter maintenance mode on /pool-expand, submit an invalid pool specification (e.g., mismatched stripe width or unreachable peer), and verify Check Configuration, Run Preflight Check, and Exit Maintenance & Hot-Reload surface persistent inline destructive alerts with detailed backend error messages.
  3. While maintenance mode is active, navigate to /pool-decommission and /rebalance and confirm the destructive Cluster maintenance mode is active alert is displayed and start actions are disabled.
  4. Exit maintenance mode and open /pool-decommission: confirm the redundant hot-reload maintenance panel is no longer rendered, Erasure Stripe Geometry is visible for every pool and in the selected pool header, and drained pools display the Pool decommission completed notice.
  5. Trigger a decommission task and verify /rebalance surfaces the Pool decommission is in progress alert and disables starting rebalance until decommission completes, while displaying stripe geometry uniformly across pools.

3. Results & Conclusions

  • All automated checks passed 100%: 1353/1353 unit tests (64/64 pool-specific tests), type-check, lint, format:check, and next build (37/37 static routes).
  • Operational UX improved: Operators now get consistent erasure stripe geometry visibility across /pool-expand, /pool-decommission, and /rebalance, clear non-ephemeral inline diagnostics on backend or preflight failures, strict cross-workflow conflict feedback between maintenance/decommission/rebalance, and a cleaner /pool-decommission page without duplicate hot-reload controls.

Checklist

  • Bug fix / UX improvement (non-breaking change)
  • Unit tests added/updated (1353/1353 passing)
  • Code follows project formatting, lint, and TypeScript rules
  • All commit messages and PR details are in English (Conventional Commits)
  • No new dependencies added

@loverustfs
loverustfs requested review from houseme, majinghe and overtrue and a balanced review from Copilot December 5, 2026 02:32
@loverustfs
loverustfs requested a review from cxymds December 5, 2026 02:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Failed maintenance-status reads can enable unsafe decommissioning or rebalancing, while 403 responses still redirect away from views intended to remain available.

3 open issues
What changed in this PR

Improves the Console’s pool lifecycle pages with consistent stripe geometry, clearer failure reporting, and operation-conflict guards.

Changes:

  • Removes the decommission maintenance panel and adds completion guidance.
  • Displays stripe geometry and persistent failure/conflict alerts.
  • Adds seven messages across 15 locales and expands regression coverage.
File Description
tests/​lib/​pool-maintenance.test.ts Tests geometry matching and formatting.
tests/​lib/​pool-maintenance-components.test.ts Tests geometry rendering and failure alerts.
tests/​lib/​pool-expand-page.test.js Updates page integration assertions.
tests/​lib/​pool-decommission-page.test.js Checks panel removal and new alerts.
tests/​lib/​pool-decommission-load.test.ts Tests maintenance-read failure handling.
lib/​pool-operations.ts Adds shared geometry helpers.
lib/​pool-decommission-load.ts Loads optional maintenance status.
i18n/​locales/​zh-TW.json Adds Traditional Chinese messages.
i18n/​locales/​zh-CN.json Adds Simplified Chinese messages.
i18n/​locales/​vi-VN.json Adds Vietnamese messages.
i18n/​locales/​tr-TR.json Adds Turkish messages.
i18n/​locales/​ru-RU.json Adds Russian messages.
i18n/​locales/​pt-BR.json Adds Brazilian Portuguese messages.
i18n/​locales/​ko-KR.json Adds Korean messages.
i18n/​locales/​ja-JP.json Adds Japanese messages.
i18n/​locales/​it-IT.json Adds Italian messages.
i18n/​locales/​id-ID.json Adds Indonesian messages.
i18n/​locales/​fr-FR.json Adds French messages.
i18n/​locales/​es-ES.json Adds Spanish messages.
i18n/​locales/​en-US.json Adds English messages.
i18n/​locales/​de-DE.json Adds German messages.
i18n/​locales/​ar-MA.json Adds Arabic messages.
components/​pools/​maintenance-panel.tsx Adds persistent errors and detailed validation feedback.
app/​(dashboard)/​rebalance/​page.tsx Adds geometry, conflict guards, and failure alerts.
app/​(dashboard)/​pool-expand/​page.tsx Displays geometry in tables and mobile cards.
app/​(dashboard)/​pool-decommission/​page.tsx Removes maintenance panel; adds geometry and lifecycle alerts.

Review effort: Balanced

className={className}
disabled={!canStartDecommission(row, selectionLocked, activePoolCount) || interactionLocked}
disabled={
!canStartDecommission(row, selectionLocked, activePoolCount) || interactionLocked || maintenanceActive
Comment thread app/(dashboard)/rebalance/page.tsx Outdated
)
const canStart =
!interactionLocked &&
!maintenanceActive &&
const view = await getRebalanceViewModel()
const [viewResult, maintenanceResult] = await Promise.allSettled([
getRebalanceViewModel(),
getMaintenanceStatus(),

@overtrue overtrue left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes on 265881a:

  1. Missing suppress403Redirect: true (hooks/use-pool-operations.ts:148-151): getMaintenanceStatus() calls api.get("/pools/maintenance/status") without { suppress403Redirect: true } (unlike its 5 sibling methods), causing lib/api-client.ts to redirect /rebalance or /pool-expand users lacking maintenance-read permission straight to /403/ before Promise.allSettled can degrade gracefully.
  2. Fail-open maintenance guards (lib/pool-decommission-load.ts, app/(dashboard)/pool-decommission/page.tsx, app/(dashboard)/rebalance/page.tsx): Rejected getMaintenanceStatus() calls reset maintenanceStatus to null (maintenanceActive = false), enabling Start Decommission / Start Rebalance when maintenance state is unverified and wiping out an already-detected active: true block on transient 5s poll/sync failures. Fail closed (or handle 403 explicitly without clearing known active maintenance) and surface an unavailable alert.

@overtrue overtrue left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Holding CHANGES_REQUESTED on 265881a0: no new commits since the prior review; suppress403Redirect and fail-closed maintenanceStatus blockers remain unaddressed.

…tus errors

Address PR #338 review blockers:
- Pass { suppress403Redirect: true } in usePoolOperations.getMaintenanceStatus()
  so optional maintenance-status reads on /rebalance, /pool-decommission, and
  /pool-expand degrade locally without triggering global /403/ redirects.
- Return settled maintenanceResult from loadPoolDecommissionData() instead of
  flattening rejections into null.
- Fail closed in PoolDecommissionPage and RebalancePage by requiring a
  successfully loaded, inactive maintenance status before enabling Start
  Decommission / Start Rebalance (both button state and imperative handleStart
  guards), while keeping pool overviews and Stop/Cancel controls available.
- Preserve previously detected active maintenance state and stripe geometry
  across transient poll/sync failures and surface a destructive Maintenance
  Status Unavailable alert with Refresh recovery.
- Add targeted unit, source-safety, and mounted component regression tests
  covering 403 suppression, fail-closed gating, active blocker preservation,
  stale dialog confirmation guards, and refresh recovery.

@overtrue overtrue left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@overtrue
overtrue merged commit ecde247 into main Dec 5, 2026
10 checks passed
@overtrue
overtrue deleted the fix/pool-expansion-ui-3412 branch December 5, 2026 11:26
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.

3 participants