Fix #51: drop the unused env-var channel from PythonBridge - #102
Closed
corgab wants to merge 2 commits into
Closed
Conversation
buildEnvironment() mapped region, bucket and device_arn to environment variables no script in bin/python ever read; the providers take the same values from the driver_config key of the JSON payload. The mapping, the $driverConfig parameter it existed for (on the PythonExecutor contract, the bridge and every driver call site) and its five tests are removed. The child process now inherits the parent environment untouched, which is what preserves boto3's credential chain; a test pins that behaviour. Closes #51
The child receives Symfony Process's default inherited environment; under non-CLI SAPIs Process drops request-context variables, so 'untouched' was too strong. The inheritance test now says what it pins: the observable guarantee from the docblock, not how the Process is constructed.
Owner
Author
|
Chiusa: Il PythonBridge intero sarà rimosso con la migrazione a PHP nativo (Issue #112). |
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.
Summary
PythonBridge::buildEnvironment()exportedregion,bucketanddevice_arnas environment variables that no script inbin/pythonever read. The live channel for those values is thedriver_configkey of the JSON payload, which every provider already consumes. This PR removes the dead channel end to end.Plan
os.environ/getenvand thatproviders/aws.pytakes region, bucket and device ARN from itsconfigdict.buildEnvironment()and let theProcessinherit the parent environment untouched, which is exactly what keeps boto3's credential chain (IAM roles, profiles,AWS_*) working.$driverConfigparameter that existed only to feed the mapping: on thePythonExecutorcontract, on the bridge, and at the five driver call sites.Changes
src/Bridge/PythonBridge.php:execute(string $script, array $payload);Processbuilt without anenvargument;buildEnvironment()deleted; docblock explains the inheritance guarantee and thatdriver_configis the only settings channel.src/Contracts/PythonExecutor.php: same signature change, docblock states implementations must not need a second channel for driver settings.src/Drivers/AbstractQuantumDriver.php: the fiveexecute()calls no longer pass$this->config(the payload already carries it).tests/Unit/Bridge/PythonBridgeTest.php: fivebuildEnvironment()tests removed; new test runs a fake interpreter that echoes a variable set in the parent and asserts it comes back.tests/Unit/Drivers/{AbstractQuantumDriver,AwsBraketDriver,LocalSimulatorDriver}Test.php:with()expectations updated to the two-argument shape.CLAUDE.md: the PythonBridge convention bullet now describes the inheritance behaviour instead of the removed non-null filter.Tests
vendor/bin/pint --testpasses.vendor/bin/pest --compact: 787 tests, 1276 assertions, 1 skipped (791 before: −5 dead-channel tests, +1 inheritance test).Closes #51
Generated by Claude Code