Skip to content

[ENH] Skip premerge CPU tests for documentation-only bundle changes#779

Open
lapertor wants to merge 2 commits intoProject-MONAI:devfrom
lapertor:feat/issue-756-skip-doc-only-tests
Open

[ENH] Skip premerge CPU tests for documentation-only bundle changes#779
lapertor wants to merge 2 commits intoProject-MONAI:devfrom
lapertor:feat/issue-756-skip-doc-only-tests

Conversation

@lapertor
Copy link
Copy Markdown

@lapertor lapertor commented Mar 30, 2026

Closes #756.

Description

When a pull request only modifies documentation files inside a bundle (files in a docs/ directory or with a .md extension), the premerge CPU test suite now skips that bundle entirely. If a bundle has both documentation and code changes, it is still tested as usual.

Changes:

  • ci/utils.py: add is_doc_file() helper and a filter_docs parameter to get_changed_bundle_list(). Documentation files are defined as files inside a docs/ directory or with a .md extension.
  • ci/get_changed_bundle.py: expose --filter_docs as a CLI argument, propagated to both get_changed_bundle() and get_changed_hf_model().
  • ci/run_premerge_cpu.sh: pass --filter_docs True to both get_changed_bundle.py calls (regular bundles and HuggingFace models).

The filter_docs parameter defaults to False, so weekly tests and Blossom CI are not affected.

Status

Ready

Please ensure all the checkboxes:

  • Codeformat tests passed locally by running ./runtests.sh --codeformat.
  • In-line docstrings updated.

Summary by CodeRabbit

  • Chores
    • CI premerge checks updated to optionally ignore documentation-only changes when detecting changed bundles or models, reducing false-positive verifications for doc-only edits.
    • Command-line tooling enhanced with flags to select HF model mode and to enable/disable documentation filtering for change detection.

Bundles whose only modified files are documentation (files inside a
docs/ directory or with a .md extension) are now excluded from the
premerge CPU test suite. This avoids unnecessary resource consumption
when a pull request changes only README files, images, or other
documentation assets.

The filtering is implemented via a new --filter_docs flag in
get_changed_bundle.py and a helper is_doc_file() in utils.py. The
flag defaults to False so existing callers (weekly tests, Blossom CI)
are not affected.

Fixes Project-MONAI#756

Signed-off-by: Raphael Lapertot <raphael.lapertot@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d713886f-b886-4d6e-b751-1763d55c3f51

📥 Commits

Reviewing files that changed from the base of the PR and between 3f76c9a and e417627.

📒 Files selected for processing (2)
  • ci/get_changed_bundle.py
  • ci/run_premerge_cpu.sh

Walkthrough

Adds an optional documentation-filtering flag that prevents docs-only changes from counting as changed bundles/models in CI. The flag flows from CLI (ci/get_changed_bundle.py) into utility logic (ci/utils.py) and is used by the premerge CPU script to request filtered results.

Changes

Cohort / File(s) Summary
Bundle & HF-model CLI
ci/get_changed_bundle.py
Added filter_docs: bool = False parameter to get_changed_bundle() and get_changed_hf_model(). Updated CLI to use --hf_model and --filter_docs as store_true flags and forward args.filter_docs into the selected function call.
Utilities: changed-bundle logic
ci/utils.py
Added DOC_DIR_NAME, DOC_FILE_EXTENSIONS, helper is_doc_file(filepath), and filter_docs: bool = False parameter to get_changed_bundle_list(...). When enabled, documentation-only paths (e.g., docs/ or .md) are removed before computing changed bundles.
Premerge pipeline
ci/run_premerge_cpu.sh
Invoke ci/get_changed_bundle.py with the new --filter_docs flag (and --hf_model as a flag when computing HF models) so bundle/HF-model lists can exclude doc-only changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nudge the repo, soft and spry,
Docs left untouched — tests pass by.
A hop, a flag, CI breathes light,
Bundles trimmed, and all feels right. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.58% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main enhancement: skipping premerge CPU tests for documentation-only bundle changes, which is the primary objective of the PR.
Description check ✅ Passed The description clearly explains the changes, motivation, and implementation details across all modified files, addressing the linked issue #756.
Linked Issues check ✅ Passed The PR fully implements the requirement from issue #756 to skip CPU tests for documentation-only changes by adding filtering logic at bundle level.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing documentation-only change detection and filtering. Line ending normalization (CRLF to LF) in shell scripts is a standard cleanup task.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ci/get_changed_bundle.py`:
- Around line 48-51: The argparse flags for hf_model and filter_docs are using
type=bool which treats any non-empty string as True; change the
parser.add_argument calls for "--hf_model" and "--filter_docs" to use
action="store_true" instead of type=bool/default, and then update usages in
ci/run_premerge_cpu.sh to pass the flags as switches (e.g., --filter_docs and
--hf_model) rather than as string values like "True"/"False" so disabling is
done by omitting the flag.

In `@ci/run_premerge_cpu.sh`:
- Around line 1-164: The script contains Windows CRLF line endings which break
execution; open the shell script with the "#!/bin/bash" shebang (look for
functions init_venv, remove_venv, verify_bundle) and convert all CRLF to LF-only
line endings (e.g., run a line-ending conversion like dos2unix or sed -i
's/\r$//' on the file) and re-commit the corrected file so the CI runner uses
Unix-style LF endings.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 13022102-ebe9-4b74-a78d-2e978528228b

📥 Commits

Reviewing files that changed from the base of the PR and between d86a119 and 3f76c9a.

📒 Files selected for processing (3)
  • ci/get_changed_bundle.py
  • ci/run_premerge_cpu.sh
  • ci/utils.py

Replace type=bool with action='store_true' for --hf_model and
--filter_docs arguments. Using type=bool causes bool('False') == True,
making it impossible to reliably disable flags from the command line.

Also convert CRLF to LF line endings in run_premerge_cpu.sh, which
had mixed line endings after the previous edit.

Suggested by coderabbitai review on Project-MONAI#779.

Signed-off-by: Raphael Lapertot <raphael.lapertot@gmail.com>
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.

enhance Test rules

1 participant