Skip to content

fix(search): disambiguate tables and knowledge bases by folder - #6192

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/table-kb-folder-disambiguation
Aug 2, 2026
Merged

fix(search): disambiguate tables and knowledge bases by folder#6192
waleedlatif1 merged 2 commits into
stagingfrom
fix/table-kb-folder-disambiguation

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #6190, which made the chat resource menus folder-aware. Same gap, three more surfaces:

  • Cmd-K search modal — tables and knowledge bases now show the folder breadcrumb workflows and files already had, and the folder text is searchable
  • Table + knowledge base sub-block selectors (workflow editor) — a name shared with another resource gets its folder path appended, matching what the workflow selector already did
  • Search-and-replace resource pickers — same treatment; these listed bare names too

Shared abstraction

Rather than a fourth copy of the logic:

  • collectDuplicateNames + disambiguateLabelByFolder moved into hooks/queries/utils/folder-tree.ts. The workflow selector's private buildDisambiguatedLabel/collectDuplicateNames are deleted — workflows, tables, KBs, and search-replace now share one rule
  • FolderPathSuffix + sameFolderPath extracted in the search modal — that breadcrumb markup and its memo comparator were already duplicated between the workflow and file rows
  • getFolderPathNames added next to the array-returning getFolderPath, collapsing three copies of the same "names, or undefined at root" dance in sidebar.tsx
  • FolderedItem is now the single declaration of the foldered-row shape; WorkflowItem extends it and FileItem aliases it

Bugs found while reviewing

  • Search ranking: folder text was concatenated into the primary fuzzy haystack, so an exact name match could be outranked by a resource whose folder happened to match, and deep paths were penalized by the length term. Now routed through filterAndCap's existing toExtra parameter, which exists for exactly this. Fixed for all four groups, not just the new two
  • Table selector: option labels are lowercased for display, so Leads and leads render identically but were not detected as a collision — neither got a folder suffix. Collisions are now detected on the lowercased form; the folder path keeps its authored casing
  • Row font weight: the file row used font-base (weight 420) while every other row inherits 400. Unified at 400 and the component now owns it, rather than a consumer passing a className
  • Sidebar's two new folder queries are gated on the tables/KB permission flags, so a workspace with those tabs hidden doesn't pay for them

Zoho Desk icon (second commit)

Separate commit in the same PR. The existing ZohoDeskIcon was a generic headset placeholder in currentColor — it never resembled Zoho. Replaced with the mark from Zoho's official logo (wordmark stripped, viewBox set to the mark's computed bounding box so it centers), and the tile moved #E42527#FFFFFF to match other brand-mark integrations. Docs regenerated.

Type of Change

  • Bug fix

Testing

  • 8 new unit tests for the shared primitives, mutation-checked so I know they can fail (3 red per mutation)
  • tsc, bun run lint:check, check:react-query, check:api-validation, check:bare-icons, check:icon-paths all pass
  • Not yet verified in a running app

Notes

  • The docs generator also wants to rewrite jira.mdx (deletes 126 lines of trigger Configuration tables) and file.mdx (stale file_compress description). Both are pre-existing drift unrelated to this change, and webhookSecret/jqlFilter still exist in triggers/jira/utils.ts — so that deletion looks like a generator regression, not a legitimate update. Excluded from this PR; worth a separate look before someone regenerates and loses it
  • Still flat, deliberately out of scope: copilot @-mention KB section (needs folderId threaded through its fetch layer), the markdown editor @-menu, and the Recently Deleted restore list

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)

The Cmd-K search modal listed tables and knowledge bases without the folder
breadcrumb workflows and files already showed, and the table, knowledge base,
and search-and-replace pickers in the workflow editor rendered bare names --
so two resources sharing a name in different folders were indistinguishable.

Extracts the disambiguation the workflow selector already did into shared
collectDuplicateNames + disambiguateLabelByFolder, and shares the search row's
folder breadcrumb and its memo comparator, which were duplicated between the
workflow and file rows.

Also routes folder text through filterAndCap's secondary-rank parameter rather
than concatenating it into the name, so an exact name match can no longer be
outranked by a folder that happens to fuzzy-match.
The icon was a generic headset placeholder drawn in currentColor, so it never
resembled Zoho at all. Replaces it with the mark from Zoho's official logo --
wordmark stripped, viewBox set to the mark's own bounding box so it centers --
and moves the tile to white, matching the other brand-mark integrations.
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
docs Building Building Preview Aug 2, 2026 7:01am

Request Review

@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
UI-only labeling, search ranking, and icon/docs branding; no auth, data, or API behavior changes.

Overview
Extends folder-aware naming beyond workflows to tables and knowledge bases across Cmd-K search, workflow editor selectors, and search-and-replace resource pickers. Shared helpers collectDuplicateNames and disambiguateLabelByFolder centralize the rule; workflow selector’s duplicate logic is removed in favor of the same utilities.

Cmd-K search shows folder breadcrumbs for tables and knowledge bases (like workflows/files), and folder segments are searchable via filterAndCap’s toExtra hook so name ranking isn’t skewed by long folder paths. FolderPathSuffix / sameFolderPath dedupe breadcrumb UI and memo comparisons; FolderedItem / getFolderPathNames reduce repeated sidebar path wiring.

Table selector still lowercases labels but detects collisions on the lowercased form so Leads / leads get folder suffixes.

Zoho Desk branding: ZohoDeskIcon replaced with the official green mark, tile bgColor #FFFFFF (block, docs, integrations JSON).

Reviewed by Cursor Bugbot for commit c3e6070. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR makes tables and knowledge bases folder-aware across Cmd-K search, workflow selectors, and search-and-replace pickers while consolidating shared folder-label utilities. It also corrects fuzzy-search ranking inputs and replaces the Zoho Desk placeholder icon with its branded mark.

  • Adds searchable folder breadcrumbs for table and knowledge-base search results.
  • Centralizes duplicate-name collection and folder-based label disambiguation.
  • Adds resource-specific folder queries and a shared folder-path-name helper.
  • Updates the Zoho Desk icon and generated integration metadata.

Confidence Score: 5/5

The PR appears safe to merge with no concrete blocking or independently actionable non-blocking issues identified.

The folder maps are keyed by resource type, hidden-resource queries and rows are gated consistently, folder paths are propagated through each intended surface, and shared disambiguation preserves the prior workflow-selector behavior while extending it to tables and knowledge bases.

Important Files Changed

Filename Overview
apps/sim/hooks/queries/utils/folder-tree.ts Adds tested shared primitives for detecting duplicate labels and appending resource folder paths.
apps/sim/hooks/queries/workflow-search-replace.ts Enriches table and knowledge-base replacement labels with resource-specific folder context.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx Loads permission-gated table and knowledge-base folder maps and supplies resolved paths to search rows.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/search-modal/search-modal.tsx Routes folder names through the secondary fuzzy-search field to preserve primary-name ranking.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/search-modal/components/command-items/command-items.tsx Consolidates folder breadcrumb rendering and memo comparison across folder-aware search rows.
apps/sim/hooks/selectors/providers/sim/selectors.ts Replaces private workflow-label helpers with the shared folder disambiguation primitives.
apps/sim/components/icons.tsx Replaces the generic Zoho Desk placeholder with a fixed-color branded SVG mark.
apps/docs/components/icons.tsx Mirrors the branded Zoho Desk icon update in the documentation application.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  F[Resource-specific folder maps] --> P[Resolve folder paths]
  R[Workflows, tables, knowledge bases, files] --> P
  P --> S[Cmd-K searchable breadcrumbs]
  P --> D[Duplicate-name disambiguation]
  D --> E[Editor selectors]
  D --> X[Search-and-replace pickers]
Loading

Reviews (1): Last reviewed commit: "fix(zoho-desk): use the real Zoho Desk m..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit 25e6091 into staging Aug 2, 2026
26 of 27 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/table-kb-folder-disambiguation branch August 2, 2026 07:04

@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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c3e6070. Configure here.

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