[Quantum] Fix workspace create crash for providers without managed_application - #10415
Ethan Yang (necusjz) merged 2 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused fix correctly reuses existing no-terms handling and has adequate regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes workspace creation for V2 providers without legacy marketplace associations.
Changes:
- Handles missing
managed_applicationusing existing sentinel values. - Adds helper and workspace-level regression tests.
| File | Description |
|---|---|
operations/offerings.py |
Prevents missing managed applications from crashing. |
tests/latest/test_quantum_offerings.py |
Tests provider lookup behavior and regression case. |
tests/latest/test_quantum_workspace.py |
Tests provider addition end to end. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
3893116 to
de03e64
Compare
|
Quantum |
|
can we check if same crash still happens in the offerings table view. transform_offerings reads offering['properties']['managedApplication']['publisherId'] with no check |
|
New version should be released for this |
|
/azp run |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
…plication Bug 55823: az quantum workspace create crashed with AttributeError when a provider has no legacy marketplace ManagedApplication association. _get_publisher_and_offer_from_provider_id now treats managed_application=None the same as the existing N/A sentinel (no terms to accept) instead of crashing, reusing the already-correct downstream handling in _provider_terms_need_acceptance/_valid_publisher_and_offer. Adds unit tests for the fixed helper plus an integration-level test on _add_quantum_providers reproducing the exact crash scenario.
d09b4f9 to
d8613d7
Compare
|
[Release] Update index.json for extension [ quantum-1.0.0b30 ] : https://dev.azure.com/msazure/One/_build/results?buildId=184124890&view=results |
Summary
az quantum workspace create --workspace-kind V2 -r <provider>/<sku> ...crashed with an unhandledAttributeError: 'NoneType' object has no attribute 'offer_id'for providers that have no legacy marketplaceManagedApplicationassociation. This happened even with--skip-autoadd, since that flag only skips additional auto-added providers, not ones passed explicitly via-r.Root cause
_get_publisher_and_offer_from_provider_idassumedproperties.managed_applicationis always populated (with real values, or the existingN/Asentinel meaning "no terms to accept"). For certain V2-native providers, the object itself isNone, a case the function never guarded against.Fix
Treat
managed_application is Nonethe same as the existingN/Asentinel (PUBLISHER_NOT_AVAILABLE/OFFER_NOT_AVAILABLE) instead of crashing. This reuses the already-correct downstream handling in_provider_terms_need_acceptance/_valid_publisher_and_offer(both already short-circuit on theN/Asentinel without calling the marketplace API), so no other function needed to change.Testing
_add_quantum_providersmockingcf_offeringsto return a provider with nomanaged_application, reproducing the exact failing scenario end-to-end.azdev style quantum/azdev linter quantum: both PASSED.