Skip to content

fix: deep-merge nested file-only properties in mergeJsonParameters#9419

Draft
bjbennet with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-code-review-suggestion
Draft

fix: deep-merge nested file-only properties in mergeJsonParameters#9419
bjbennet with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-code-review-suggestion

Conversation

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

mergeJsonParameters only performed a shallow merge, so file-only nested fields (e.g. metadata.description, properties.someField) were silently dropped whenever the parent key already existed in the designer output.

Changes

  • openDesignerForLocalProject.ts
    • Added deepMergeFileProperties(source, target) — recursively walks source (file param), copying absent properties into target (designer param) and recursing into nested plain objects
    • Added isPlainObject guard to correctly handle arrays as opaque values (designer wins)
    • Updated mergeJsonParameters to call deepMergeFileProperties instead of the old top-level-only loop
// Before: only top-level missing keys were preserved
for (const prop of Object.keys(fileParam)) {
  if (!(prop in defParam)) {
    defParam[prop] = fileParam[prop]; // nested fields inside existing keys dropped
  }
}

// After: full depth preserved
deepMergeFileProperties(fileParam, defParam);
// → recursively merges nested objects; designer values always take precedence

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

mergeJsonParameters shallow-merged parameters from the file into the designer output, only backfilling missing top-level properties. Nested file-only fields under an existing key (e.g. metadata, properties) were dropped. Replaced the shallow loop with a recursive deep-merge that preserves file-only fields at every nesting level while keeping designer values as the authoritative source.

Impact of Change

  • Users: Workflow parameter fields (e.g. metadata, custom nested properties) set in parameters.json are no longer silently dropped on save
  • Developers: None
  • System: None

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in:

Contributors

Screenshots/Videos

Copilot AI changed the title [WIP] Fix the code as per review comment fix: deep-merge nested file-only properties in mergeJsonParameters Jul 17, 2026
Copilot AI requested a review from bjbennet July 17, 2026 21:21
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