ref(vsts): Remove legacy pipeline views#113336
Conversation
The VSTS (Azure DevOps) integration now uses the API-driven pipeline exclusively. Remove the old view-based pipeline steps (AccountConfigView, AccountForm, NestedPipelineView), the vsts-config.html template, and legacy test helpers. Update vsts_extension to return views directly instead of filtering the parent's views. Refs [VDY-32](https://linear.app/getsentry/issue/VDY-32/migrate-integration-setup-pipelines-to-api-driven-flows)
| if "oauth_data" in state: | ||
| data = state["oauth_data"] | ||
| else: |
There was a problem hiding this comment.
Bug: The fallback else branch in build_integration accesses state["identity"], but the code that populates this key has been removed, creating a latent KeyError crash risk.
Severity: LOW
Suggested Fix
The else block is dead code and should be removed. Alternatively, if it's intended as a safeguard, it should be updated to raise a more informative error, like IntegrationError("Missing oauth_data from pipeline state"), instead of crashing with a KeyError.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/sentry/integrations/vsts/integration.py#L588-L590
Potential issue: The `build_integration` function contains a fallback `else` branch that
attempts to access `state["identity"]["data"]`. This code path was intended for a legacy
pipeline flow that is being removed in this pull request. The new API-driven flow
exclusively populates `state["oauth_data"]`. If an unexpected edge case, such as
pipeline state corruption, causes `state["oauth_data"]` to be missing and the `else`
branch is executed, the application will crash with a `KeyError` because
`state["identity"]` is no longer populated by any code path.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit cab95e9. Configure here.
| views = [view for view in views if not isinstance(view, AccountConfigView)] | ||
| views.append(VstsExtensionFinishedView()) | ||
| return views | ||
| return [VstsExtensionFinishedView()] |
There was a problem hiding this comment.
Extension view pipeline missing OAuth step breaks installation
High Severity
VstsExtensionIntegrationProvider.get_pipeline_views() now returns only [VstsExtensionFinishedView()], dropping the OAuth step that was previously inherited from the parent's NestedPipelineView. The extension's view-based flow (triggered via VstsExtensionConfigurationView) jumps directly to VstsExtensionFinishedView.dispatch(), which calls pipeline.finish_pipeline() → build_integration(). Since no OAuth step ran, neither oauth_data nor identity exists in pipeline state, causing a KeyError when accessing token data. The removed test_builds_integration_with_vsts_key test was covering exactly this flow.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit cab95e9. Configure here.
| config=identity_pipeline_config, | ||
| ), | ||
| AccountConfigView(), | ||
| ] |
There was a problem hiding this comment.
Dead legacy fallback branch after removing views
Low Severity
The TODO comment that said "Remove the legacy path once the old views are retired" was deleted, but the else branch (state["identity"]["data"]) it referred to was kept. Since the NestedPipelineView that populated state["identity"] was removed in this PR, nothing in production sets this key anymore. For the normal VSTS flow, oauth_data is always present (via API steps), making the else branch unreachable dead code.
Reviewed by Cursor Bugbot for commit cab95e9. Configure here.
Backend Test FailuresFailures on
|


The VSTS (Azure DevOps) integration now uses the API-driven pipeline
exclusively. Remove the old view-based pipeline steps (AccountConfigView,
AccountForm, NestedPipelineView), the vsts-config.html template, and
legacy test helpers. Update vsts_extension to return views directly
instead of filtering the parent's views.
Refs VDY-60