fix(feishu): drive info finds files past the first page#104190
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 12, 2026, 12:19 AM ET / 04:19 UTC. Summary PR surface: Source +49, Tests +131, Docs +7. Total +187 across 4 files. Reproducibility: yes. at source level with high confidence: current main makes one root-list request and searches only that response, matching the canonical issue’s later-page failure path. This read-only review did not run a live failing current-main tenant scenario. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge the direct metadata lookup with its narrow shortcut and missing-scope fallback, then close the linked canonical issue once the PR lands. Do we have a high-confidence way to reproduce the issue? Yes at source level with high confidence: current main makes one root-list request and searches only that response, matching the canonical issue’s later-page failure path. This read-only review did not run a live failing current-main tenant scenario. Is this the best way to solve the issue? Yes. Direct token-and-type metadata lookup is narrower and more capable than paginating directory listings, and the exact pinned SDK contract supports the request, result normalization, shortcut exception, and permission fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ef13c2fe98fc. Label changesLabel justifications:
Evidence reviewedPR surface: Source +49, Tests +131, Docs +7. Total +187 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (5 earlier review cycles)
|
6d73b88 to
5373f3a
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
5373f3a to
9b1fec0
Compare
9b1fec0 to
69cb320
Compare
69cb320 to
c582bc2
Compare
|
Merged via squash.
|
) Co-authored-by: destire-mio <[email protected]>
Closes #93928
What Problem This Solves
Fixes an issue where Feishu users running
feishu_drive inforeceivedFile not foundfor files that were not present on the first page of the root drive listing.Why This Change Was Made
Drive info now queries Feishu's metadata API directly by file token and type instead of searching a single root-list response. Shortcut lookups retain the existing root-list behavior because the metadata endpoint does not support the shortcut type, and installations without the metadata scope fall back to the legacy lookup for compatibility.
User Impact
Users can retrieve metadata for supported files regardless of the containing shared folder or root-list page. Existing read-only installations continue to support root-level info lookups, while direct lookups require
drive:drive.metadata:readonlyor the fulldrive:drivescope.Evidence
pnpm test extensions/feishu/src/drive.test.ts— 24 tests passedpnpm test:extension feishu— 79 files and 1,123 tests passedgit diff --checkpassedRedacted live Feishu proof
Validated on July 11, 2026 with an enabled enterprise app using application-identity
drive:drive.metadata:readonly. No App Secret, tenant token, file token, title, owner ID, or URL is included below.For an existing wiki document, Feishu resolved the wiki token to its underlying document metadata:
{"httpStatus":200,"code":0,"metasCount":1,"returnedType":"docx","tokenLength":27,"hasTitle":true,"hasUrl":true,"requestType":"wiki","requestTokenMatches":true}The PR's exact direct lookup shape was then used with that underlying
docxtoken:{"httpStatus":200,"code":0,"metasCount":1,"tokenMatched":true,"returnedType":"docx","hasTitle":true,"hasUrl":true,"hasOwner":true,"hasCreateTime":true,"hasModifyTime":true}The same app does not have the legacy root-list scope, so the old root request returned HTTP 400 / Feishu code
99991672, while the direct metadata request above succeeded. This confirms direct info lookup works independently with the documented metadata-only scope.An invalid
docxtoken returned HTTP 200 with top-levelcode: 0, an emptymetasarray, and this per-document failure:{"failed_list":[{"code":970005,"token":"<redacted-invalid-token>"}]}The missing-file regression test now mirrors that observed
failed_listshape and confirms the tool reportsFile not found. Shortcut behavior and the legacy read-only fallback remain covered by focused mocked SDK tests; no existing app with exactlydrive:drive:readonlyand without metadata scope was available for a live fallback test.After rebasing onto current
main, production/test type checks are blocked by pre-existing errors inextensions/feishu/src/presentation-card.ts(renderMessagePresentationTableFallbackTextmissing and an unrelatedselect/tablecomparison). This PR does not modify that file.