Skip to content

fix(designer): Copied set variables missing dropdown values#9393

Merged
lambrianmsft merged 3 commits into
Azure:mainfrom
lambrianmsft:lambrian/set_variable_dropdown_fix
Jul 14, 2026
Merged

fix(designer): Copied set variables missing dropdown values#9393
lambrianmsft merged 3 commits into
Azure:mainfrom
lambrianmsft:lambrian/set_variable_dropdown_fix

Conversation

@lambrianmsft

Copy link
Copy Markdown
Contributor

Commit Type

  • feature - New functionality
  • fix - Bug fix
  • refactor - Code restructuring without behavior change
  • perf - Performance improvement
  • docs - Documentation update
  • test - Test-related changes
  • chore - Maintenance/tooling

Risk Level

  • Low - Minor changes, limited scope
  • Medium - Moderate changes, some user impact
  • High - Major changes, significant user/system impact

What & Why

TL;DR: When a Condition scope containing a SetVariable (or any variablename-editor action) is copy-pasted elsewhere in the workflow, the pasted action's Name dropdown was empty. Customers had to drop into code view to reference the variable.

Root cause: pasteScopeOperation gathers the paste-site upstream slice into pasteParams.existingOutputTokens, but initializeOperationMetadata did not forward those ids into initializeOutputTokensForOperations (the 5th nodeIdsToRefresh arg defaulted to []). Each pasted node's upstreamNodeIds therefore only contained fragment-internal predecessors — missing the outer InitializeVariable — so getAvailableVariables(variables, upstreamNodeIds) returned nothing and the dropdown was empty.

Fixes:

  1. operationdeserializer.ts (both libs/designer and libs/designer-v2) — forward Object.keys(pasteParams.existingOutputTokens) as the 5th arg so pasted nodes inherit the paste-site upstream slice.
  2. parametersTab/index.tsx — safety fallback in getEditorAndOptions variablename branch: when the scoped list is empty but variables are declared elsewhere, show all declared variables filtered by supportedTypes. The runtime does not scope variable assignments by graph position, so any declared variable is legally assignable. This preserves the ideal UX when the scoped list is non-empty; it only prevents an empty-dropdown dead-end.

Applied identically to designer and designer-v2 since the customer's app renders through /v2.

Impact of Change

  • Users: Pasted SetVariable/IncrementVariable/DecrementVariable/AppendToStringVariable/AppendToArrayVariable actions inside a copied scope now show their variable options in the Name dropdown, matching the behavior of a freshly-added action. No workaround via code view required.
  • Developers: initializeOutputTokensForOperations is now exported from operationdeserializer.ts (v1 + v2) for regression coverage. No breaking API changes; the added 5th arg is optional and defaults to [].
  • System: No performance or architectural impact. Change is confined to the paste path (pasteParams is only non-null during paste) and a guarded empty-list fallback in one editor resolver.

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in: Standalone designer at [https://localhost:4200/v2](https://localhost:4200/v2%60) — copied a Condition containing a Set Variable, pasted into the else-branch of another Condition, opened the pasted Set Variable; Name dropdown populated correctly. Full designer test suite: 183/183 (v1) and 127/127 (v2) passing.

New/updated tests:

  • New: libs/designer/src/lib/core/actions/bjsworkflow/__test__/operationdeserializer.spec.ts — covers the existingOutputTokens plumbing (with-ids and default-empty paths).
  • Extended: libs/designer/src/lib/ui/panel/nodeDetailsPanel/tabs/parametersTab/__test__/getEditorAndOptions.spec.ts — parameterized fallback tests across all 5 variablename operations (setVariable, increment/decrement, appendToString/Array) plus a regression asserting the fallback does NOT alter behavior when scopedOptions is non-empty.

Contributors

Screenshots/Videos

Copilot AI review requested due to automatic review settings July 13, 2026 20:49
@lambrianmsft lambrianmsft force-pushed the lambrian/set_variable_dropdown_fix branch from dce77a4 to 5aeaafc Compare July 13, 2026 20:50
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

🤖 AI PR Validation Report

PR Review Results

Thank you for your submission! Here's detailed feedback on your PR title and body compliance:

PR Title

  • Current: fix(designer): Copied set variables missing dropdown values
  • Issue: None — uses a valid fix(scope): prefix and clearly describes the bug being fixed.
  • Recommendation: No change needed.

Commit Type

  • Exactly one type selected: fix.
  • Matches the title prefix and the nature of the change (bug fix for empty variable dropdown on paste).

Risk Level

  • Exactly one box selected (Low) and the risk:low label matches the body selection. This matches my advised estimate of low: the change is a guarded bug fix confined to the paste path (pasteParams is only non-null during paste) plus an empty-list fallback in one editor resolver. It does not touch logic-apps-shared, auth/security, or public API in a breaking way (the new 5th arg is optional). Well-scoped and correctly declared.

What & Why

  • Current: Detailed TL;DR, root cause, and enumerated fixes.
  • Issue: None — excellent, specific explanation of the bug and the fix.
  • Recommendation: No change needed.

Impact of Change

  • All three audiences addressed (Users, Developers, System).
  • Recommendation:
    • Users: Already covered — pasted variable actions now populate the Name dropdown.
    • Developers: Already covered — initializeOutputTokensForOperations now exported; optional 5th arg, no breaking change.
    • System: Already covered — no perf/architecture impact, change confined to paste path.

Test Plan

  • Unit tests added/updated in both designer and designer-v2 (new operationdeserializer.spec.ts covering the existingOutputTokens plumbing, and extended getEditorAndOptions.spec.ts including a no-regression case). Manual testing also documented. Test check passes.

⚠️ Contributors

  • Author listed; Reviewers line is still a placeholder. Add reviewers and credit any PMs/designers before merge. Non-blocking.

⚠️ Screenshots/Videos

  • The change affects a user-visible dropdown in libs/designer/src and libs/designer-v2/src, but it is a data-population fix rather than a styling change, and unit + manual coverage is described. Consider adding a quick before/after screenshot or GIF of the populated Name dropdown to aid reviewers. Non-blocking.

Summary Table

Section Status Recommendation
Title No change needed
Commit Type No change needed
Risk Level Correctly declared as low
What & Why No change needed
Impact of Change No change needed
Test Plan Unit tests present
Contributors ⚠️ Add reviewers before merge
Screenshots/Videos ⚠️ Optional: add before/after dropdown image

✅ This PR passes all required checks and is clear to merge. Two non-blocking nudges: add reviewers and consider a before/after screenshot of the populated dropdown.


Powered by: Copilot CLI (claude-opus-4.8) | Last updated: Tue, 14 Jul 2026 15:16:03 GMT

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a copy/paste regression in the Logic Apps designer where pasted variable-setting actions (e.g., SetVariable) could lose their upstream-variable context, resulting in an empty variable-name dropdown. The change updates the paste metadata/token initialization path and adds a guarded UI fallback to avoid an empty-dropdown dead end.

Changes:

  • Forward paste-site upstream token node IDs into initializeOutputTokensForOperations so pasted nodes inherit the correct upstream slice.
  • Add a fallback for the variablename editor: when scoped variable options are empty, fall back to all declared variables (filtered by supportedTypes).
  • Add/extend unit tests (v1) to cover the new plumbing and the dropdown fallback behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
libs/designer/src/lib/ui/panel/nodeDetailsPanel/tabs/parametersTab/index.tsx Adds fallback logic for variable-name dropdown options when scoped list is empty.
libs/designer/src/lib/ui/panel/nodeDetailsPanel/tabs/parametersTab/test/getEditorAndOptions.spec.ts Adds tests covering fallback behavior and non-regression when scoped options exist.
libs/designer/src/lib/core/actions/bjsworkflow/operationdeserializer.ts Forwards existingOutputTokens keys into token initialization and exports helper for testing.
libs/designer/src/lib/core/actions/bjsworkflow/test/operationdeserializer.spec.ts Adds regression coverage for existingOutputTokens plumbing (minor comment cleanup needed).
libs/designer-v2/src/lib/ui/panel/nodeDetailsPanel/tabs/parametersTab/index.tsx Mirrors the variable dropdown fallback behavior in designer-v2.
libs/designer-v2/src/lib/core/actions/bjsworkflow/operationdeserializer.ts Mirrors paste-site upstream token forwarding and exports helper in designer-v2.

…ition scope

When a Condition (or other scope) containing an InitializeVariable-referencing
Set Variable is copy-pasted into another location, the pasted Set Variable's
Name dropdown was empty. Root cause: pasteScopeOperation passes the paste-site
upstream slice via pasteParams.existingOutputTokens, but initializeOperationMetadata
was not forwarding those upstream node ids into initializeOutputTokensForOperations
(defaulted to []), so each pasted node's upstreamNodeIds only contained
fragment-internal predecessors -- missing the outer InitializeVariable.

Fixes:
 * Forward Object.keys(pasteParams.existingOutputTokens) as the 5th arg to
   initializeOutputTokensForOperations so pasted nodes inherit the paste-site
   upstream slice.
 * Add a safety fallback in getEditorAndOptions: when the scoped variable list
   is empty but variables are declared elsewhere, show all declared variables
   filtered by supportedTypes. The runtime does not scope variable assignments
   by graph position, so any declared variable is legally assignable.
 * Applied identically to designer-v2 (which is what the customer's app renders).

Tests:
 * New operationdeserializer.spec.ts covers the pasteParams plumbing.
 * getEditorAndOptions.spec.ts extended with parameterized fallback tests
   across all 5 variablename operations.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: af9ea0d5-71e4-45d9-9790-0edc869beadd
@lambrianmsft lambrianmsft force-pushed the lambrian/set_variable_dropdown_fix branch from 5aeaafc to a113e64 Compare July 13, 2026 22:08
@github-actions

Copy link
Copy Markdown
Contributor

AI PR Validation Report

Issues Found

  • Risk Label missing (risk:low, risk:medium, or risk:high)

Please update your PR to match the template. The check re-runs automatically on edit.

Last updated: Mon, 13 Jul 2026 22:10:32 GMT | Copilot unavailable, using deterministic checks

@lambrianmsft lambrianmsft added the risk:low Low risk change with minimal impact label Jul 13, 2026
@lambrianmsft lambrianmsft merged commit 2640de7 into Azure:main Jul 14, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-validated risk:low Low risk change with minimal impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants