Skip to content

fix(workflow): follow identifier renames through downstream references#2612

Open
simlarsen wants to merge 1 commit into
feat/workflow-keyvalue-headersfrom
feat/workflow-rename-cascade
Open

fix(workflow): follow identifier renames through downstream references#2612
simlarsen wants to merge 1 commit into
feat/workflow-keyvalue-headersfrom
feat/workflow-rename-cascade

Conversation

@simlarsen

Copy link
Copy Markdown
Contributor

A correctness fix: renaming a step no longer silently breaks references to it. Stacked on #2611.

Problem

Renaming a step's identifier left every downstream {{local.components.<id>.returnValues.<rv>}} token pointing at the old id — a silent breakage (now visible as the red "broken reference" chips from #2604, but still broken).

Fix

Renames now cascade automatically on save.

  • Pure renameComponentReferences(nodes, oldId, newId) rewrites the tokens in every argument string. Matching includes the trailing .returnValues. so an id that's a prefix of another (slack-1 vs slack-10) is never mis-rewritten; unchanged nodes are returned by reference; it's a no-op when the id is unchanged/empty.
  • Wired into the settings-panel save path in Workflow.tsx: when the saved id differs from the one the panel opened with, the cascade runs across the graph (and autosaves).

Verification

  • renameComponentReferences (5 tests): rewrites a downstream ref; prefix-collision safety (slack-1 rename leaves slack-10 alone); multiple occurrences in one value; no-op for unchanged/empty id; untouched nodes kept by reference.
  • 87 workflow tests pass; tsc ✓, eslint ✓.

🤖 Generated with Claude Code

Renaming a step's identifier used to silently break every downstream
reference to it — the {{local.components.<id>.returnValues.<rv>}} tokens still
pointed at the old id (now visible as red "broken reference" chips). This
rewrites them automatically on save.

- Pure renameComponentReferences(nodes, oldId, newId) rewrites the tokens in
  every argument string. Matching includes the trailing ".returnValues." so an
  id that's a prefix of another (slack-1 vs slack-10) is never mis-rewritten;
  unchanged nodes are returned by reference; no-op when the id is unchanged.
- Wired into the settings panel's save path in Workflow.tsx: when the saved id
  differs from the one the panel opened with, the cascade runs across the
  graph.

Tests: rename rewrites a downstream ref, prefix-collision safety, multiple
occurrences per value, no-op cases, and untouched nodes kept by reference. 87
workflow tests pass; tsc + eslint clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@simlarsen

Copy link
Copy Markdown
Contributor Author

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

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.

2 participants