feat(drive): add quick mode to status diff#870
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a ChangesQuick-mode detection for drive +status command
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
b64d8cf to
de237d6
Compare
3f4e468 to
82b41b4
Compare
de237d6 to
336eeaf
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@shortcuts/drive/drive_status_test.go`:
- Around line 213-233: The test currently verifies buckets by substring matching
against the whole output string; change it to decode the stdout JSON into a Go
structure (e.g., unmarshal into map[string][]struct{RelPath string
`json:"rel_path"` FileToken string `json:"file_token"`}) and then, inside the
loop over checks, assert that the specific bucket key exists and contains an
entry whose rel_path equals c.path and whose file_token equals c.token (when
c.token != ""). Update the same pattern at the other occurrence referenced
(lines ~280-282) so each assertion checks membership per-bucket in the parsed
JSON rather than using strings.Contains on the entire output.
In `@skills/lark-drive/SKILL.md`:
- Line 232: The markdown table row for the `+status` skill contains an unescaped
pipe inside the inline code span (`detection=exact|quick`) which breaks table
parsing; update that cell in SKILL.md (the `+status` row) to escape the pipe
(e.g., `detection=exact\|quick`) or replace the inline span with an alternative
notation (e.g., `detection=exact`/`quick` or using `|`) so the table
renders correctly and MD056 is resolved.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: d8ae35ee-1fb4-4919-8eca-cf88c02c7111
📒 Files selected for processing (6)
shortcuts/drive/drive_status.goshortcuts/drive/drive_status_test.goskills/lark-drive/SKILL.mdskills/lark-drive/references/lark-drive-status.mdtests/cli_e2e/drive/drive_status_dryrun_test.gotests/cli_e2e/drive/drive_status_workflow_test.go
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #870 +/- ##
==========================================
+ Coverage 65.89% 65.91% +0.01%
==========================================
Files 518 520 +2
Lines 48945 49269 +324
==========================================
+ Hits 32254 32474 +220
- Misses 13921 14021 +100
- Partials 2770 2774 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@4bafcd1a7f025daa798d6ec9111c0783144e1e0d🧩 Skill updatenpx skills add larksuite/cli#feat/drive-status-quick -y -g |
be00d3d to
cdf5bde
Compare
There was a problem hiding this comment.
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 `@shortcuts/drive/drive_status.go`:
- Line 61: DriveStatus.Scopes currently lists only
"drive:drive.metadata:readonly" but the default command flow requires
"drive:file:download" (quick mode is opt-in), so update the declared scopes on
DriveStatus (and the similar set around lines 106-109) to include
"drive:file:download" as well, or alternatively change the default behavior to
make quick mode the default; specifically modify the DriveStatus.Scopes slice to
include both "drive:drive.metadata:readonly" and "drive:file:download" (or flip
the default mode flag so the static scopes match the new default) so runtime
auth won't fail after provisioning.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5c569339-5e6d-4658-a7c4-9ba016cfe074
📒 Files selected for processing (2)
shortcuts/drive/drive_status.goshortcuts/drive/drive_status_test.go
There was a problem hiding this comment.
♻️ Duplicate comments (1)
skills/lark-drive/SKILL.md (1)
232-232:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winEscape the pipe character to fix table parsing.
The unescaped
|indetection=exact|quickis being interpreted as a table column delimiter, breaking the markdown table structure and causing the MD056 linting warning.🔧 Proposed fix
-| [`+status`](references/lark-drive-status.md) | Compare a local directory with a Drive folder by exact SHA-256 hash by default, or use `--quick` for a best-effort modified-time diff that skips remote downloads; reports `new_local` / `new_remote` / `modified` / `unchanged` plus `detection=exact|quick`. Duplicate remote `rel_path` conflicts fail fast with `error.type=duplicate_remote_path` and list every conflicting entry; do not proceed as if one was chosen. `--local-dir` 必须是 cwd 内的相对路径,越界路径 CLI 会直接拒绝;目标在 cwd 外时引导用户切换 agent 工作目录,不要私自 `cd` 绕过。 | +| [`+status`](references/lark-drive-status.md) | Compare a local directory with a Drive folder by exact SHA-256 hash by default, or use `--quick` for a best-effort modified-time diff that skips remote downloads; reports `new_local` / `new_remote` / `modified` / `unchanged` plus `detection` (`exact` or `quick`). Duplicate remote `rel_path` conflicts fail fast with `error.type=duplicate_remote_path` and list every conflicting entry; do not proceed as if one was chosen. `--local-dir` 必须是 cwd 内的相对路径,越界路径 CLI 会直接拒绝;目标在 cwd 外时引导用户切换 agent 工作目录,不要私自 `cd` 绕过。 |🤖 Prompt for 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. In `@skills/lark-drive/SKILL.md` at line 232, The table cell containing "detection=exact|quick" is breaking MD table parsing; update the `+status` table entry in SKILL.md to escape the pipe inside that string (e.g., change `detection=exact|quick` to `detection=exact\|quick` or use the HTML entity `detection=exact|quick`) so the pipe is not treated as a column separator and the MD056 lint warning is resolved.
🤖 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.
Duplicate comments:
In `@skills/lark-drive/SKILL.md`:
- Line 232: The table cell containing "detection=exact|quick" is breaking MD
table parsing; update the `+status` table entry in SKILL.md to escape the pipe
inside that string (e.g., change `detection=exact|quick` to
`detection=exact\|quick` or use the HTML entity `detection=exact|quick`) so
the pipe is not treated as a column separator and the MD056 lint warning is
resolved.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 04dbcb39-a01e-425d-9bdf-3e3a669ee449
📒 Files selected for processing (6)
shortcuts/drive/drive_status.goshortcuts/drive/drive_status_test.goskills/lark-drive/SKILL.mdskills/lark-drive/references/lark-drive-status.mdtests/cli_e2e/drive/drive_status_dryrun_test.gotests/cli_e2e/drive/drive_status_workflow_test.go
✅ Files skipped from review due to trivial changes (1)
- skills/lark-drive/references/lark-drive-status.md
🚧 Files skipped from review as they are similar to previous changes (4)
- tests/cli_e2e/drive/drive_status_workflow_test.go
- tests/cli_e2e/drive/drive_status_dryrun_test.go
- shortcuts/drive/drive_status_test.go
- shortcuts/drive/drive_status.go
efa9e31 to
97d89bc
Compare
97d89bc to
4bafcd1
Compare
Summary
Add a follow-up quick mode to drive +status on top of the modified-time smart sync PR. This keeps the default exact SHA-256 diff intact while adding a best-effort metadata-only path that avoids downloading remote bytes for files present on both sides.
Changes
Test Plan
Related Issues
Summary by CodeRabbit
New Features
Behavior
Documentation
Tests