Skip to content

fix: use cwd for reported sha #398

Merged
arekay-nv merged 3 commits into
mainfrom
arekay/fix_git_sha
Jul 7, 2026
Merged

fix: use cwd for reported sha #398
arekay-nv merged 3 commits into
mainfrom
arekay/fix_git_sha

Conversation

@arekay-nv

Copy link
Copy Markdown
Collaborator

What does this PR do?

The SHA reported in the reports was not setting the cwd correctly, which led to incorrect SHA being reported. If the source repo was different from the endpoints repo, the SHA of the source repo was being used.

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor/cleanup

Related issues

Testing

  • Tests added/updated
  • All tests pass locally
  • Manual testing completed

Checklist

  • Code follows project style
  • Pre-commit hooks pass
  • Documentation updated (if needed)

Signed-off-by: Rashid Kaleem <230885705+arekay-nv@users.noreply.github.com>
@arekay-nv arekay-nv requested a review from a team July 6, 2026 22:33
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@github-actions github-actions Bot requested a review from nvzhihanj July 6, 2026 22:33

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the get_git_sha utility to anchor git queries to the package's repository root instead of the current working directory, preventing incorrect SHA reporting when run from unrelated directories. It also adds comprehensive unit tests for these changes. The review feedback suggests three key improvements: safely resolving the repository root to avoid potential IndexError crashes in shallow directory structures, moving path resolution inside the try-except block to handle potential OSError exceptions, and wrapping git calls in tests to gracefully skip them if the source tree is not a git repository.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/inference_endpoint/utils/version.py Outdated
Comment thread src/inference_endpoint/utils/version.py Outdated
Comment thread tests/unit/test_version.py Outdated
arekay-nv added 2 commits July 6, 2026 20:20
Signed-off-by: Rashid Kaleem <230885705+arekay-nv@users.noreply.github.com>
Comment thread src/inference_endpoint/utils/version.py
@arekay-nv arekay-nv merged commit 21fa7e6 into main Jul 7, 2026
9 checks passed
@arekay-nv arekay-nv deleted the arekay/fix_git_sha branch July 7, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants