feat(workflows): add IDE-style reference viewer for workflows#5852
feat(workflows): add IDE-style reference viewer for workflows#5852mzxchandra wants to merge 2 commits into
Conversation
Adds a "Show references" viewer so you can see how workflows connect:
which workflows call a given workflow ("Used by") and which workflows it
calls ("Uses"), rendered as recursive, clickable trees.
- Opened via Cmd/Ctrl+click on a sidebar workflow row and a "Show
references" context-menu item.
- Resolves references through both the workflow / workflow_input blocks
(reusing isWorkflowBlockType) and published custom blocks
(custom_block_* -> source workflow), scoped to the workspace.
- Builds the whole workspace reference graph once from live workflow_blocks
state; cycle-safe DFS marks A->B->A loops as (cycle) leaves.
- Contract-bound GET /api/workflows/[id]/references with workspace-level
authz; React Query hook gated to fetch only when the modal opens.
- Unit tests for the pure graph/tree logic (cycles, self-refs, dangling
drop, custom-block + workflow_input resolution) and route tests
(401/400/403/200).
|
@mzxchandra is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
PR SummaryLow Risk Overview A new The sidebar wires Show references in the workflow context menu and a Includes Reviewed by Cursor Bugbot for commit 1888e62. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR adds an IDE-style workflow reference viewer. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (2): Last reviewed commit: "fix(workflows): correct reference resolu..." | Re-trigger Greptile |
… cache, and graph size Addresses review findings on the reference viewer: - Resolve the workflow-block child via resolveActiveCanonicalValue (the shared SOT) instead of basic-first `||`, so an advanced-mode block whose old basic workflowId value lingers resolves to the active manual value. - Keep self-references (A -> A) and render them as a cycle leaf instead of dropping the edge, matching the cycle-safe viewer's purpose. - Set the references query staleTime to 0 so reopening the always-mounted modal refetches live editor state instead of serving a stale cached graph. - Bound converging paths: a node already expanded elsewhere in the tree is emitted once more as a plain leaf (edge stays visible) rather than re-expanded, so a densely reconverging graph can't grow exponentially.
|
@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 1888e62. Configure here.
|
Thanks so much for building this, @mzxchandra — the feature is great and both of your commits are preserved verbatim as the base of #5854, which layers an alignment pass on top (sibling-route authz via authorizeWorkflowByWorkspacePermission, tool-input call edges, native cmd+click restored, on-demand modal mounting, and design-token alignment). Closing this one in favor of #5854 so review lands in one place. |
Summary
Adds an IDE-style "Show references" viewer for workflows. Complex workflows increasingly call helper/child workflows (via the
workflow/workflow_inputblocks and published custom blocks), but there was no way to see how they connect. This adds a modal with two recursive, clickable trees:Nodes navigate to the referenced workflow on click.
Triggers: Cmd/Ctrl+click a sidebar workflow row, or the new "Show references" context-menu item.
Type of Change
How it works
workflow_blocksstate (what the sidebar/editor show).workflow+workflow_input, via the existingisWorkflowBlockType) and published custom blocks (custom_block_*-> bound source workflow), scoped to the workspace.A -> B -> Arenders as a(cycle)leaf and stops recursing (depth-capped as a backstop).GET /api/workflows/[id]/referenceswith workspace-level authz (auth before validation). React Query hook fetches only when the modal opens.Testing
bun run check:api-validationandcheck:react-querypass (contract-bound route + hook, no route-local Zod).tsc --noEmit: 0 errors.workflow_inputresolution, name sorting. Route tests: 401 / 400 / 403 / 200.sid -> child 1 -> child 2chain.Checklist