Skip to content

shallow copy of input_params#745

Draft
s-ddavydenko wants to merge 2 commits into
microsoft:mainfrom
s-ddavydenko:main
Draft

shallow copy of input_params#745
s-ddavydenko wants to merge 2 commits into
microsoft:mainfrom
s-ddavydenko:main

Conversation

@s-ddavydenko
Copy link
Copy Markdown

@s-ddavydenko s-ddavydenko commented May 18, 2026

Draft: Avoid mutating input parameters during target submission

Summary

This PR updates target job submission so that default or provider-specific parameters are added to a copied input parameter dictionary instead of mutating the caller-provided dictionary directly.

Motivation

Currently, submitting a job can modify the original input_params dictionary passed by the caller. This can cause unexpected behavior when the same dictionary is reused for a later submission, because parameters added during the first submission remain present for the second one.

This is especially confusing when default parameters are meant to apply only to the outgoing job payload, not to the user's original Python object.

Changes

  • Create a deep copy of input_params before adding submission-specific/default parameters.
  • Preserve the original caller-provided dictionary and any nested structures passed in it.
  • Prevent reused input_params dictionaries from retaining parameters added during a previous submission.

Testing

  • Verified Target.submit does not mutate a caller-provided input_params dictionary when shots is passed separately.

  • Verified the same input_params dictionary can be reused across submissions without retaining SDK-added parameters.

  • Verified nested/inherited input_params structures remain unchanged.

  • Ran targeted real-job validation against quantinuum.sim.h2-1sc.

  • Unit tests not added; validation was performed with temporary targeted real-job repro tests.

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.

1 participant