Skip to content

ci: refine CodeRabbit review guide to match cuOpt idioms - #1139

Merged
rapids-bot[bot] merged 6 commits into
mainfrom
refine-coderabbit-guide
Apr 27, 2026
Merged

ci: refine CodeRabbit review guide to match cuOpt idioms#1139
rapids-bot[bot] merged 6 commits into
mainfrom
refine-coderabbit-guide

Conversation

@ramakrishnap-nv

@ramakrishnap-nv ramakrishnap-nv commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Refines the CodeRabbit AI review configuration (.coderabbit.yaml + .github/.coderabbit_review_guide.md) so reviews match how cuOpt actually looks, not generic best-practice templates.

Commits

  1. ci: refine CodeRabbit review guide to match cuOpt idioms
    Shrinks the review guide from 469 to 307 lines. Splits the blanket IGNORE into subjective-taste vs. already-enforced-by-pre-commit (clang-format, ruff, pydocstyle, shellcheck, verify-copyright, verify-hardcoded-version, rapids-dependency-file-generator). Adds a Coding Standards section, CUDA idioms (RAFT_CUDA_TRY, rmm::device_uvector, raft::handle_t::get_stream(), thrust/CCCL), Python, Cython, and C-API sections. Collapses rules that were repeated 3–6 times. Expands .coderabbit.yaml path_instructions from 2 → 11 narrowly scoped entries and adds path_filters for thirdparty/, regression/, problem-data files.

  2. ci(coderabbit): flag references to files missing from the PR
    New CRITICAL rule and Common Bug Pattern §7 catching forgotten git add: #include of absent headers, CMake target_sources of missing files, Python/Cython imports of files not in the PR, workflow run: steps pointing at ci scripts not present, Dockerfile COPY, helmchart templates, Sphinx includes, dependency-file drift. Adds path_instructions for **/CMakeLists.txt, **/*.cmake, .github/workflows/**, ci/**/*.sh, datasets/**/*.sh, **/Dockerfile*, helmchart/**.

  3. ci(coderabbit): exempt runtime-downloaded datasets from §7
    Prevents §7 from false-positiving on tests referencing MPS/QPS/LP/MIPLIB data. Tests resolve paths via RAPIDS_DATASET_ROOT_DIR (see cpp/tests/utilities/common_utils.hpp and the Python os.getenv usage); data is fetched at test time by datasets/get_test_data.sh, datasets/linear_programming/download_pdlp_test_dataset.sh, datasets/mip/download_miplib_test_dataset.sh. CodeRabbit only flags when a referenced filename appears in none of those scripts, or when a script rename leaves a stale test reference.

  4. ci(coderabbit): flip C++ guidance to cuOpt-first, Google as fallback
    Reframes the C++ Coding Standards section. The previous "Google C++ with cuOpt deviations" framing was biased: the codebase uses snake_case for everything, _t suffix on types, trailing-underscore private members, and exceptions — all of which Google disagrees with. The new framing lists cuOpt's actual conventions first (naming, file extensions, error handling via cuopt_expects/CUOPT_EXPECTS, column 100), and cites Google only for named language-level practices the codebase actually follows (ownership, explicit, override, casts, IWYU, const/constexpr). Explicit "where Google disagrees with cuOpt, cuOpt wins" clause covers naming, exceptions, and column limit.

Risk

Low — only affects CodeRabbit's AI reviews. No build, runtime, or CI behavior change. Easy to iterate as we see how reviews read.

Issue

N/A

Checklist

  • I am familiar with the Contributing Guidelines.
  • Testing
    • NA (configuration/guidance only; YAML validated)
  • Documentation
    • NA (the changed files are the AI-reviewer documentation)

Tightens CodeRabbit AI review configuration to reduce noise and sharpen
signal, based on what the repo actually does rather than generic guidance.

- Narrows the blanket IGNORE list; separately enumerates items already
  enforced by pre-commit (clang-format, ruff, pydocstyle, shellcheck,
  verify-copyright, verify-hardcoded-version, rapids-dependency-file-generator)
  so CodeRabbit stops duplicating CI noise.
- Anchors C++ guidance on the Google C++ Style Guide by rule name
  (the .clang-format is already BasedOnStyle: Google), and documents
  cuOpt's deviations: exceptions ARE used (cuopt_expects / CUOPT_EXPECTS
  in cpp/include/cuopt/error.hpp), column limit is 100.
- Adds cuOpt-specific CUDA idioms: RAFT_CUDA_TRY for error checks,
  rmm::device_uvector over raw cudaMalloc/cudaFree, streams from
  raft::handle_t::get_stream(), prefer thrust/CCCL over hand-rolled.
- Adds Python, Cython, and C-API sections that did not exist.
- Collapses duplicate rules (stream lifecycle, problem-context
  confusion, phase initialization were each repeated 3-6 times) so
  each rule lives once in the severity matrix, with cross-cutting
  lessons captured in Common Bug Patterns with red-flag bullets.
- Merges Output Format and Token Optimization sections.
- Replaces the contradictory "ONLY CRITICAL/HIGH" framing and the
  unmeasurable "sub-3% false positive" target with a quality gate.
- .coderabbit.yaml: expands path_instructions from 2 to 11 narrowly
  scoped entries (cu/cuh, cpp/src host, grpc, cuopt_c.h, cpp tests,
  python, pyx, pxd, server, python tests); adds path_filters to
  exclude thirdparty/, datasets/, regression/, notebooks/, and
  problem-data files.
- Adds CONTRIBUTING.md and CONVENTIONS.md to the knowledge base so
  CodeRabbit sees the same standards humans do.

Net: review guide shrinks from 469 to 307 lines while gaining
Python/Cython/C-API coverage and repo-specific rules.

Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Apr 23, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@ramakrishnap-nv ramakrishnap-nv self-assigned this Apr 23, 2026
@ramakrishnap-nv ramakrishnap-nv added non-breaking Introduces a non-breaking change improvement Improves an existing functionality labels Apr 23, 2026
Adds coverage for a class of bug the previous guide did not mention:
a PR references a file, script, or symbol that is not actually in the
diff or in the base branch (commonly a forgotten `git add`).

- Review guide: new CRITICAL "Build / dependency integrity" bullet and
  a new Common Bug Pattern §7 with red flags across four categories:
  source & build (#include, CMake, imports, Cython cimport, renamed
  symbols), CI / scripts / infra (workflow `run:` steps, shell
  `source`, Dockerfile COPY, helmchart, dataset scripts, Sphinx
  includes), and dependencies (dependencies.yaml, pyproject,
  requirements).
- .coderabbit.yaml: adds path_instructions for .github/workflows/**,
  ci/**/*.sh, datasets/**/*.sh, **/Dockerfile*, helmchart/**, plus
  **/*.cmake — each focused on cross-checking referenced files/paths
  exist in the PR.
- Narrows the datasets/ and regression/ excludes: shell scripts in
  those directories are now reviewed (they download test data and are
  worth checking); only the bulk data formats are filtered out.

Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
Prevents false positives on tests referencing problem data (MPS, QPS, LP,
MIPLIB, PDLP) that is downloaded at test time, not committed.

The repo's convention is that datasets are fetched by scripts under
datasets/ before tests run (datasets/get_test_data.sh,
datasets/linear_programming/download_pdlp_test_dataset.sh,
datasets/mip/download_miplib_test_dataset.sh) and resolved at runtime via
RAPIDS_DATASET_ROOT_DIR — see cpp/tests/utilities/common_utils.hpp
(get_rdrd_or_default) and the os.getenv usage in
python/cuopt/cuopt/tests/linear_programming/test_python_API.py.

Without this carve-out, Common Bug Pattern §7 would fire on every
test that references a dataset path — a high false-positive rate.

- Review guide §7: drops the blanket "tests referencing datasets
  not in the PR" red flag and adds a "When NOT to flag" subsection
  listing the three download scripts, the RAPIDS_DATASET_ROOT_DIR
  contract, and the precise conditions under which a reference
  SHOULD be flagged (new filename not present in any download script;
  stale name after rename/removal; typo).
- .coderabbit.yaml: adds the dataset-exemption note to the cpp/tests
  and python/**/tests path_instructions so it applies scoped to
  where it matters.

Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
@ramakrishnap-nv

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Apr 23, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds path-based review filters and many narrow, per-path review instructions in .coderabbit.yaml. Restructures the repository review guide .github/.coderabbit_review_guide.md from an IGNORE/CRITICAL/... taxonomy into explicit tooling-exemptions, concrete coding standards, a unified severity framework, and numbered common-bug triggers.

Changes

Cohort / File(s) Summary
Review config
.coderabbit.yaml
Introduces reviews.path_filters to exclude thirdparty/notebooks/built docs and bulk data files; adds refined reviews.path_instructions for many paths (C/C++ headers, cuopt_c.h ABI checks, CUDA/host C++ idioms, gRPC validation/logging/thread-safety, gtest correctness/flakiness/isolation, Python/pytest/Cython/pxd linting and deprecation rules, CMake/CI/Docker/Helm common-bug patterns, dataset download/script exceptions, and docs review routing).
Review guide
.github/.coderabbit_review_guide.md
Replaces legacy IGNORE/CRITICAL/HIGH/MEDIUM taxonomy with: (1) “Do Not Comment On” tooling-exempt items, (2) explicit Coding Standards (naming, C++/CUDA/Python/C API expectations), and (3) a unified Severity framework plus Output Format, Quality Gate, Context Awareness, numbered Common Bug Patterns, and updated example templates.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: refining the CodeRabbit review guide configuration to align with cuOpt's actual coding idioms and conventions.
Description check ✅ Passed The description is directly related to the changeset, providing detailed context about the refined CodeRabbit configuration, rationale, and specific changes made to .coderabbit.yaml and .coderabbit_review_guide.md.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refine-coderabbit-guide

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

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

Inline comments:
In @.coderabbit.yaml:
- Around line 262-263: The knowledge_base list in .coderabbit.yaml currently
references "CONVENTIONS.md" which doesn't exist; either remove the
"CONVENTIONS.md" entry from the knowledge_base array or add a new CONVENTIONS.md
file to the repo root containing your project's coding conventions and ensure
the filename/path matches exactly; update .coderabbit.yaml to reflect the change
and commit the new file or config so the knowledge_base no longer points to a
non-existent resource.
🪄 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: Pro Plus

Run ID: 4be7e1e1-f3c0-46e2-8b23-34ffb8a5d270

📥 Commits

Reviewing files that changed from the base of the PR and between 55fb9b9 and c78a3f0.

📒 Files selected for processing (2)
  • .coderabbit.yaml
  • .github/.coderabbit_review_guide.md

Comment thread .coderabbit.yaml
Comment on lines +262 to +263
- "CONTRIBUTING.md"
- "CONVENTIONS.md"

@coderabbitai coderabbitai Bot Apr 23, 2026

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if CONVENTIONS.md exists at repo root or common locations
fd -i 'CONVENTIONS.md' --type f

Repository: NVIDIA/cuopt

Length of output: 38


Remove CONVENTIONS.md from the knowledge base or create the file.

