fix(internal/civisibility): fix base branch SHA usage.#3816
Conversation
BenchmarksBenchmark execution time: 2025-07-30 08:31:12 Comparing candidate commit 11bbfaa in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 24 metrics, 0 unstable metrics. |
|
/merge |
|
View all feedbacks in Devflow UI.
This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
The expected merge time in
Tests failed on this commit 188e5e0:
What to do next?
|
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
…t sha (#17657) ## Description On GitHub Actions, `pull_request.base.sha` in the event payload points to the **HEAD of the base branch**, not to the common ancestor (merge base) commit. This PR fixes two related issues: 1. **Tag rename**: `pull_request.base.sha` is now stored as `git.pull_request.base_branch_head_sha` (was incorrectly absent; the value is semantically the base branch head, not the base commit SHA). 2. **Merge base computation**: `git.pull_request.base_branch_sha` (the true diff base) is now computed via `git merge-base <base.sha> <head.sha>` when it hasn't already been provided by the CI system (e.g. GitLab provides it directly via `CI_MERGE_REQUEST_DIFF_BASE_SHA`). Reference implementation (Go): DataDog/dd-trace-go#3816 ## Changes - `ddtrace/ext/ci/github_actions.py`: read `pull_request.base.sha` from event file → set as `git.PULL_REQUEST_BASE_BRANCH_HEAD_SHA` - `ddtrace/testing/internal/git.py`: add `Git.get_merge_base()` method and `get_pr_base_commit_sha()` module-level helper - `ddtrace/testing/internal/env_tags.py`: after assembling tags, compute `PULL_REQUEST_BASE_BRANCH_SHA` via merge-base when not already set ## Test plan - [x] `test_github_actions_base_branch_head_sha_extracted_from_event` — verifies `pull_request.base.sha` → `base_branch_head_sha` - [x] `test_github_actions_base_branch_sha_computed_as_merge_base` — verifies merge-base is called with correct SHAs - [x] `test_github_actions_base_branch_sha_not_overwritten_when_already_set` — verifies pre-existing value (e.g. from `DD_GIT_PULL_REQUEST_BASE_BRANCH_SHA`) is respected 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: federico.mon <[email protected]>
…t sha (#17657) ## Description On GitHub Actions, `pull_request.base.sha` in the event payload points to the **HEAD of the base branch**, not to the common ancestor (merge base) commit. This PR fixes two related issues: 1. **Tag rename**: `pull_request.base.sha` is now stored as `git.pull_request.base_branch_head_sha` (was incorrectly absent; the value is semantically the base branch head, not the base commit SHA). 2. **Merge base computation**: `git.pull_request.base_branch_sha` (the true diff base) is now computed via `git merge-base <base.sha> <head.sha>` when it hasn't already been provided by the CI system (e.g. GitLab provides it directly via `CI_MERGE_REQUEST_DIFF_BASE_SHA`). Reference implementation (Go): DataDog/dd-trace-go#3816 ## Changes - `ddtrace/ext/ci/github_actions.py`: read `pull_request.base.sha` from event file → set as `git.PULL_REQUEST_BASE_BRANCH_HEAD_SHA` - `ddtrace/testing/internal/git.py`: add `Git.get_merge_base()` method and `get_pr_base_commit_sha()` module-level helper - `ddtrace/testing/internal/env_tags.py`: after assembling tags, compute `PULL_REQUEST_BASE_BRANCH_SHA` via merge-base when not already set ## Test plan - [x] `test_github_actions_base_branch_head_sha_extracted_from_event` — verifies `pull_request.base.sha` → `base_branch_head_sha` - [x] `test_github_actions_base_branch_sha_computed_as_merge_base` — verifies merge-base is called with correct SHAs - [x] `test_github_actions_base_branch_sha_not_overwritten_when_already_set` — verifies pre-existing value (e.g. from `DD_GIT_PULL_REQUEST_BASE_BRANCH_SHA`) is respected 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: federico.mon <[email protected]>
…t sha (#17657) ## Description On GitHub Actions, `pull_request.base.sha` in the event payload points to the **HEAD of the base branch**, not to the common ancestor (merge base) commit. This PR fixes two related issues: 1. **Tag rename**: `pull_request.base.sha` is now stored as `git.pull_request.base_branch_head_sha` (was incorrectly absent; the value is semantically the base branch head, not the base commit SHA). 2. **Merge base computation**: `git.pull_request.base_branch_sha` (the true diff base) is now computed via `git merge-base <base.sha> <head.sha>` when it hasn't already been provided by the CI system (e.g. GitLab provides it directly via `CI_MERGE_REQUEST_DIFF_BASE_SHA`). Reference implementation (Go): DataDog/dd-trace-go#3816 ## Changes - `ddtrace/ext/ci/github_actions.py`: read `pull_request.base.sha` from event file → set as `git.PULL_REQUEST_BASE_BRANCH_HEAD_SHA` - `ddtrace/testing/internal/git.py`: add `Git.get_merge_base()` method and `get_pr_base_commit_sha()` module-level helper - `ddtrace/testing/internal/env_tags.py`: after assembling tags, compute `PULL_REQUEST_BASE_BRANCH_SHA` via merge-base when not already set ## Test plan - [x] `test_github_actions_base_branch_head_sha_extracted_from_event` — verifies `pull_request.base.sha` → `base_branch_head_sha` - [x] `test_github_actions_base_branch_sha_computed_as_merge_base` — verifies merge-base is called with correct SHAs - [x] `test_github_actions_base_branch_sha_not_overwritten_when_already_set` — verifies pre-existing value (e.g. from `DD_GIT_PULL_REQUEST_BASE_BRANCH_SHA`) is respected 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: federico.mon <[email protected]>
What does this PR do?
This PR fixes the use of the base branch sha value, we thought this sha was the BASE sha, but we realized it is the HEAD sha of the base branch.
Motivation
JIRA: https://datadoghq.atlassian.net/browse/SDTEST-2353
Reviewer's Checklist
./scripts/lint.shlocally.Unsure? Have a question? Request a review!