Skip to content

build: derive STABLE_VERSION from NVCF_VERSION or mr-<sha> only - #646

Open
priyaselvaganesan wants to merge 1 commit into
mainfrom
build/version-clean-local
Open

build: derive STABLE_VERSION from NVCF_VERSION or mr-<sha> only#646
priyaselvaganesan wants to merge 1 commit into
mainfrom
build/version-clean-local

Conversation

@priyaselvaganesan

@priyaselvaganesan priyaselvaganesan commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Why

tools/workspace_status.sh derived STABLE_VERSION from git describe --tags --exact-match HEAD when NVCF_VERSION was unset. In this monorepo a single commit carries many path-prefixed tags for unrelated artifacts (deploy/stacks/*, src/*/v*), and git describe returns an arbitrary one. So a local --stamp build could stamp an unrelated tag such as deploy/stacks/nvcf-compute-plane/v0.2.0-dev.231 as a service's version (it then flows into /info and image tags).

What changed

Drop the git describe --exact-match branch. STABLE_VERSION now comes from NVCF_VERSION (set by the release build to the clean, tag_prefix-stripped semver) or falls back to mr-<sha> for dev/MR builds.

Release builds are unaffected: NVCF_VERSION is set on the release bazel run --stamp path, so they already take that branch. Only local/dev builds change, from an arbitrary path-prefixed tag to mr-<sha>.

Testing

bash tools/workspace_status.sh              # tagged commit -> STABLE_VERSION mr-<sha>
NVCF_VERSION=1.2.3 bash tools/workspace_status.sh   # -> STABLE_VERSION 1.2.3

Issues

Relates to #315

Summary by CodeRabbit

  • Bug Fixes

    • Release version selection now honors the configured NVCF_VERSION.
    • Releases without an explicit version use a consistent commit-based identifier.
    • Simplified version detection for more reliable release identification.
  • Documentation

    • Updated Bazel release guidance to explain explicit release versions and commit-based fallback versions.
  • Tests

    • Added coverage to verify explicit version selection, fallback behavior, and prevention of unintended tag-based versions.

@priyaselvaganesan
priyaselvaganesan requested a review from a team as a code owner August 3, 2026 23:43
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 14479dfb-ea14-477f-acfb-6a280d85279b

📥 Commits

Reviewing files that changed from the base of the PR and between c598e55 and 1c28d12.

📒 Files selected for processing (3)
  • BAZEL.md
  • tools/scripts/test/test-workspace-status.sh
  • tools/workspace_status.sh
🚧 Files skipped from review as they are similar to previous changes (3)
  • BAZEL.md
  • tools/workspace_status.sh
  • tools/scripts/test/test-workspace-status.sh

📝 Walkthrough

Walkthrough

The workspace status script now uses NVCF_VERSION when set and mr-${COMMIT} otherwise. Bazel documentation reflects this behavior. A Bash test validates both version-selection paths.

Changes

Version selection

Layer / File(s) Summary
Version source policy
tools/workspace_status.sh, BAZEL.md
The script prefers NVCF_VERSION and falls back to mr-${COMMIT} when unset. The Bazel documentation describes this behavior and removes Git tag fallback guidance.
Version source validation
tools/scripts/test/test-workspace-status.sh
A Bash test verifies explicit NVCF_VERSION values and the mr-<sha> fallback without path-prefixed tags.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: max-nv

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses the valid build prefix and accurately describes the version derivation change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch build/version-clean-local

Comment @coderabbitai help to get the list of available commands.

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tools/workspace_status.sh`:
- Around line 26-33: Add regression tests for tools/workspace_status.sh covering
NVCF_VERSION=1.2.3, an unset variable, and unrelated path-prefixed tags at HEAD,
asserting the expected STABLE_VERSION in each case. Also update the stale git
describe behavior documented in BAZEL.md to reflect the current
version-selection logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 39fbb742-9dab-47d6-a08f-d1431f2cb2f0

📥 Commits

Reviewing files that changed from the base of the PR and between 3d76cd5 and e698fe0.

📒 Files selected for processing (1)
  • tools/workspace_status.sh

Comment thread tools/workspace_status.sh Outdated
@priyaselvaganesan
priyaselvaganesan force-pushed the build/version-clean-local branch from e698fe0 to 86999b8 Compare August 3, 2026 23:49
@priyaselvaganesan priyaselvaganesan self-assigned this Aug 3, 2026
@priyaselvaganesan
priyaselvaganesan force-pushed the build/version-clean-local branch from 86999b8 to 1adffd4 Compare August 3, 2026 23:56
@priyaselvaganesan
priyaselvaganesan requested a review from a team as a code owner August 3, 2026 23:56
@priyaselvaganesan
priyaselvaganesan force-pushed the build/version-clean-local branch from 1adffd4 to c598e55 Compare August 3, 2026 23:59

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tools/scripts/test/test-workspace-status.sh`:
- Around line 21-28: Strengthen the unset-NVCF_VERSION assertion in the test
case around stable_version by comparing the result exactly with mr-$(git
rev-parse --short HEAD), rather than only checking its prefix and absence of
'/'. Create a deterministic temporary Git fixture whose HEAD has a path-prefixed
tag, run stable_version from that fixture, and assert the same exact
commit-derived fallback so the regression does not depend on the current
checkout’s tags.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: cd4da71e-8923-44ee-8630-1765dfe9ea29

📥 Commits

Reviewing files that changed from the base of the PR and between 86999b8 and 1adffd4.

📒 Files selected for processing (3)
  • BAZEL.md
  • tools/scripts/test/test-workspace-status.sh
  • tools/workspace_status.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • tools/workspace_status.sh

Comment thread tools/scripts/test/test-workspace-status.sh Outdated
@priyaselvaganesan
priyaselvaganesan force-pushed the build/version-clean-local branch from c598e55 to b164ac5 Compare August 4, 2026 00:10
git describe --tags --exact-match returned an arbitrary path-prefixed tag
(e.g. deploy/stacks/nvcf-compute-plane/v0.2.0-dev.231) as the version, because a
single monorepo commit carries many unrelated artifact tags. Drop that branch;
STABLE_VERSION now comes from NVCF_VERSION (clean semver, set by release builds)
or mr-<sha> for dev builds.
@priyaselvaganesan
priyaselvaganesan force-pushed the build/version-clean-local branch from b164ac5 to 1c28d12 Compare August 4, 2026 00:10
@priyaselvaganesan priyaselvaganesan changed the title build: derive STABLE_VERSION from NVCF_VERSION or mr-<sha> only build: derive STABLE_VERSION from NVCF_VERSION or mr-<sha> only Aug 4, 2026

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

LGTM!

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