Skip to content

Conversation

@mozhou52
Copy link
Collaborator

@mozhou52 mozhou52 commented Jan 28, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Prevented accidental removal of critical OSS and NAS root storage mount points. Attempts to delete these roots are now blocked and the system provides guidance to use the appropriate OSS or NAS management console instead.

✏️ Tip: You can customize this high-level summary in your review settings.

@mozhou52 mozhou52 requested a review from rsonghuster January 28, 2026 07:47
@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

The change adds validation guards to the removeModel function to prevent accidental deletion of root OSS and NAS mount points. It introduces a NAS root regex and checks mount point states before allowing removal, directing users to delete root mounts via the appropriate console.

Changes

Cohort / File(s) Summary
Model Removal Guards
src/subCommands/model/model.ts
Added 21 lines implementing safeguards in removeModel: (1) NAS_ROOT_REGEX for NAS root detection, (2) OSS storage check that throws if bucketPath indicates root mount, (3) NAS storage check that throws if mount server matches root pattern. Prevents root mount deletion and directs users to the storage console.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

🐰 I sniffed the roots with careful delight,
A gentle guard to keep them tight,
No accidental vanish, no hasty toll,
I point to the console — that's the role. 🌿🔐

🚥 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 title accurately describes the main change: adding error guards to prevent deletion of root directories (OSS root and NAS root) in the removeModel function.
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

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

Copy link

@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: 2

🤖 Fix all issues with AI agents
In `@src/subCommands/model/model.ts`:
- Around line 112-120: The OSS root check incorrectly treats any non-empty
bucketPath as root because the condition uses
(processedOssMountPoints[0].bucketPath || processedOssMountPoints[0].bucketPath
=== '/'); update the guard around storage === 'oss' to explicitly detect
undefined/empty or the literal root by checking processedOssMountPoints[0]
exists and then (processedOssMountPoints[0].bucketPath === undefined ||
processedOssMountPoints[0].bucketPath === '' ||
processedOssMountPoints[0].bucketPath === '/'); throw the Error only in that
case so valid non-root bucketPath values (e.g., '/models/mymodel') are allowed
to proceed.
- Around line 110-111: NAS_ROOT_REGEX currently only matches China regions
because it hardcodes "cn-[a-z]+"; update the regex (symbol NAS_ROOT_REGEX in
model.ts) to accept any region token so non‑China domains (e.g., ap-southeast-1,
us-west-1) are matched. Replace the region part with a more general character
class such as [a-z0-9-]+ (for example change \.cn-[a-z]+\. to \.[a-z0-9-]+\.) so
the full pattern becomes something like
/^[\w-]+\.[a-z0-9-]+\.nas\.aliyuncs\.com:\/$/ and retain the rest of the pattern
and anchors.

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.

2 participants