Skip to content

feat(dub): expand link coverage and fix cross-operation param leakage#5469

Merged
waleedlatif1 merged 2 commits into
stagingfrom
dub-integration-validation
Jul 7, 2026
Merged

feat(dub): expand link coverage and fix cross-operation param leakage#5469
waleedlatif1 merged 2 commits into
stagingfrom
dub-integration-validation

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Ran a full /validate-integration pass on the dub.co integration against Dub's live API docs
  • Added tenantId, folderId, trackConversion support and a conversions output to link tools (create/update/upsert/get/list)
  • Added cursor pagination (startingAfter/endingBefore) to list_links, and a logo param to get_qr_code
  • Added new tools for API surface Sim didn't cover: list_domains, list_tags, create_tag, list_folders
  • Fixed a cross-operation param-leakage bug in the block's tools.config.params — several raw subBlock ids (domain, key, url, linkId, tagIds, tenantId, folderId, externalId, search, showArchived, page, pageSize) are shared across operations, so a value left in block state from a previously-selected operation could silently leak into the request for a different operation. Now explicitly cleared per operation.
  • Fixed trackConversion being sent as the literal string "false" instead of a boolean when unset

Type of Change

  • New feature / enhancement
  • Bug fix

Testing

Tested manually — bun run lint and tsc --noEmit both pass clean. Two independent parallel verification passes confirmed tool-layer correctness against live Dub docs and block↔tool wiring correctness.

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)

- add tenantId/folderId/trackConversion support and conversions output to link tools
- add cursor pagination (startingAfter/endingBefore) to list_links, logo param to get_qr_code
- add list_domains, list_tags, create_tag, list_folders tools
- fix block param leakage where an unset field on one operation inherited a stale value left over from another operation
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 7, 2026 3:20pm

Request Review

@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Cross-operation param clearing fixes real mis-request bugs; new outbound Dub API surface is additive but workflows may now send different payloads (tenant/folder/conversion flags).

Overview
Expands the Dub block and tools to match more of Dub’s API and tightens how block inputs map to tool requests.

New capabilities: Four operations—List Domains, List Tags, Create Tag, and List Folders—with matching tools, block sub-blocks, outputs, and registry wiring. Link create/update/upsert/get/list flows gain tenantId, folderId, trackConversion, and a conversions metric in responses. List Links adds tenant/folder filters and cursor params startingAfter / endingBefore. Get QR Code accepts an optional custom logo URL.

Fixes: The block’s tools.config.params now clears shared field names (domain, key, url, linkId, list pagination fields, etc.) when they don’t apply to the selected operation, so values from a prior operation don’t leak into the next request after the executor merges inputs. trackConversion from the UI dropdown is mapped to send only true or omit the field (avoiding "false" strings and accidental PATCH disable on updates).

Reviewed by Cursor Bugbot for commit 86cc363. Configure here.

Comment thread apps/sim/blocks/blocks/dub.ts Outdated
@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR expands the dub.co integration with four new tools (list_domains, list_tags, create_tag, list_folders), adds tenantId, folderId, trackConversion, and conversions fields to the existing link CRUD tools, introduces cursor pagination (startingAfter/endingBefore) to list_links, and fixes a cross-operation param-leakage bug in the block's transform layer. A logo param is also added to get_qr_code.

  • Leakage fix: The block's params() transform now explicitly undefined-clears all shared subBlock IDs for operations that don't use them, preventing stale values from a previously selected operation from polluting the active request.
  • trackConversion partial-update fix: The transform now emits true | undefined (never the boolean false) so that opening an update_link block with the default 'No' dropdown does not silently reset a link's conversion-tracking setting to off.
  • New tools: list_domains, list_tags, create_tag, and list_folders are wired end-to-end through the tool registry, block config, and types — following the same patterns as existing dub tools.

Confidence Score: 5/5

Safe to merge — all changed paths correctly wire block UI through the transform layer to tools, with no data integrity issues introduced.

