Skip to content

examples: read tag from RAPIDS_BRANCH file#2293

Merged
rapids-bot[bot] merged 2 commits intorapidsai:release/26.04from
jameslamb:fix/pre-commit
Mar 12, 2026
Merged

examples: read tag from RAPIDS_BRANCH file#2293
rapids-bot[bot] merged 2 commits intorapidsai:release/26.04from
jameslamb:fix/pre-commit

Conversation

@jameslamb
Copy link
Copy Markdown
Member

Description

Fixes these pre-commit errors blocking CI:

verify-hardcoded-version.................................................Failed
- hook id: verify-hardcoded-version
- exit code: 1

In file RAPIDS_BRANCH:1:9:
 release/26.04
warning: do not hard-code version, read from VERSION file instead

In file RAPIDS_BRANCH:1:9:
 release/26.04

In file cpp/examples/versions.cmake:8:21:
 set(RMM_TAG release/26.04)
warning: do not hard-code version, read from VERSION file instead

In file cpp/examples/versions.cmake:8:21:
 set(RMM_TAG release/26.04)

By updating verify-hardcoded-version configuration and by updating the C++ examples to read RMM_TAG from the RAPIDS_BRANCH file.

See rapidsai/pre-commit-hooks#121 for details

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 331ffe92-42df-40e5-b767-381dd5275845

📥 Commits

Reviewing files that changed from the base of the PR and between fb8ef5a and 272bca5.

📒 Files selected for processing (1)
  • cpp/examples/versions.cmake
🚧 Files skipped from review as they are similar to previous changes (1)
  • cpp/examples/versions.cmake

📝 Walkthrough

Summary by CodeRabbit

  • Chores

    • Updated pre-commit hooks to v1.4.2 and added expanded file exclusion patterns for consistency checks.
    • Extended copyright year range to 2024–2026.
  • Refactor

    • Build configuration now derives version tags from the project configuration instead of a hard-coded value.

Walkthrough

Bumps pre-commit hooks, extends verify-hardcoded-version exclusions, removes two sed-based RMM_TAG replacements from the release script, and changes CMake to source _rapids_branch via an included rapids_config.cmake for RMM_TAG resolution; copyright years updated.

Changes

Cohort / File(s) Summary
Pre-commit Configuration
.pre-commit-config.yaml
Bumps rapidsai/pre-commit-hooks from v1.3.3 to v1.4.2 and extends the verify-hardcoded-version hook with an exclude block covering devcontainer.json, dependencies.yaml, GitHub workflows/ISSUE_TEMPLATE, pom.xml, .pre-commit-config.yaml, conda environments, VERSION, RAPIDS_BRANCH, and many documentation/binary extensions (md, rst, avro, parquet, png, ogc, gz, pkl, sas7bdat).
Release Tooling
ci/release/update-version.sh
Updates header year to 2024-2026 and removes two example sed replacement commands that targeted cpp/examples/versions.cmake for RMM_TAG updates; remaining script logic unchanged.
CMake Version Resolution
cpp/examples/versions.cmake
Updates copyright year to 2025-2026, replaces hard-coded RMM_TAG with inclusion of ../../cmake/rapids_config.cmake and sets RMM_TAG to ${_rapids_branch} (dynamic resolution via included config).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main change: updating C++ examples to read RMM_TAG from RAPIDS_BRANCH file instead of hard-coding it.
Description check ✅ Passed The description explains the pre-commit errors being fixed and the approach taken: updating configuration and reading from RAPIDS_BRANCH file instead of hard-coding.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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

Tip

CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.