CONVENTIONS.md does not exist in the repository. Adding a non-existent file to the knowledge_base may cause CodeRabbit to log a warning or silently skip it. Either create this file with the project's coding conventions or remove the reference from lines 262-263.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.coderabbit.yaml around lines 262 - 263, The knowledge_base list in
.coderabbit.yaml currently references "CONVENTIONS.md" which doesn't exist;
either remove the "CONVENTIONS.md" entry from the knowledge_base array or add a
new CONVENTIONS.md file to the repo root containing your project's coding
conventions and ensure the filename/path matches exactly; update
.coderabbit.yaml to reflect the change and commit the new file or config so the
knowledge_base no longer points to a non-existent resource.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check current branch
git branch --show-current

# Check if CONVENTIONS.md exists on current branch
ls -la CONVENTIONS.md 2>&1

# Check if it exists on main
git show main:CONVENTIONS.md > /dev/null 2>&1 && echo "EXISTS on main" || echo "NOT on main"

# Check with fd more broadly (case-insensitive)
fd -i 'conventions' --type f

Length of output: 88


@rgsl888prabhu, you're right — CONVENTIONS.md exists and is a symlink to AGENTS.md in the repository. My initial fd scan missed it because fd skips symlinks by default (the correct invocation would have needed the -L / --follow flag). The knowledge_base reference is perfectly valid and no change is needed. Apologies for the noise!


🧠 Learnings used
Learnt from: rgsl888prabhu
Repo: NVIDIA/cuopt PR: 1098
File: ci/run_ctests.sh:44-44
Timestamp: 2026-04-23T15:41:58.054Z
Learning: In these CI shell scripts—ci/run_ctests.sh, ci/run_cuopt_pytests.sh, and ci/run_cuopt_server_pytests.sh—treat `IS_NIGHTLY` as the intentional variable name. It is set from `RAPIDS_BUILD_TYPE` and compared to the string "nightly" using this project’s naming convention; during code review, don’t recommend renaming `IS_NIGHTLY` to something like `BUILD_TYPE` or similar, since it would introduce unnecessary churn.

The previous "Google C++ Style Guide with cuOpt deviations" framing was
biased toward Google: the codebase actually uses snake_case for everything,
_t suffix on types, trailing-underscore private members, and exceptions —
all of which Google C++ disagrees with. With only "exceptions" and
"column 100" listed as deviations, CodeRabbit could legitimately flag
`class my_thing_t { void do_thing(); }` patterns as not following Google
CamelCase — and that pattern is the entire codebase.

This commit reframes the C++ Coding Standards section as cuOpt-first:

- "C++ — cuOpt conventions (the default; match nearby code)" lists the
  actual conventions: snake_case + _t suffix, trailing-underscore members,
  CUOPT_-prefixed macros, file-extension contract, exceptions via
  cuopt_expects/CUOPT_EXPECTS, column 100, formatting handled by clang-format.
- "C++ — language-level practices we follow from Google C++" lists ONLY
  the named rules cuOpt actually follows (ownership, explicit, override,
  casts, IWYU, no `using namespace`, const/constexpr) and tells CodeRabbit
  to cite Google by section name only for these.
- Explicit "where Google disagrees with cuOpt, cuOpt wins" clause covers
  naming, exceptions, and column limit.

Updates the cpp/src/**/*.{cpp,hpp,h} path_instruction in .coderabbit.yaml
to match: lists cuOpt conventions first, then names the Google rules to
cite, with a "do NOT cite Google for naming, exceptions, or column limit"
clause.

Net: CodeRabbit reads the surrounding code first; Google C++ is a
fallback for language-level practices, not the rulebook.

Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
Comment thread .github/.coderabbit_review_guide.md
Comment thread .github/.coderabbit_review_guide.md
Comment thread .coderabbit.yaml Outdated
- Add Inheritance and Static/Global Variables to the Google C++ practices
  list in the review guide (mlubin feedback)
- Trim duplicated cpp/src/** path_instructions in .coderabbit.yaml to
  point at the review guide instead of restating conventions (mlubin
  feedback on YAML being the wrong home for project-wide style rules)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ramakrishnap-nv
ramakrishnap-nv requested a review from mlubin April 24, 2026 18:15

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

When this lands please notify the team to be on the lookout for improvements or regressions in the CodeRabbit comments.

@ramakrishnap-nv
ramakrishnap-nv marked this pull request as ready for review April 24, 2026 18:20
@ramakrishnap-nv
ramakrishnap-nv requested a review from a team as a code owner April 24, 2026 18:20
@ramakrishnap-nv
ramakrishnap-nv requested a review from Iroy30 April 24, 2026 18:20

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

🧹 Nitpick comments (2)
.github/.coderabbit_review_guide.md (2)

332-337: Add language specifiers to example code blocks.

Static analysis flags these fenced code blocks (and the similar ones at lines 340, 347, 354, 361, 368) as missing a language specifier (MD040). Since these are output format templates rather than executable code, consider using text or plaintext.

📝 Suggested fix for all example blocks
-```
+```text
 CRITICAL: Device buffer leaks on early return.

Apply the same pattern (text) to the other example blocks at lines 340, 347, 354, 361, 368.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/.coderabbit_review_guide.md around lines 332 - 337, The fenced
example blocks that show template outputs (e.g., the block containing "CRITICAL:
Device buffer leaks on early return.") are missing a language specifier and
trigger MD040; update each of these fenced code blocks to use a non-executable
specifier like ```text (apply the same change to the other similar example
blocks that contain the output templates) so they are recognized as plaintext in
Markdown and static analysis no longer flags them.

49-55: Clarify logic_error example — it lacks the _t suffix described in the rule.

The naming convention states types use snake_case_t with a _t suffix, but the first example logic_error doesn't follow this. If logic_error intentionally omits the suffix (e.g., to match std::logic_error), consider noting that exception or replacing it with a clearer example like cuopt_error_t.

📝 Suggested clarification
 - **Naming**:
   - Types, classes, structs, enums: `snake_case_t` with `_t` suffix
-    (e.g. `logic_error`, `error_type_t`, `solver_settings_t`)
+    (e.g. `error_type_t`, `solver_settings_t`, `device_buffer_t`)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/.coderabbit_review_guide.md around lines 49 - 55, The naming example
uses "logic_error" which contradicts the rule that types use snake_case_t;
update the documentation in the naming section to either note that exception
types mirroring std::logic_error are exempt, or replace "logic_error" with a
compliant example such as "cuopt_error_t"; ensure the doc text around the type
naming rule and the examples (mentioning "logic_error" and the suggested
"cuopt_error_t") is adjusted so the rule and example are consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/.coderabbit_review_guide.md:
- Around line 332-337: The fenced example blocks that show template outputs
(e.g., the block containing "CRITICAL: Device buffer leaks on early return.")
are missing a language specifier and trigger MD040; update each of these fenced
code blocks to use a non-executable specifier like ```text (apply the same
change to the other similar example blocks that contain the output templates) so
they are recognized as plaintext in Markdown and static analysis no longer flags
them.
- Around line 49-55: The naming example uses "logic_error" which contradicts the
rule that types use snake_case_t; update the documentation in the naming section
to either note that exception types mirroring std::logic_error are exempt, or
replace "logic_error" with a compliant example such as "cuopt_error_t"; ensure
the doc text around the type naming rule and the examples (mentioning
"logic_error" and the suggested "cuopt_error_t") is adjusted so the rule and
example are consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e892ab24-4819-4695-9897-9945d0742416

📥 Commits

Reviewing files that changed from the base of the PR and between c78a3f0 and c908549.

📒 Files selected for processing (2)
  • .coderabbit.yaml
  • .github/.coderabbit_review_guide.md

@ramakrishnap-nv

Copy link
Copy Markdown
Collaborator Author

/merge

@rapids-bot
rapids-bot Bot merged commit 9361997 into main Apr 27, 2026
23 checks passed
@mlubin
mlubin deleted the refine-coderabbit-guide branch April 27, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improves an existing functionality non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants