Skip to content

Fix #61: resolve the pinned driver name through driverAlias() - #109

Open
corgab wants to merge 2 commits into
mainfrom
fix/61-driver-alias
Open

Fix #61: resolve the pinned driver name through driverAlias()#109
corgab wants to merge 2 commits into
mainfrom
fix/61-driver-alias

Conversation

@corgab

@corgab corgab commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

QuantumManager::driverAlias() already resolves a driver argument to its string alias, falling back to the default when none is given. circuit() and batch() re-implemented the null-to-default half of that inline as $driver ?? $this->getDefaultDriver(). Both now delegate, so one method in the manager knows how an absent driver name resolves, and the queue jobs ask the manager for the same answer instead of repeating the 'local' literal.

Plan

  1. In circuit() and batch(), resolve the alias once and hand the same string to driver(), so the pinned name and the resolved device agree by construction.
  2. Point SubmitQuantumCircuit and PollQuantumTask at QuantumManager::getDefaultDriver() for the fallback they used to compute themselves.
  3. Extend the driverAlias() docblock to name its callers.
  4. Add the batch counterpart of the existing "pins the resolved default driver name" test, and make both tests set a non-default driver so a hardcoded fallback could not pass them.

Changes

  • src/QuantumManager.php: circuit() and batch() call driverAlias() once and pass the result to driver(); docblock updated. The parameters stay ?string, as the issue notes the enum half of the alias is not reachable through these two methods today.
  • src/Jobs/SubmitQuantumCircuit.php, src/Jobs/PollQuantumTask.php: $this->driver ?? $manager->getDefaultDriver().
  • tests/Feature/QuantumManagerTest.php: circuit and batch pinning tests resolve the default from config (aws), not the shipped local.

Overlap

#104 (#57) replaces the same two job lines with AetherConfig::defaultDriver(); whichever merges second takes either form, both remove the literal.

Tests

  • vendor/bin/pint --test passes.
  • vendor/bin/pest --compact: 792 tests, 1 skipped (791 before: +1).

Closes #61

circuit() and batch() re-implemented the null-to-default half of
driverAlias() inline as $driver ?? $this->getDefaultDriver(). Both now call
driverAlias(), so one method knows how an absent driver name resolves.

Closes #61
…s ask the manager for the default

circuit() and batch() resolve the driver name first and hand the same
string to driver(), so the pinned name and the resolved device agree by
construction. SubmitQuantumCircuit and PollQuantumTask no longer repeat
the 'local' literal: they take the default from
QuantumManager::getDefaultDriver(). The pinning tests now set a non-default
driver so a hardcoded fallback could not pass them.
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.

[maintainability] QuantumManager::circuit()/batch() re-implement driverAlias()'s default-resolution logic instead of calling it

1 participant