Skip to content

feat(drive): add +member-remove shortcut#1994

Open
zhaojiaxing-coding wants to merge 1 commit into
mainfrom
feat/drive-member-remove-shortcut
Open

feat(drive): add +member-remove shortcut#1994
zhaojiaxing-coding wants to merge 1 commit into
mainfrom
feat/drive-member-remove-shortcut

Conversation

@zhaojiaxing-coding

@zhaojiaxing-coding zhaojiaxing-coding commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Add a high-risk Drive shortcut for removing one collaborator permission through the permission member delete API. The command validates resource and member combinations, previews the exact DELETE request, and returns an auditable success receipt.

Key features:

  • Reuse existing Drive member target, member type, and wiki permission helpers without changing +member-add

  • Require explicit confirmation and reject unsupported bot department removal before the API call

  • Cover request shaping, typed errors, dry-run behavior, and the live add/remove workflow

Related Issues

  • None

Summary by CodeRabbit

  • New Features
    • Added drive +member-remove to remove exactly one collaborator’s Drive permission, with wiki-specific handling and structured progress/output.
    • Enforces strict validation and requires confirmation for real deletions.
  • Documentation
    • Added command reference and skill guidance for safe usage (--dry-run, parameter rules, and returned field meanings).
  • Tests
    • Added unit tests for request construction, conditional output fields, validation, and typed permission error passthrough.
    • Added CLI end-to-end coverage for dry-run and a successful user workflow.

@github-actions github-actions Bot added domain/ccm PR touches the ccm domain size/M Single-domain feat or fix with limited business impact labels Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds the drive +member-remove shortcut for removing one collaborator permission, including validation, DELETE request construction, structured output, registration, documentation, unit tests, dry-run tests, and an end-to-end workflow.

Changes

Drive member removal

Layer / File(s) Summary
Command contract and input validation
shortcuts/drive/drive_member_remove.go, shortcuts/drive/drive_member_remove_test.go
Defines request parameters, path encoding, input normalization, member constraints, wiki permission rules, and typed validation tests.
Shortcut execution and registration
shortcuts/drive/drive_member_remove.go, shortcuts/drive/shortcuts.go, shortcuts/drive/*_test.go
Executes the typed DELETE request, emits conditional structured output, registers +member-remove, and tests request, output, API error, and confirmation behavior.
Usage documentation and CLI workflows
skills/lark-drive/*, tests/cli_e2e/drive/drive_member_remove_*
Documents command usage and constraints, and verifies dry-run requests, invalid inputs, confirmation, and the user workflow.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant DriveMemberRemove
  participant DrivePermissionsAPI
  participant Output
  CLI->>DriveMemberRemove: submit validated removal command
  DriveMemberRemove->>DrivePermissionsAPI: DELETE collaborator permission
  DrivePermissionsAPI-->>DriveMemberRemove: response or typed API error
  DriveMemberRemove->>Output: emit structured removal result
Loading

Suggested labels: feature

Suggested reviewers: fangshuyu-768

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding the +member-remove shortcut.
Description check ✅ Passed It covers the summary, changes, and related issues, but the template's Test Plan section is missing.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/drive-member-remove-shortcut

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.

❤️ Share

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

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@162e896efc932b3bbd59c89106040b84d71488c2

🧩 Skill update

npx skills add larksuite/cli#feat/drive-member-remove-shortcut -y -g

@zhaojiaxing-coding
zhaojiaxing-coding force-pushed the feat/drive-member-remove-shortcut branch 2 times, most recently from 4936c2c to 6a48bda Compare July 21, 2026 16:46
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.08%. Comparing base (483aade) to head (b8fc727).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/drive/drive_member_remove.go 86.57% 14 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1994      +/-   ##
==========================================
+ Coverage   75.07%   75.08%   +0.01%     
==========================================
  Files         901      903       +2     
  Lines       95560    95965     +405     
==========================================
+ Hits        71739    72060     +321     
- Misses      18319    18369      +50     
- Partials     5502     5536      +34     

☔ View full report in Codecov by Harness.
📢 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 github-actions Bot added size/L Large or sensitive change across domains or core paths and removed size/M Single-domain feat or fix with limited business impact labels Jul 22, 2026
Add drive +member-remove for removing one collaborator permission from Drive documents, files, folders, and wiki nodes. The shortcut validates resource and member contracts before issuing the high-risk DELETE request, preserves structured CLI errors, and documents identity and wiki permission behavior.

Key features:

- Resolve resource type from supported URLs or require it for bare tokens

- Support user and bot identities with member-type-specific validation

- Require explicit confirmation and return stable removal metadata

- Reject unsupported slash-containing tokens and member IDs before API calls

- Add unit, dry-run E2E, live workflow, and skill documentation coverage
@zhaojiaxing-coding
zhaojiaxing-coding force-pushed the feat/drive-member-remove-shortcut branch from b8fc727 to 162e896 Compare July 22, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/ccm PR touches the ccm domain size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant