fix(search): match block references by the name the canvas shows - #6779
Conversation
A block reference stores its target as the block's normalized name - lowercased with whitespace and dots stripped - so a block titled "Send Email" is written `<sendemail.content>`. Workflow search indexed that token as-is, so its searchable text never contained the block's actual name. Searching a name the way it reads on the card therefore found the block itself and none of its references, while the run-together form found the references and not the block. No single query could find both, and the run-together form is the one nothing in the UI ever shows. Resolve a reference's prefix back through the same helper that produced it, so the reference is searched under the name the block is titled with. `rawValue` is untouched, so the stored form keeps matching and the highlight and replace paths, which key off it, are unaffected. Environment references, system prefixes like `loop`, and references left behind by a deleted block resolve to no name and stay exactly as written.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview This PR maps normalized reference prefixes back to block titles via Legacy dot collisions (two blocks whose names normalize to the same prefix) follow the same rule as Reviewed by Cursor Bugbot for commit 39c12a0. Configure here. |
Greptile SummaryThe PR makes workflow references searchable by the target block name displayed on the canvas while preserving their stored token, range, and replacement behavior.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/workflows/search-replace/resources/references.ts | Adds reference-prefix indexing and display-name resolution while retaining unresolved and non-workflow reference text. |
| apps/sim/lib/workflows/search-replace/indexer.ts | Uses resolved block names as searchable reference text across ordinary and tool-input values without changing raw replacement coordinates. |
| apps/sim/lib/workflows/search-replace/indexer.test.ts | Adds focused regression tests for canvas-visible names, raw tokens, unresolved references, environment keys, and normalized-name collisions. |
Reviews (2): Last reviewed commit: "fix(search): keep the dot-free name on a..." | Re-trigger Greptile
…ision Creating or renaming a block enforces uniqueness at the normalized level, but legacy workflows can still hold two names that collide only now that `normalizeName` strips dots. `BlockResolver` settles that tie by letting the dot-free name keep ownership of the key, so previously working references never change targets. The prefix map took whichever block was iterated last instead, so search could name a reference after the dotted block while execution resolved it to the dot-free one - search reporting the wrong block, which is what this is meant to stop. Mirror the resolver's rule so both agree.
|
@cursor review |
There was a problem hiding this comment.
✅ 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 39c12a0. Configure here.
Summary
Send Emailis written<sendemail.content>, and the reference's searchable text never contained the block's actual name.Send Emailfound the block card and zero references; searchingsendemailfound the references and zero block cards. No single query found both, and the run-together form is the one nothing in the UI ever shows.normalizeName), so references are searched under the name the block is titled with.rawValueis untouched, so the stored form keeps matching and the highlight and replace paths, which key off it, are unaffected.{{KEY}}), system prefixes (loop,parallel,variable), and references left behind by a deleted block resolve to no name and stay exactly as written.Type of Change
Testing
bun run lint,bun run type-check,bun run check:audits(29 audits), and the block-registry check all pass.Checklist