Skip to content

Comments

Return a single results object instead of always a list - IonQ#7285

Merged
mhucka merged 33 commits intoquantumlib:mainfrom
splch:scalar-or-list-results
Dec 9, 2025
Merged

Return a single results object instead of always a list - IonQ#7285
mhucka merged 33 commits intoquantumlib:mainfrom
splch:scalar-or-list-results

Conversation

@splch
Copy link
Contributor

@splch splch commented Apr 18, 2025

ionq results api can return a list of results or a single result, so this change allows for either a list or single element to be returned from the results endpoint

@splch splch requested review from a team, dabacon and vtomole as code owners April 18, 2025 21:04
@codecov
Copy link

codecov bot commented Apr 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.56%. Comparing base (c3e676c) to head (747749b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7285      +/-   ##
==========================================
- Coverage   99.57%   99.56%   -0.01%     
==========================================
  Files        1102     1102              
  Lines       98434    98510      +76     
==========================================
+ Hits        98014    98085      +71     
- Misses        420      425       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

assert service.remote_host == 'http://example.com'


def test_service_run_unwraps_single_result_list():
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a test for the correctness of the order of multiple results being returned?

@mhucka
Copy link
Contributor

mhucka commented Apr 24, 2025

@splch Thank you for this work!

Could you let us know the status of this? For example, there was the comment from @Cynocracy to add a test, but it's not immediately clear if that was resolved.

Copy link
Contributor

@Cynocracy Cynocracy left a comment

Choose a reason for hiding this comment

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

The new run batch preserves order test covers what I was hoping for :) lgtm

Copy link
Collaborator

@dstrain115 dstrain115 left a comment

Choose a reason for hiding this comment

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

Will this cause any backwards incompatibility for programs people have already written?

@mhucka mhucka added kind/health For CI/testing/release process/refactoring/technical debt items interface/cirq-ionq labels Apr 29, 2025
@mhucka mhucka changed the title return a single results object instead of always a list - IonQ Return a single results object instead of always a list - IonQ Apr 29, 2025
@Cynocracy
Copy link
Contributor

@dstrain115 this is a good question. The answer is unfortunately yes, but it's attempting to revert a change in interface caused by #6652 (which made it so that jobs that previously returned a single Result were returning an Iterable of them). FWIW, I am conflicted on whether it makes sense to change back, as imo, both changes are somewhat burdensome to users.

@mhucka
Copy link
Contributor

mhucka commented Apr 30, 2025

@dstrain115 this is a good question. The answer is unfortunately yes, but it's attempting to revert a change in interface caused by #6652 (which made it so that jobs that previously returned a single Result were returning an Iterable of them). FWIW, I am conflicted on whether it makes sense to change back, as imo, both changes are somewhat burdensome to users.

Is there a way to consult users (perhaps some especially major users) and ask them for their input? (I guess this is a question for @Cynocracy )

@github-actions github-actions bot added size: M 50< lines changed <250 and removed size: L 250< lines changed <1000 labels Nov 23, 2025
@github-actions github-actions bot added size: L 250< lines changed <1000 and removed size: M 50< lines changed <250 labels Nov 23, 2025
@mhucka
Copy link
Contributor

mhucka commented Nov 23, 2025

@splch there were some test failures in CI; these might have been due to some changes in Cirq since the PR was originally submitted. I tried to fix them, and took the liberty of pushing the changes to your PR branch in an effort to help make up for lost time. Hopefully it's correct. Please feel free to make any changes necessary.

Copy link
Contributor

@mhucka mhucka left a comment

Choose a reason for hiding this comment

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

LGTM, but please check if you agree with the changes I made (and feel free to make any corrections).

@mhucka mhucka moved this from Nudged again to Nudged in Follow-up tracker Nov 28, 2025
@splch
Copy link
Contributor Author

splch commented Dec 9, 2025

That looks great thank you @mhucka! I appreciate the help making the linter happy :) I'm happy to get this PR merged whenever y'all are ready

@mhucka mhucka enabled auto-merge December 9, 2025 19:01
@mhucka mhucka added this pull request to the merge queue Dec 9, 2025
Merged via the queue into quantumlib:main with commit c3c5945 Dec 9, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interface/cirq-ionq kind/health For CI/testing/release process/refactoring/technical debt items size: L 250< lines changed <1000

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants