Skip to content

[drivers/aws] Detect QPU device ARNs and refuse synchronous execution by default #69

Description

@corgab

Summary

synchronous_safe is a manual boolean in config/aether.php that ships as true for the aws driver. Nothing ties it to the device_arn. A user who switches AETHER_DEVICE_ARN from the SV1 simulator to a QPU (arn:aws:braket:us-east-1::device/qpu/ionq/Aria-1) keeps a configuration that allows ->run() to block an HTTP request on a hardware queue. The Braket SDK itself distinguishes the two classes by ARN: aws_device.py checks "qpu" in self._arn when resolving a device, and QPU ARNs are always of the form .../device/qpu/<provider>/<name>.

Where

  • src/Drivers/AwsBraketDriver.php:34-39 (beforeExecution() reads only synchronous_safe)
  • config/aether.php:130-135 ('device_arn' and 'synchronous_safe' => true are independent)
  • README.md, "Synchronous Safety" (asks the user to remember to flip the flag)

Related: #31 describes the consequence (a billed QPU task left running with no ARN after the bridge timeout). This issue is the preventive half.

Why it is a problem

Laravel's philosophy is safe defaults with explicit opt-out, not unsafe defaults with an opt-in the user must remember. The cost of the mistake here is real money and a blocked worker for minutes or hours, so the framework should catch it. Deriving the default from the ARN removes an entire class of misconfiguration while keeping the escape hatch.

Suggested fix

Make synchronous_safe tri-state: null (default, shipped in config) means "derive from device_arn", where an ARN containing /device/qpu/ is treated as unsafe and anything else as safe; true/false keep forcing the behaviour. Implement the check in AwsBraketDriver::beforeExecution() (or a small isQpu(string $arn): bool helper on the driver), keep QuantumExecutionException::synchronousUnsafe() as the error, and mention in its message that synchronous_safe => true overrides the detection. Update the config comment and the README section, and add unit tests for the three states with both a QPU and a simulator ARN.

Severity: medium

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions