Skip to content

Warn when finalize_options() overrides a property explicitly set by the user - #3182

Open
TsafrirA wants to merge 3 commits into
Qiskit:mainfrom
TsafrirA:ta-warn-on-overrides
Open

Warn when finalize_options() overrides a property explicitly set by the user#3182
TsafrirA wants to merge 3 commits into
Qiskit:mainfrom
TsafrirA:ta-warn-on-overrides

Conversation

@TsafrirA

@TsafrirA TsafrirA commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR adds a warning when finalize_options() overrides a field which was explicitly set by the user. It uses the recent transition to pydantic models which allow the distinction between defaults and values explicitly set by the user.

AI/LLM disclosure

  • I used the following tool to generate or modify code: IBM BOB

@TsafrirA
TsafrirA requested a review from SamFerracin August 7, 2026 05:13
@TsafrirA TsafrirA added the wrapper-estimator Related to WrapperEstimator label Aug 10, 2026
@TsafrirA

Copy link
Copy Markdown
Collaborator Author

@SamFerracin
I verified that legacy estimator silently overrides without erroring or warning, at least for this example:

estimator = EstimatorV2(backend)
estimator.options.resilience.pec_mitigation = True
estimator.options.twirling.enable_gates = False

The job runs and the metadata shows

 'twirling': {'enable_gates': True,
  'enable_measure': True,
  'num_randomizations': 'auto',
  'shots_per_randomization': 'auto',
  'interleave_randomizations': True,
  'strategy': 'active-accum'},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wrapper-estimator Related to WrapperEstimator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant