Skip to content

improvement(workflow-search): include block names in in-workflow search#4668

Merged
waleedlatif1 merged 2 commits into
stagingfrom
waleedlatif1/search-block-names
May 19, 2026
Merged

improvement(workflow-search): include block names in in-workflow search#4668
waleedlatif1 merged 2 commits into
stagingfrom
waleedlatif1/search-block-names

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

@waleedlatif1 waleedlatif1 commented May 19, 2026

Summary

  • Adds block names to the workflow search index — searching now matches against block names alongside subblock content.
  • When a block-name match is active, the block's title in the editor header gets the same orange highlight used for subblock labels.
  • Block-name matches are navigation-only (non-editable); existing replace flows are untouched.

Test plan

  • Open a workflow, press the search shortcut, type a substring of a block's name → block appears in match navigation.
  • Cycle to the block-name match → editor focuses the block and the title is highlighted.
  • Replace button is disabled while a block-name match is active.
  • Replace All still only operates on editable text/resource matches.
  • Existing subblock text and resource matches behave unchanged.

Adds block names to the workflow search index alongside subblock content. Selecting a block-name match navigates to the block and highlights its title in the editor header with the same orange treatment used for subblock labels.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 19, 2026 10:37pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 19, 2026

PR Summary

Medium Risk
Adds a new match target type (block-name) that flows through indexing, UI state, and editor rendering; moderate risk of regressions in search navigation/highlighting and replace eligibility handling.

Overview
Workflow search now indexes block names (new target.kind: 'block-name') when in text/all modes, producing navigation-only matches that are explicitly non-editable with a fixed reason.

The search UI and editor panel store now persist targetKind for the active match, and the editor header highlights the block title (using WORKFLOW_SEARCH_HIGHLIGHT_CLASS) when the active match is a block-name target while skipping subblock scroll-into-view for that case.

Adds/updates tests to cover block-name match indexing and to ensure these matches are excluded from resource-only searches.

Reviewed by Cursor Bugbot for commit 9cc335f. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 19, 2026

Greptile Summary

This PR extends the in-workflow search index to include block names, so typing a search query now matches block names in addition to subblock field content. Block-name matches are navigation-only (editable: false) and the Replace/Replace-Active button is correctly disabled when one is active.

  • Indexer: Before iterating subblock content for each block, block.name is scanned with findTextRanges and any hits are pushed as target: { kind: 'block-name' } matches with editable: false and navigable: true, consistent with locked/read-only match conventions.
  • Editor header: A new isBlockNameSearchHighlighted flag wraps the <h2> title in a <mark> with the shared orange highlight class when the active search target is a block-name match for the currently open block; the scroll-to-subblock useEffect also returns early for these matches.
  • Store & types: ActiveSearchTargetKind is now derived as WorkflowSearchTarget['kind'] (the fix landed in this commit per the previous thread), and a new targetKind field is propagated through handleSelectMatch.

Confidence Score: 5/5

Safe to merge — all changes are additive and isolated to the search index and editor header.

The block-name match path is gated behind editable: false and the replace plan builder skips non-editable matches, so there is no way for block names to be mutated through the replace flow. The activeSearchTarget is not persisted, removing any hydration risk from the new targetKind field. The deduplication logic already returns null scope keys for non-subblock targets, so block-name matches cannot accidentally collide with subblock matches during dedup.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/lib/workflows/search-replace/indexer.ts Adds block-name match generation before the subblock loop; correctly guards on mode !== 'resource', non-empty query, and string block.name. rawValue is the matched substring (consistent with addTextMatches at line 388).
apps/sim/lib/workflows/search-replace/types.ts Adds { kind: 'block-name' } to the WorkflowSearchTarget union; clean, minimal change.
apps/sim/stores/panel/editor/store.ts Derives ActiveSearchTargetKind from WorkflowSearchTarget['kind'] and adds the required targetKind field to ActiveSearchTarget. The field is not persisted (partialize excludes activeSearchTarget), so no hydration concerns.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/editor.tsx Adds isBlockNameSearchHighlighted flag and wraps the h2 title in a mark element when active; consistent with how sub-block.tsx highlights field titles. The scroll useEffect correctly short-circuits for block-name matches.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/search-replace/workflow-search-replace.tsx Passes targetKind through to the store in handleSelectMatch. Replace button remains correctly disabled for block-name matches because editable: false short-circuits canReplaceActive.
apps/sim/lib/workflows/search-replace/indexer.test.ts Two new test cases: verifies block-name matches appear with correct blockId/rawValue, are non-editable/navigable, and are excluded in resource-only mode.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[indexWorkflowSearchMatches] --> B{mode !== 'resource'
AND query non-empty?}
    B -->|Yes| C[findTextRanges on block.name]
    C --> D[Push block-name match
editable:false, navigable:true]
    B -->|No| E[Skip block-name indexing]
    D --> F[Continue to subflow/subblock indexing]
    E --> F

    G[handleSelectMatch] --> H[setActiveSearchTarget
with targetKind]
    H --> I{targetKind === 'block-name'?}
    I -->|Yes| J[isBlockNameSearchHighlighted = true
Skip subblock scroll]
    I -->|No| K[Normal subblock scroll/highlight]
    J --> L[Wrap title in mark element]

    M[Replace controls] --> N{activeMatch.editable?}
    N -->|false — block-name match| O[canReplaceActive = false
Replace button disabled]
    N -->|true| P[canReplaceActive evaluated normally]
Loading

Reviews (2): Last reviewed commit: "refactor(panel-store): derive ActiveSear..." | Re-trigger Greptile

Comment thread apps/sim/stores/panel/editor/store.ts Outdated
…rchTarget

Replaces the hand-maintained literal union with a derived type so adding a new target kind in search-replace/types.ts automatically propagates here.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 9cc335f. Configure here.

@waleedlatif1 waleedlatif1 merged commit d7d58ce into staging May 19, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/search-block-names branch May 19, 2026 22:44
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