[None][fix] Improve scope conflict handling in Selector class#16181
Conversation
…#16170) Updated the logic in the Selector class to provide clearer reasons when scopes cannot be combined. The new implementation distinguishes between forced fallbacks and actionable scopes, enhancing the feedback provided during selection failures. Signed-off-by: yufeiwu-nv <230315618+yufeiwu-nv@users.noreply.github.com>
|
/bot run |
📝 WalkthroughWalkthroughThe change refines the scope-combination fallback logic in Selector.run within jenkins/scripts/cbts/main.py. It now differentiates between a forced fallback triggered by rules with scope is None (listing forcing rule names) and an incompatible-scope conflict (listing distinct actionable scopes) in the reported reason string. ChangesSelector Fallback Reason Refinement
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
jenkins/scripts/cbts/main.py (1)
192-200: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueGood improvement to fallback diagnostics; one style nit.
The distinction between forced-fallback and genuine scope-conflict is a clear improvement. Static analysis flags the list concatenation on line 200 — worth adopting the more idiomatic unpacking form.
🎨 Style suggestion
- return SelectionResult(scope=None, reasons=reasons + [summary]) + return SelectionResult(scope=None, reasons=[*reasons, summary])🤖 Prompt for 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. In `@jenkins/scripts/cbts/main.py` around lines 192 - 200, Update the scope=None branch in the selection logic to use the more idiomatic unpacking form instead of concatenating the reasons list when building SelectionResult. In the block that constructs summary and returns SelectionResult, replace the manual list concatenation pattern with an unpacked reasons sequence while preserving the forced-fallback vs scope-conflict behavior.Source: Linters/SAST tools
🤖 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.
Nitpick comments:
In `@jenkins/scripts/cbts/main.py`:
- Around line 192-200: Update the scope=None branch in the selection logic to
use the more idiomatic unpacking form instead of concatenating the reasons list
when building SelectionResult. In the block that constructs summary and returns
SelectionResult, replace the manual list concatenation pattern with an unpacked
reasons sequence while preserving the forced-fallback vs scope-conflict
behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 77fe4f58-a6f4-4a93-a6c9-60043802dd73
📒 Files selected for processing (1)
jenkins/scripts/cbts/main.py
|
PR_Github #58406 [ run ] triggered by Bot. Commit: |
|
PR_Github #58406 [ run ] completed with state |
|
/bot reuse-pipeline |
|
PR_Github #58654 [ reuse-pipeline ] triggered by Bot. Commit: |
|
PR_Github #58654 [ reuse-pipeline ] completed with state |
Updated the logic in the Selector class to provide clearer reasons when scopes cannot be combined. The new implementation distinguishes between forced fallbacks and actionable scopes, enhancing the feedback provided during selection failures.
Signed-off-by: yufeiwu-nv 230315618+yufeiwu-nv@users.noreply.github.com
Summary by CodeRabbit
Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.