deprecation: warn on JaqcdProgram submission to local simulators (MCM-150287739)#380
Closed
jacofeld wants to merge 1 commit into
Closed
deprecation: warn on JaqcdProgram submission to local simulators (MCM-150287739)#380jacofeld wants to merge 1 commit into
jacofeld wants to merge 1 commit into
Conversation
…-150287739)
Amazon Braket service devices no longer accept JAQCD program submissions.
LocalSimulator runs entirely offline so it can keep accepting JAQCD
programs through the migration window, but it now emits a UserWarning
telling customers to migrate to OpenQASMProgram. JAQCD support will be
removed in a future release.
Changes:
* src/braket/default_simulator/simulator.py: in BaseLocalSimulator.run,
add an explicit isinstance(circuit_ir, JaqcdProgram) branch before the
fallthrough to run_jaqcd that emits a UserWarning referencing
MCM-150287739. Added a `.. deprecated:: 1.39.4` Sphinx directive to
the run() docstring.
* setup.cfg: add a pytest filterwarnings rule that ignores the new
JAQCD-deprecation warning during the test session. Many existing
parametrized tests deliberately exercise the JAQCD code path
(test_simulator_run_grcs_8[Jaqcd], test_simulator_run_no_results_no_shots,
etc.) and emitting 29+ identical deprecation warnings would just be
noise. The new tests in test_simulator.py use pytest.warns() directly,
which overrides this filter.
What is intentionally NOT changed:
* run_jaqcd() — still works, programs still execute.
* state_vector_simulator.py and density_matrix_simulator.py
properties.action["braket.ir.jaqcd.program"] — preserved so cached
capability documents on customer machines continue to deserialize
correctly through amazon-braket-schemas-python.
Test changes:
* test/unit_tests/braket/default_simulator/test_simulator.py: new tests
- test_run_jaqcd_emits_warning: positive assertion via pytest.warns
- test_run_openqasm_no_jaqcd_warning: negative assertion that the
OpenQASM path stays silent.
UserWarning (not DeprecationWarning) is used deliberately: PEP 565's
default filter hides DeprecationWarning from any code attributed
outside __main__, which would silently hide the warning from
customer code that runs Braket via helper functions or libraries.
UserWarning is visible by default and matches every existing
warnings.warn call site in this package (e.g. the existing
"qubit_count is deprecated" warning at simulator.py:949).
See MCM-150287739.
This was referenced Jun 1, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #380 +/- ##
===========================================
- Coverage 100.00% 99.97% -0.03%
===========================================
Files 49 49
Lines 4882 4884 +2
Branches 561 562 +1
===========================================
+ Hits 4882 4883 +1
- Partials 0 1 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Closing — replacing with a clean version that does not reference internal tracking IDs. No action needed from reviewers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue, if available
Internal: MCM-150287739 (Simulators broker migration removes JAQCD from Braket service device capabilities).
Coordinated deprecation across three Braket OSS Python packages:
Description of changes
Amazon Braket service devices no longer accept JAQCD program submissions.
LocalSimulatoris offline (it doesn't depend on the service) so it can keep accepting JAQCD programs through the migration window — but it now emits aUserWarningtelling customers to migrate toOpenQASMProgram. JAQCD support will be removed in a follow-up CR after a release cycle of warnings.Code changes
src/braket/default_simulator/simulator.py:BaseLocalSimulator.run(), add anisinstance(circuit_ir, JaqcdProgram)branch before the fallthrough torun_jaqcdthat emits aUserWarningreferencing MCM-150287739... deprecated:: 1.39.4Sphinx directive to therun()docstring.setup.cfg: added a pytestfilterwarningsrule that ignores the new JAQCD warning during the test session — see "Why a session-level filter?" below.What is intentionally NOT changed
run_jaqcd()and the JAQCD execution path remain fully functional. Customer code submitting JAQCD continues to run; only the warning is new.state_vector_simulator.pyanddensity_matrix_simulator.pyproperties.action[\"braket.ir.jaqcd.program\"]blocks are preserved. Cached capability documents on customer machines continue to deserialize correctly throughamazon-braket-schemas. The hard-removal CR will revisit these.Why a session-level filter (not per-test wraps)
Many existing parametrized tests deliberately exercise the JAQCD code path (e.g.
test_simulator_run_grcs_8[Jaqcd],test_simulator_run_no_results_no_shots, etc.) — wrapping each call site inpytest.warns(UserWarning)would create churn across multiple files and risks missing a call site.Instead,
setup.cfgadds:This silences only this specific warning message in the test session. The new positive-assertion test (
test_run_jaqcd_emits_warning) usespytest.warns()which overrides this filter, so the warning contract is still verified.Why
UserWarningand notDeprecationWarningDeprecationWarningis suppressed by default (PEP 565) for any warning attributed outside__main__. That hides it from customer code that wraps Braket calls in helper functions or libraries — exactly the cases we need to reach.UserWarningis visible by default and matches the existingwarnings.warncall site in this package (e.g. thequbit_count is deprecatedwarning atsimulator.py:949, which also usesUserWarning).Testing done
New tests in
test/unit_tests/braket/default_simulator/test_simulator.py:test_run_jaqcd_emits_warning— positive assertion usingpytest.warns(UserWarning, match=\"JaqcdProgram\").test_run_openqasm_no_jaqcd_warning— negative assertion that the OpenQASM path stays silent (filters by message rather than erroring on allUserWarningso unrelated warnings like the density-matrix noise advisory don't false-fail).Manual verification (visible-by-default warning, runs successfully):
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.