feat: pass commit SHA and branch name on validation runs#208
Merged
sohankshirsagar merged 2 commits intomainfrom Mar 24, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="cmd/run.go">
<violation number="1" location="cmd/run.go:1019">
P2: Refactoring changes behavior: the old inline code in `validateCIMetadata` intentionally left `CommitSha` empty when CI env vars were unset, so that downstream validation would surface a clear error. The new `getCommitSHAFromEnv()` helper silently falls back to `git rev-parse HEAD`, which in GitHub Actions PR events returns the merge commit SHA (not the PR head SHA), bypassing the validation and potentially sending an incorrect commit to the backend. The `git rev-parse` fallback makes sense for the new validation-run path (best-effort), but it should not apply here in the CI metadata validation path.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Contributor
There was a problem hiding this comment.
1 issue found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="cmd/run.go">
<violation number="1" location="cmd/run.go:1125">
P2: `getCommitSHAFromEnv()` lost the git fallback, so validation runs outside recognized CI always send an empty commit SHA.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
jy-tan
approved these changes
Mar 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Send
commit_shaandbranch_namewhen creating validation drift runs so the backend can create aCheckCommitfor tracking. Both fields are already optional on the proto — if empty, the backend skipsCheckCommitcreation, so this is fully backwards-compatible with older backend versions.Changes
CommitShaandBranchNameon the validation-run request — theCreateDriftRunRequestforisValidation = truenow includes both fields, resolved viagetCommitSHAFromEnv()andgetBranchFromEnv().getCommitSHAFromEnv()helper — mirrors the existinggetBranchFromEnv()pattern: checksGITHUB_SHA/CI_COMMIT_SHAenv vars, falls back togit rev-parse HEAD, returns empty string if nothing can be resolved.validateCIMetadata— replace the inline commit SHA resolution block with a call to the new helper (DRY, no behavior change).