fix(drive): stop export polling on rate limits - #2192
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
🚧 Files skipped from review as they are similar to previous changes (8)
📝 WalkthroughWalkthroughDrive export creation and status polling now detect rate-limit errors, preserve typed error metadata, and return different retry guidance based on ticket availability. Tests and Drive documentation cover one-minute waits, ticket reuse, and exponential backoff. ChangesDrive export rate-limit recovery
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ExportCommand
participant DriveExport
participant DriveAPI
participant RecoveryHelper
participant TaskResult
ExportCommand->>DriveExport: create export task
DriveExport->>DriveAPI: submit export request
DriveAPI-->>DriveExport: rate-limit error
DriveExport->>RecoveryHelper: add creation retry guidance
RecoveryHelper-->>ExportCommand: wait and rerun export
TaskResult->>DriveAPI: poll existing ticket
DriveAPI-->>TaskResult: rate-limit error
TaskResult->>RecoveryHelper: add ticket retry guidance
RecoveryHelper-->>TaskResult: wait and retry with backoff
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
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_export_test.go`:
- Around line 1425-1431: Extend the recovery-helper tests to cover subtype-only
rate-limit classification and cause preservation when
appendDriveExportRecoveryHint handles a typed error. In
shortcuts/drive/drive_export_test.go:1425-1431, add this helper-level assertion;
retain shortcuts/drive/drive_export_test.go:1474-1480 as the separate 99991400
code-based contract; and in shortcuts/drive/drive_task_result_test.go:182-187,
reuse the helper coverage or add the equivalent subtype-only +task_result
assertion.
🪄 Autofix
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 Plus
Run ID: a94953e9-f745-4783-93ca-fe40e34d54fa
📒 Files selected for processing (9)
shortcuts/drive/drive_errors.goshortcuts/drive/drive_export.goshortcuts/drive/drive_export_common.goshortcuts/drive/drive_export_test.goshortcuts/drive/drive_task_result.goshortcuts/drive/drive_task_result_test.goskills/lark-drive/SKILL.mdskills/lark-drive/references/lark-drive-export.mdskills/lark-drive/references/lark-drive-task-result.md
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@c9014040e9e0f22519b319e85b879def5d57a447🧩 Skill updatenpx skills add larksuite/cli#fix/drive-export-rate-limit -y -g |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2192 +/- ##
==========================================
+ Coverage 75.85% 75.92% +0.06%
==========================================
Files 958 962 +4
Lines 101701 102197 +496
==========================================
+ Hits 77150 77591 +441
- Misses 18684 18716 +32
- Partials 5867 5890 +23 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
80d00d0 to
0aec299
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
fangshuyu-768
left a comment
There was a problem hiding this comment.
Reviewed the latest head c901404. Targeted Drive tests and the current CI suite pass; no remaining merge blockers.
Summary
Stop Drive export task polling immediately when OpenAPI returns
rate_limit/99991400, and give agents a task-aware one-minute backoff path.Changes
drive +task_result).Test Plan
go test ./shortcuts/drive -run '^(TestDriveExportCreateRateLimitSuggestsRetryingOriginalCommand|TestDriveExportRateLimitStopsPollingAndSuggestsOneMinuteBackoff|TestDriveExportRateLimitAfterObservedStatusReturnsError|TestDriveTaskResultExportRateLimitSuggestsOneMinuteBackoff)$' -count=1git diff --checktests/cli_e2e/drive/drive_export_dryrun_test.gocovers the unchangeddrive +exportrequest shape.Related Issues
Summary by CodeRabbit
Bug Fixes
Documentation