Python `set_target` silently ignores arguments whose YAML keys contain hyphens
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 455
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 165
Description
Required prerequisites
- Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
- If possible, make a PR with a failing test to give us a starting point to work on!
Describe the bug
cudaq.set_target() silently ignores Python snake_case arguments when the target YAML declares the corresponding key with hyphens.
processRuntimeArgs performs exact matching against the YAML key and does not match against platform-arg. This affects existing targets such as Scaleway, Quantinuum, and Fermioniq.
Steps to reproduce the bug
On main at cb50638f, run:
import cudaq
cudaq.set_target("scaleway", max_duration="30m")
The Scaleway YAML declares key: max-duration and platform-arg: max_duration. The Python argument is therefore not matched by processRuntimeArgs and is silently dropped. The backend uses its default duration instead.
Expected behavior
Python snake_case arguments should match and be forwarded using the corresponding platform-arg value. Unrecognized target arguments should produce an error instead of being silently ignored.
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
- CUDA-Q version:
cb50638f(main); QDMI PR #4882 ataabbf057 - Python version: Not environment-specific
- C++ compiler: Not environment-specific
- Operating system: Not environment-specific
Suggestions
Include platform-arg when matching Python target arguments, while retaining the existing hyphenated nvq++ option names. Also consider rejecting unmatched arguments so configuration mistakes cannot fail silently.
I'd be happy to implement this small fix.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating processRuntimeArgs and the Scaleway target YAML, then trace how set_target forwards Python arguments to target options. Check the existing target-argument tests, if available, and add coverage for max_duration matching max-duration's platform-arg and for rejected unrecognized arguments. Done means valid snake_case arguments are forwarded and invalid ones no longer fail silently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100