Skip to content

feat(python-cli-parity): detect pull requests in GitLab and Azure - #1772

Open
John-David Dalton (jdalton) wants to merge 1 commit into
refactor/ci-pr-contextfrom
jdalton/surf-2240-ci-pr-context-stack
Open

John-David Dalton (jdalton) wants to merge 1 commit into
refactor/ci-pr-contextfrom
jdalton/surf-2240-ci-pr-context-stack

Conversation

@jdalton

@jdalton John-David Dalton (jdalton) commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

GitLab and Azure Pipelines can give socket ci the pull request details it needs. Socket reads the request number and the branch the change will go into. In GitLab, this is called a merge request.

GitLab can also give Socket the saved version of the code to compare against. Azure gives this check the number and branch. Socket turns an Azure branch name like refs/heads/main into main.

This builds on #1771 and gives #1766 the details it uses to look up a scan. It also carries forward the GitLab and Azure support from #1768.

Slides

Add GitLab and Azure to the shared check. Socket finds pull request details in GitLab and Azure builds. It also cleans up the branch name from Azure.

What each build gives Socket. GitLab. Socket reads the merge request number, the target branch, and the saved version to compare against when GitLab gives it one. Azure Pipelines. Socket reads the pull request number and the target branch.

Use the short Azure branch name. Azure can send a longer name for the same branch. Azure sends. refs/heads/main Socket uses. main

@cursor

cursor Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
CI-only env parsing with guarded numeric checks and tests; scan wiring unchanged aside from call ordering.

Overview
Extends detectCiPullRequestContext so socket ci can recognize pull/merge request runs on GitLab and Azure DevOps, not only GitHub. The provider type now includes azure and gitlab, and detection reads each platform’s standard CI variables (e.g. CI_MERGE_REQUEST_IID, SYSTEM_PULLREQUEST_*) for PR number, target branch, and base SHA where available.

GitHub behavior is preserved but refactored into a multi-provider branch chain with a shared fallback when no provider matches. handle-ci still passes only the PR number into scan creation; it now calls detection once and keeps the full context in a local variable.

Adds Vitest coverage for GitHub, GitLab, Azure, and invalid env values, and updates .gitignore allowlist for the new test file.

Reviewed by Cursor Bugbot for commit 671c420. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 671c420. Configure here.

@jdalton
John-David Dalton (jdalton) force-pushed the jdalton/surf-2240-ci-pr-context-stack branch from 5b74a72 to d57a500 Compare November 30, 2026 22:50

This branch has not been deployed

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant