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

GitLab and Azure Pipelines users can run socket ci without translating provider environment variables by hand. This extends the shared pull-request context in SocketDev/socket-cli#1771 with provider detection.

@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.

@jdalton
John-David Dalton (jdalton) force-pushed the jdalton/surf-2240-ci-pr-context-stack branch from 986de53 to 671c420 Compare November 25, 2026 22:51

@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.

return {
baseBranch:
envAsString(environment['SYSTEM_PULLREQUEST_TARGETBRANCH']) ||
undefined,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Azure base branch keeps ref prefix

Medium Severity

Azure's SYSTEM_PULLREQUEST_TARGETBRANCH is a full ref such as refs/heads/main, while GitHub's GITHUB_BASE_REF and GitLab's CI_MERGE_REQUEST_TARGET_BRANCH_NAME are bare branch names. Azure baseBranch therefore does not match the other providers, so git lookups and default-branch comparisons against that value miss.

Fix in Cursor Fix in Web

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

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