fix(drive): improve token recognition for download and preview - #2680
fix(drive): improve token recognition for download and preview#2680wittam-01 wants to merge 1 commit into
Conversation
Change-Id: I70ea563448b445f3e11fb72f7ce8492f2ab8191d
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (11)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughDrive download and preview now perform best-effort entity-token lookup before execution. Wiki inputs use legacy node resolution only when lookup fails. Dry-run plans, scope handling, fallback behavior, entity validation, and end-to-end coverage were updated. ChangesDrive token resolution
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to The updated token-resolution paths preserve the intended fallback and scope behavior. Sequence Diagram(s)sequenceDiagram
participant CLI
participant resolveDriveFileSource
participant DriveAPI
participant WikiAPI
participant ContentAPI
CLI->>resolveDriveFileSource: resolve input token
resolveDriveFileSource->>DriveAPI: query_by_token
DriveAPI-->>resolveDriveFileSource: entity metadata
alt lookup succeeds
resolveDriveFileSource-->>CLI: resolved file token
else Wiki fallback required
resolveDriveFileSource->>WikiAPI: get_node
WikiAPI-->>resolveDriveFileSource: Wiki node token
resolveDriveFileSource-->>CLI: resolved Wiki file token
end
CLI->>ContentAPI: authorize and request content
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 59.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 10 files. (1 skipped: 1 unsupported.)
✨ 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 |
PR Quality SummaryCI did not complete successfully. Use the failed check links below to decide whether this PR needs a code change or a rerun. Failed checksdeterministic-gate
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@86dd0f0e110cb0d2dcfc2f7e5b5372be9b1f800c🧩 Skill updatenpx skills add larksuite/cli#fix/drive-token-recognition -y -g |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2680 +/- ##
==========================================
+ Coverage 76.23% 76.27% +0.03%
==========================================
Files 1120 1121 +1
Lines 127233 127253 +20
==========================================
+ Hits 96997 97063 +66
+ Misses 22429 22384 -45
+ Partials 7807 7806 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Improve token recognition for
drive +downloadanddrive +preview: a Wiki token supplied through--file-tokennow resolves to its underlying file instead of being sent to file APIs as a file token. Both commands share the same best-effort entity lookup and legacy fallback behavior.Changes
queryDriveTokenInfofor typed token identification and reuseresolveDriveFileSourceplus the source dry-run planner across download and preview.Test Plan
go test ./tests/cli_e2e/drive -run '^(TestDriveDownloadDryRun_EntityLookup|TestDrivePreviewDryRun_EntityLookup)$' -count=1 -v— 17 input/mode variants pass.make build, both shortcuts' help, changed-file formatting, andgit diff --checkpass.--file-token, explicit Wiki tokens, URLs, underlying file tokens, default naming, preview candidates, and converted text previews. PNG downloads match the source SHA-256; text previews contain the expected content. All four fixtures created for this run were deleted successfully.Full repository-wide unit tests, vet/lint/quality/license gates, and the complete live suite were not run locally; local validation was limited to the affected behavior.
Related Issues
Summary by CodeRabbit
New Features
Bug Fixes