Skip to content

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

Merged
zhaojiaxing-coding merged 1 commit into
mainfrom
feat/drive-member-remove-shortcut
Aug 10, 2026
Merged

feat(drive): add +member-remove shortcut#1994
zhaojiaxing-coding merged 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

Test Plan

  • Unit (shortcuts/drive/drive_member_remove_test.go): request construction, query/body shaping, conditional output fields, typed validation errors, and API-error passthrough.
  • Dry-run E2E (tests/cli_e2e/drive/drive_member_remove_dryrun_test.go): exact DELETE method/URL/params/body per resource type, plus regression cases rejecting ambiguous multi-segment URLs, %2F-encoded separators, --type conflicts, and slash/comma-containing member IDs.
  • Live workflow E2E (tests/cli_e2e/drive/drive_member_remove_workflow_test.go): docx add→remove round trip, and a fixture-gated apps (Miaoda) add→remove round trip (LARK_CLI_E2E_DRIVE_APPS_TOKEN, skipped when unset) that only mutates a transient bot collaborator and reports cleanup failures via clie2e.ReportCleanupFailure.
  • Targeted package check: go test ./shortcuts/drive/ -run MemberRemove (pass), go vet ./shortcuts/drive/, gofmt -l (clean).

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
Description check ✅ Passed The description covers the summary, changes, test plan, and related issues, but omits the template's explicit Summary and Changes headings.
Linked Issues check ✅ Passed The description explicitly states that no related issues exist, and no objective requires an issue link.
Out of Scope Changes check ✅ Passed The implementation, tests, registry update, and documentation all support the stated member-removal shortcut objectives.
Title check ✅ Passed The title clearly and concisely identifies the new Drive +member-remove shortcut.
✨ 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@12a8709a03f50f019955608bdb71238143057c84

🧩 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 71.30045% with 64 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.39%. Comparing base (199762b) to head (12a8709).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/drive/drive_member_remove.go 71.17% 46 Missing and 18 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1994      +/-   ##
==========================================
+ Coverage   76.36%   76.39%   +0.03%     
==========================================
  Files        1011     1013       +2     
  Lines      111269   111788     +519     
==========================================
+ Hits        84970    85400     +430     
- Misses      19815    19878      +63     
- Partials     6484     6510      +26     

☔ 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
@zhaojiaxing-coding
zhaojiaxing-coding force-pushed the feat/drive-member-remove-shortcut branch from b8fc727 to 162e896 Compare July 22, 2026 14:46
@zhaojiaxing-coding
zhaojiaxing-coding force-pushed the feat/drive-member-remove-shortcut branch 2 times, most recently from 7675328 to da2c437 Compare August 7, 2026 08:12
Comment thread tests/cli_e2e/drive/drive_member_remove_workflow_test.go
@zhaojiaxing-coding
zhaojiaxing-coding force-pushed the feat/drive-member-remove-shortcut branch 2 times, most recently from 5bcb676 to 5bc85b6 Compare August 7, 2026 10:08
Comment thread shortcuts/drive/drive_member_remove.go Outdated
Comment thread tests/cli_e2e/drive/drive_member_remove_workflow_test.go Outdated
@zhaojiaxing-coding
zhaojiaxing-coding force-pushed the feat/drive-member-remove-shortcut branch 4 times, most recently from 6a16619 to 214abd8 Compare August 10, 2026 05:56
Comment thread shortcuts/drive/drive_member_remove.go
Comment thread tests/cli_e2e/drive/drive_member_remove_workflow_test.go Outdated
@zhaojiaxing-coding
zhaojiaxing-coding force-pushed the feat/drive-member-remove-shortcut branch from 214abd8 to 8fe0950 Compare August 10, 2026 11:59
Comment thread shortcuts/drive/drive_member_remove.go
Comment thread tests/cli_e2e/drive/drive_member_remove_workflow_test.go
@zhaojiaxing-coding
zhaojiaxing-coding force-pushed the feat/drive-member-remove-shortcut branch from 8fe0950 to 0540746 Compare August 10, 2026 12:28
Add drive +member-remove for removing one collaborator permission from Drive documents, files, folders, wiki nodes, and Miaoda apps. 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

- Accept Miaoda apps via /page/ URLs or explicit --type=apps

- 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 0540746 to 12a8709 Compare August 10, 2026 12:45
@zhaojiaxing-coding
zhaojiaxing-coding merged commit bd38b9b into main Aug 10, 2026
27 checks passed
@zhaojiaxing-coding
zhaojiaxing-coding deleted the feat/drive-member-remove-shortcut branch August 10, 2026 13:23
@liangshuo-1 liangshuo-1 mentioned this pull request Aug 11, 2026
3 tasks
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.

3 participants