Both issues flagged in the previous review round are resolved: trackConversion is now present in the non-mutation clearing block, and the transform emits true | undefined instead of true | false, so the default 'No' selection no longer sends a false payload to Dub's PATCH endpoint. The four new tools follow the established pattern exactly, and the leakage-clearing logic correctly uses explicit undefined assignment before per-operation re-population. No new unsafe code paths were introduced.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/dub.ts Central block config: correctly clears all shared subBlock IDs per operation, fixes trackConversion to emit `true
apps/sim/tools/dub/update_link.ts Adds tenantId, folderId, trackConversion params with correct !== undefined guard so false is only sent when explicitly provided by a direct caller, not silently from block default.
apps/sim/tools/dub/create_tag.ts New tool: correctly POSTs to /tags, handles error response, and returns id/name/color. Required name field and optional color wired through block and types.
apps/sim/tools/dub/list_domains.ts New tool: GETs /domains with optional archived/search/page/pageSize; returns passthrough domain array with count.
apps/sim/tools/dub/list_folders.ts New tool: GETs /folders with optional search/page/pageSize; returns passthrough folder array with count.
apps/sim/tools/dub/list_tags.ts New tool: GETs /tags with search/sortBy/sortOrder/page/pageSize; returns passthrough tag array with count.
apps/sim/tools/dub/list_links.ts Adds tenantId, folderId, startingAfter, endingBefore params and conversions/folderId/tenantId/trackConversion to the per-link output mapping.
apps/sim/tools/dub/types.ts Adds tenantId/folderId/trackConversion/conversions to DubLink and param interfaces; introduces four new param/response interfaces for the new tools. DubResponse union updated.
apps/sim/tools/dub/get_qr_code.ts Adds optional logo param appended to QR endpoint URL; correctly guarded with if (params.logo).
apps/sim/tools/registry.ts Correctly imports and registers the four new tools under their expected string keys.
apps/sim/tools/dub/index.ts Re-exports four new tools; imports are consistent with existing export naming convention.
apps/sim/tools/dub/upsert_link.ts Mirror of create_link changes — tenantId, folderId, trackConversion, conversions added consistently.
apps/sim/tools/dub/get_link.ts Adds folderId, tenantId, trackConversion, conversions to response mapping and output schema; no functional concerns.
apps/sim/tools/dub/create_link.ts Adds tenantId, folderId, trackConversion, and conversions to params, body construction, response mapping, and output schema consistently.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[DubBlock UI] -->|operation selected| B{params transform}
    B -->|isLinkMutation| C[Clear non-mutation fields\ndomain/key/url/linkId/search etc.]
    B -->|!isLinkMutation| D[Clear mutation fields\ndomain/key/title/desc/externalId\ntagIds/tenantId/folderId/trackConversion]
    C --> E{trackConversion dropdown}
    E -->|'true'| F[result.trackConversion = true]
    E -->|'false' default| G[result.trackConversion = undefined]
    F --> H[Tool receives boolean true]
    G --> I[Tool receives undefined\n→ NOT included in PATCH body]
    D --> J{operation branch}
    J -->|list_links| K[dub_list_links tool\n+ cursor pagination\nstartingAfter/endingBefore]
    J -->|list_domains| L[dub_list_domains tool\nGET /domains]
    J -->|list_tags| M[dub_list_tags tool\nGET /tags]
    J -->|create_tag| N[dub_create_tag tool\nPOST /tags]
    J -->|list_folders| O[dub_list_folders tool\nGET /folders]
    J -->|get_qr_code| P[dub_get_qr_code tool\n+ logo param]
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"}}}%%
flowchart TD
    A[DubBlock UI] -->|operation selected| B{params transform}
    B -->|isLinkMutation| C[Clear non-mutation fields\ndomain/key/url/linkId/search etc.]
    B -->|!isLinkMutation| D[Clear mutation fields\ndomain/key/title/desc/externalId\ntagIds/tenantId/folderId/trackConversion]
    C --> E{trackConversion dropdown}
    E -->|'true'| F[result.trackConversion = true]
    E -->|'false' default| G[result.trackConversion = undefined]
    F --> H[Tool receives boolean true]
    G --> I[Tool receives undefined\n→ NOT included in PATCH body]
    D --> J{operation branch}
    J -->|list_links| K[dub_list_links tool\n+ cursor pagination\nstartingAfter/endingBefore]
    J -->|list_domains| L[dub_list_domains tool\nGET /domains]
    J -->|list_tags| M[dub_list_tags tool\nGET /tags]
    J -->|create_tag| N[dub_create_tag tool\nPOST /tags]
    J -->|list_folders| O[dub_list_folders tool\nGET /folders]
    J -->|get_qr_code| P[dub_get_qr_code tool\n+ logo param]
Loading

Reviews (2): Last reviewed commit: "fix(dub): stop trackConversion from rese..." | Re-trigger Greptile

- only send trackConversion true or omit it, matching linkRewrite/linkArchived's partial-PATCH-safe pattern, so a routine update_link no longer silently disables conversion tracking on an existing link
- include trackConversion in the cross-operation reset block so it can't leak a stale value into non-mutation operations either
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

Addressed both Greptile findings in 86cc363:

  • P1 (trackConversion silently disables tracking on update_link): fixed — trackConversion now follows the same pattern as linkRewrite/linkArchived: only sent as true, otherwise omitted entirely (never an explicit false), so a routine update_link that doesn't touch this field can no longer silently reset conversion tracking to off.
  • P2 (trackConversion missing from the cross-operation reset block): fixed — added trackConversion to the !isLinkMutation reset alongside domain/key/tenantId/etc., so it can't leak a stale value into non-mutation operations even if a future tool starts reading it.

Re-triggering both reviews now.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot 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 86cc363. Configure here.

@waleedlatif1 waleedlatif1 merged commit 9e3fc1f into staging Jul 7, 2026
18 checks passed
@waleedlatif1 waleedlatif1 deleted the dub-integration-validation branch July 7, 2026 15:54
Sign up for free to 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