OpenGrep is compatible with Semgrep configurations. Add an opengrep.yml or semgrep.yml configuration file to your project to enable OpenGrep analysis.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@cpp/examples/versions.cmake`:
- Around line 10-14: The fatal error message for the RMM_TAG check is misleading
because the condition if(NOT RMM_TAG) also fires when the RAPIDS_BRANCH file
exists but is empty; update the FATAL_ERROR message to explicitly state the file
may be missing or empty (referencing RMM_TAG and the RAPIDS_BRANCH file path
built from CMAKE_CURRENT_LIST_DIR) or alternatively change the check to test
file existence and non-empty contents before emitting the message so the message
matches the actual failure mode.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b5894481-7a29-4cdf-8cbf-32cbaee645e6

📥 Commits

Reviewing files that changed from the base of the PR and between 29b27d1 and fb8ef5a.

📒 Files selected for processing (3)
  • .pre-commit-config.yaml
  • ci/release/update-version.sh
  • cpp/examples/versions.cmake

Comment on lines +10 to +14
if(NOT RMM_TAG)
message(
FATAL_ERROR
"Could not determine branch name to use for checking out rapids-cmake. The file \"${CMAKE_CURRENT_LIST_DIR}/../../RAPIDS_BRANCH\" is missing."
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Clarify the fatal message for empty-file cases too.

Line 13 says the file is “missing,” but the if(NOT RMM_TAG) check also triggers when RAPIDS_BRANCH exists but is empty. Please make the message precise.

Suggested patch
 if(NOT RMM_TAG)
   message(
     FATAL_ERROR
-      "Could not determine branch name to use for checking out rapids-cmake. The file \"${CMAKE_CURRENT_LIST_DIR}/../../RAPIDS_BRANCH\" is missing."
+      "Could not determine branch name to use for checking out rapids-cmake. The file \"${CMAKE_CURRENT_LIST_DIR}/../../RAPIDS_BRANCH\" is missing or empty."
   )
 endif()
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if(NOT RMM_TAG)
message(
FATAL_ERROR
"Could not determine branch name to use for checking out rapids-cmake. The file \"${CMAKE_CURRENT_LIST_DIR}/../../RAPIDS_BRANCH\" is missing."
)
if(NOT RMM_TAG)
message(
FATAL_ERROR
"Could not determine branch name to use for checking out rapids-cmake. The file \"${CMAKE_CURRENT_LIST_DIR}/../../RAPIDS_BRANCH\" is missing or empty."
)
endif()
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cpp/examples/versions.cmake` around lines 10 - 14, The fatal error message
for the RMM_TAG check is misleading because the condition if(NOT RMM_TAG) also
fires when the RAPIDS_BRANCH file exists but is empty; update the FATAL_ERROR
message to explicitly state the file may be missing or empty (referencing
RMM_TAG and the RAPIDS_BRANCH file path built from CMAKE_CURRENT_LIST_DIR) or
alternatively change the check to test file existence and non-empty contents
before emitting the message so the message matches the actual failure mode.

# cmake-format: on
# =============================================================================

set(RMM_TAG release/26.04)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I specifically left examples alone because my impression is that they need to work outside of the context of the repo where these supporting files are available. If that's not the case, I support this change.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll defer to @bdice on that, I don't know the answer.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think most people building the examples will do so in the context of a cloned repository. We can always change this back if people report issues with building.


set(RMM_TAG release/26.04)
# Use STRINGS to trim whitespace/newlines
file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/../../RAPIDS_BRANCH" RMM_TAG)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Assuming we go this route, wouldn't it be better to include rapids_config.cmake instead? It takes care of actually reading the files.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd tried that but I swear I ran into issues with different levels of nesting and the relative paths. Let me try real quick.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok pushed doing that, that worked without issue so I must have been making a mistake before.

pushd ./cpp/examples
./build.sh
./basic/build/basic_example

Worked fine.

@jameslamb jameslamb added non-breaking Non-breaking change improvement Improvement / enhancement to an existing function labels Mar 12, 2026
@jameslamb
Copy link
Copy Markdown
Member Author

I did the "just trigger any run on the branch" trick here to get check-nightly-ci working: https://github.com/rapidsai/rmm/actions/runs/23024623399

It should work on a re-run.

@jameslamb
Copy link
Copy Markdown
Member Author

/merge

@rapids-bot rapids-bot bot merged commit 0115cf1 into rapidsai:release/26.04 Mar 12, 2026
157 of 159 checks passed
@jameslamb jameslamb deleted the fix/pre-commit branch March 12, 2026 22:04
@bdice bdice mentioned this pull request Mar 17, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants