Skip to content

fix(dropbox): align integration with Dropbox API docs, add revision/sharing tools - #5468

Merged
waleedlatif1 merged 6 commits into
stagingfrom
validate/dropbox-integration
Jul 7, 2026
Merged

fix(dropbox): align integration with Dropbox API docs, add revision/sharing tools#5468
waleedlatif1 merged 6 commits into
stagingfrom
validate/dropbox-integration

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Fixed a real bug in search: Dropbox requires the root path be "", not "/" — our UI placeholder told users to type / for "search all" but the code never normalized it, so that literally errored against the live API (list_folder already had this fix, search didn't).
  • Fixed create_shared_link to return the existing link's metadata (including its URL) when Dropbox reports shared_link_already_exists with matching settings, instead of just erroring and telling the user to call a tool that didn't exist.
  • Fixed the upload route defaulting autorename to true when omitted — Dropbox's documented default is false, so this was a silent behavior deviation from the real API.
  • Added .trim() on all path/fromPath/toPath/rev params to guard against copy-pasted whitespace.
  • Marked nullable output fields (id, size, path_display, etc.) optional: true so folder/deleted-item responses don't imply file-only fields are always present.
  • Widened path_display/path_lower types to optional, matching the real Dropbox API response shape.
  • Added dropbox_list_shared_links, dropbox_list_revisions, and dropbox_restore tools + full block wiring — gaps flagged during the audit (revision history/version recovery, and a companion to Create Shared Link for looking up existing links, which our own error message already referenced but didn't provide).

Type of Change

  • Bug fix
  • New feature (3 new tools)

Testing

  • Verified every endpoint against the official Dropbox API v2 spec (dropbox/dropbox-api-spec) via 6 independent parallel audits, each covering a subset of the tools plus block wiring/backward-compatibility
  • tsc --noEmit clean, biome check clean
  • Confirmed all existing subBlock ids, tool ids, param names, and output keys are unchanged — this is purely additive plus the bug fixes above

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…haring tools
- fix search root-path bug: Dropbox requires "" not "/" for root, same fix already applied to list_folder
- fix create_shared_link to return the existing link's metadata (url) when Dropbox reports shared_link_already_exists with matching settings, instead of just erroring
- fix upload route autorename default (was true, Dropbox's documented default is false)
- trim() all path/fromPath/toPath/rev params to guard against copy-pasted whitespace
- mark nullable output fields (id, size, path_display, etc.) optional: true so folder/deleted items don't imply always-present file fields
- widen path_display/path_lower types to optional, matching the real API
- add dropbox_list_shared_links, dropbox_list_revisions, dropbox_restore tools + block wiring, filling gaps flagged during the audit (revision history/version recovery, and a companion to create_shared_link for looking up existing links)
@vercel

vercelBot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
docsSkippedSkippedJul 7, 2026 3:48pm

Request Review

@cursor

cursorBot commented Jul 7, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Upload default and search path fixes can change behavior for existing workflows that relied on the old defaults; restore overwrites file content, though changes are largely additive API-alignment fixes.

Overview
Aligns the Dropbox integration with API v2 behavior and extends the block with sharing and version-recovery operations.

Bug fixes: Search now maps a root scope of / to "" (matching list folder), so “search all” no longer fails against the live API. The upload route defaults autorename to false when omitted, matching Dropbox’s documented default instead of silently auto-renaming. Create Shared Link returns existing link metadata (including URL) when Dropbox responds with shared_link_already_exists and matching settings, instead of only erroring; mismatched settings still fail with guidance to use List Shared Links.

New capabilities: Adds dropbox_list_shared_links, dropbox_list_revisions, and dropbox_restore tools with full Dropbox block and registry wiring, plus a “recover file version” block skill. List shared links omits path when the user enters / so account-wide listing works per API semantics.

Hardening: Trims whitespace on path-related params across tools; widens types and marks several metadata output fields optional: true so folder/deleted responses don’t imply file-only fields are always present.

Reviewed by Cursor Bugbot for commit 3cb41c9. Configure here.

@greptile-apps

greptile-appsBot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes three confirmed Dropbox API compatibility bugs and adds three new tools (List Shared Links, List Revisions, Restore File) with full block and registry wiring. All changes are additive or corrective with no breaking changes to existing tool IDs, param names, or output keys.

  • Bug fixes: normalises search root-path "/""" (mirrors the existing list_folder fix), corrects autorename default to false, and surfaces embedded link metadata as a success response on shared_link_already_exists when settings match.
  • Defensive hardening: .trim() added to every path/fromPath/toPath/rev param across all tools; nullable output fields (id, size, path_display, path_lower) marked optional: true to reflect the real Dropbox API shape.
  • New tools: dropbox_list_shared_links, dropbox_list_revisions, and dropbox_restore follow the established pattern — typed params/responses in types.ts, tool config in their own file, exported from index.ts, registered in registry.ts, and wired into the block's operation picker, inputs, outputs, and tool-config switch.

Confidence Score: 5/5

Safe to merge — all changes are either targeted bug fixes verified against the Dropbox API spec or purely additive new tools.

The bug fixes address real, reproducible failures (search returning 400 on root path, autorename silently conflicting with the documented API default). The three new tools follow the established Dropbox tool pattern exactly — correct type definitions, proper error handling, consistent use of ?? defaults, and trimmed path inputs. Existing tool IDs, param names, and output keys are untouched, so there is no backward-compatibility risk.

No files require special attention. The create_shared_link existingLink check relies on Dropbox returning null for the settings-mismatch case, which the author verified against the live API.

Important Files Changed

FilenameOverview
apps/sim/tools/dropbox/create_shared_link.tsImproves shared_link_already_exists handling: extracts and surfaces the embedded link metadata as a success response when settings match, and refines the fallback error message for the settings-mismatch case. Path trimming added.
apps/sim/tools/dropbox/list_revisions.tsNew tool implementing files/list_revisions. Correctly maps path/limit/before_rev params, defaults limit to 10, and surfaces entries/isDeleted/hasMore from the response.
apps/sim/tools/dropbox/list_shared_links.tsNew tool implementing sharing/list_shared_links. Correctly omits the path field when '/' or '' is supplied to get account-wide results, and consistently uses ?? for boolean/array defaults.
apps/sim/tools/dropbox/restore.tsNew tool implementing files/restore. Sends path and rev (both trimmed), returns the FileMetadata response directly as metadata, consistent with the Dropbox endpoint that returns the struct directly.
apps/sim/blocks/blocks/dropbox.tsAdds three new operations (List Shared Links, List Revisions, Restore File) to the operation picker, input definitions, tool access list, routing switch, outputs map, and block prompts. A recovery workflow prompt is also added.
apps/sim/tools/dropbox/types.tsWidens path_display/path_lower to optional across all metadata interfaces (FileMetadata, FolderMetadata, DeletedMetadata), and adds correctly typed param/response interfaces for the three new tools.
apps/sim/app/api/tools/dropbox/upload/route.tsCorrects the autorename default from true to false, aligning with the Dropbox API documented default behaviour.
apps/sim/tools/dropbox/search.tsFixes root-path normalization bug: trims whitespace before comparing to '/', then maps '/' → '' per Dropbox API requirement that search paths be empty string for account-wide search.
apps/sim/tools/registry.tsRegisters three new Dropbox tools (list_shared_links, list_revisions, restore) with correct string keys. Existing registrations are unchanged.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant U as User/Block
participant LSL as list_shared_links
participant LR as list_revisions
participant R as restore
participant DB as Dropbox API
Note over U,DB: List Shared Links
U->>LSL: path? / cursor? / directOnly?
LSL->>DB: POST /sharing/list_shared_links (path omitted if / or empty)
DB-->>LSL: "{links, has_more, cursor?}"
LSL-->>U: "{links[], hasMore, cursor?}"
Note over U,DB: List Revisions
U->>LR: path (required), limit?, beforeRev?
LR->>DB: "POST /files/list_revisions {path, mode:path, limit, before_rev?}"
DB-->>LR: "{entries[], is_deleted, has_more}"
LR-->>U: "{entries[], isDeleted, hasMore}"
Note over U,DB: Restore File
U->>R: path (required), rev (required)
R->>DB: "POST /files/restore {path, rev}"
DB-->>R: FileMetadata
R-->>U: "{metadata}"
Note over U,DB: Create Shared Link (updated error path)
U->>DB: POST /sharing/create_shared_link_with_settings
DB-->>U: 409 shared_link_already_exists
alt existingLink present - settings match
U-->>U: "success=true, sharedLink=existingLink"
else existingLink null - settings differ
U-->>U: "success=false, error message"
end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant U as User/Block
participant LSL as list_shared_links
participant LR as list_revisions
participant R as restore
participant DB as Dropbox API
Note over U,DB: List Shared Links
U->>LSL: path? / cursor? / directOnly?
LSL->>DB: POST /sharing/list_shared_links (path omitted if / or empty)
DB-->>LSL: "{links, has_more, cursor?}"
LSL-->>U: "{links[], hasMore, cursor?}"
Note over U,DB: List Revisions
U->>LR: path (required), limit?, beforeRev?
LR->>DB: "POST /files/list_revisions {path, mode:path, limit, before_rev?}"
DB-->>LR: "{entries[], is_deleted, has_more}"
LR-->>U: "{entries[], isDeleted, hasMore}"
Note over U,DB: Restore File
U->>R: path (required), rev (required)
R->>DB: "POST /files/restore {path, rev}"
DB-->>R: FileMetadata
R-->>U: "{metadata}"
Note over U,DB: Create Shared Link (updated error path)
U->>DB: POST /sharing/create_shared_link_with_settings
DB-->>U: 409 shared_link_already_exists
alt existingLink present - settings match
U-->>U: "success=true, sharedLink=existingLink"
else existingLink null - settings differ
U-->>U: "success=false, error message"
end
Loading

Reviews (6): Last reviewed commit: "fix(dropbox): wire cursor pagination for..." | Re-trigger Greptile

Comment threadapps/sim/tools/dropbox/list_revisions.ts
Comment threadapps/sim/tools/dropbox/list_shared_links.ts
Comment threadapps/sim/tools/dropbox/list_shared_links.ts Outdated
…red_links
Consistency nit from Greptile review - matches the ?? pattern already used
by every other transformResponse in this PR.
@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile review

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 1e76782. Configure here.

…nsistency
Greptile flagged that path_display was left required in list_folder.ts and
list_revisions.ts despite being widened to optional in types.ts and most
other output schemas in this PR. Fixed those two plus create_folder.ts,
restore.ts, upload.ts, and list_shared_links.ts, which had the same gap.
@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile review

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

Comment threadapps/sim/tools/dropbox/create_shared_link.ts
Comment threadapps/sim/tools/dropbox/list_shared_links.ts Outdated
Comment threadapps/sim/tools/dropbox/list_revisions.ts Outdated
…tion
Cursor Bugbot flagged two real gaps:
- list_shared_links sent path: "" for root/all, but Dropbox only returns
every link account-wide when path is omitted entirely; "" scopes to the
root folder specifically. Now omits the field for root/empty/"/" input.
- list_revisions exposed hasMore but no way to actually fetch more pages
(Dropbox's before_rev cursor). Added a beforeRev param + advanced-mode
block field.
A third flagged issue (create_shared_link's error.shared_link_already_exists.metadata
path) was verified against the official sharing.stone spec and confirmed correct
as-is - replied on the PR thread with the citation, no change needed.
@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile review

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

Comment threadapps/sim/blocks/blocks/dropbox.ts
The prior fix read data.error.shared_link_already_exists.metadata, which
is wrong per Stone's own JSON serialization rules: a union member whose
payload is a struct (SharedLinkMetadata) flattens that struct's fields
alongside ".tag" rather than nesting under a wrapper key. The real shape
is data.error.shared_link_already_exists directly (with an extra ".tag"
field mixed in) - there is no nested .metadata key, so the existing-link
fast path never fired before this fix.
Also marks list_shared_links' expires output optional, matching every
other optional field in this PR and the SharedLinkMetadata spec.
@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile review

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

1 issue from previous review remains unresolved.

Fix All in Cursor

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e00b2d8. Configure here.

The dropbox_list_shared_links tool already accepted a cursor param, but the
block never exposed it, so a workflow couldn't page past the first batch
when hasMore was true. Adds an advanced-mode cursor subBlock + input entry,
mirroring List Revisions' beforeRev field added in the same PR.
@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile review

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 3cb41c9. Configure here.

@waleedlatif1
waleedlatif1 merged commit 0132a04 into stagingJul 7, 2026
18 checks passed
@waleedlatif1
waleedlatif1 deleted the validate/dropbox-integration branch July 7, 2026 15:57
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@waleedlatif1