GeezerVison is showing github.com — Missing PR number in CiVisibilityRepoServices implementation · Issue #9295 · DataDog/dd-trace-java
Missing PR number in CiVisibilityRepoServices implementation #9295DescriptionTracer Version(s)
1.51.2~d5ad1fed74
Java Version(s)
11
JVM Vendor
Eclipse Adoptium / Temurin
Bug Report
In our test executions when test optimization is enabled, we see the following log output:
[dd.trace 2025-08-01 15:44:35:190 +0000] [main] INFO datadog.trace.civisibility.CiVisibilityRepoServices - PR detected: PR{baseBranch='master', baseSHA='<BASE_SHA>', commitSHA='<COMMIT_SHA>', prNumber='null'}
We are using the test optimization GitHub Action as follows in our workflow on our GitHub Enterprise Server instance:
- name: 'Configure Datadog Test Optimization'
uses: datadog/test-visibility-github-action@v2
with: { languages: 'java', api_key: '<DD_API_KEY>', service: 'service-name-here' }
Expected Behavior
It is expected that when running tests against a pull request, the PR metadata will be obtained from the Git provider and populated with all available data. In this case, the PR number is available (as demonstrated in the GithubActionsInfo implementation), so our expectation is that CiVisibilityRepoServices would obtain and use the same information. It appears an instance of CIProviderInfo is available in the execution context for use.
Reproduction Code
The code in CiVisibilityRepoServices explicitly sets the prNumber field to null via the PullRequestInfo constructor. Activitynikita-tkachenko-datadog commented on Aug 1, 2025 Hi @mlschechter, thank you for reporting this issue. It is addressed in #9210 that will be released with v1.52.0 scheduled for the 4th of August Reacted by Michael Schechter mlschechter commented on Aug 1, 2025 nikita-tkachenko-datadog commented on Aug 1, 2025 The buildUserPullRequestInfo method creates PR info from environment variables that are manually set by the users (DD_GIT_PULL_REQUEST_BASE_BRANCH and DD_GIT_PULL_REQUEST_BASE_BRACH_SHA). This is a workaround for the CI providers where PR info cannot be extracted automatically. We do not support manually providing PR number (although we probably should), hence the explicit null assignment in that method.
The caller of this method -buildPullRequestInfo - also calls ciProviderInfo.buildPullRequestInfo() to get PR information supplied by the CI provider. The results of the two calls are merged, with the manually provided info having higher priority.
The relevant change in the PR is done in the GithubActionsInfo class:
Double number = (Double) pullRequest.get("number");
if (number != null) {
prNumber = String.valueOf(number.intValue());
}
mlschechter commented on Aug 1, 2025 Got it - thanks for the clarification!
If I'm following correctly, that change is used here, and will overwrite the explicit null I found in the earlier generation of userInfo.
Please let me know if I should close this issue out. nikita-tkachenko-datadog commented on Aug 4, 2025 Exactly, your understanding is correct!
I will go ahead and close the issue, feel free to reopen if the upcoming release doesn't fix it
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|