fix(library): missing "global $relevant_chunks" declaration in hf_classifier retrieval flows - #2201
Conversation
PR merge guidance@ekam-walia thanks for the PR. GitHub is currently blocking merge for one or more repository requirements:
Relevant guide: |
|
cc @Pouyanpi |
3a0d450 to
c10d0b5
Compare
|
@Pouyanpi can you please review, if the code is making sense |
|
@Pouyanpi any updates on this PR |
|
@ekam-walia I've reviewed your PR but you've not addressed my review comments. Please take a look |
Greptile SummaryFixes retrieval-chunk propagation across both Colang dialects.
|
| Filename | Overview |
|---|---|
| nemoguardrails/library/hf_classifier/flows.co | Adds the valid Colang 2.x global declaration so transformed retrieval chunks propagate to the calling context. |
| nemoguardrails/library/hf_classifier/flows.v1.co | Preserves direct shared-context assignment while removing the unsupported global statement and avoiding reliance on a subflow return value. |
| tests/test_hf_classifier_retrieval_global.py | Adds regression scenarios covering transformed chunks, unchanged chunks, empty transformations, and blocked retrieval checks. |
Reviews (3): Last reviewed commit: "." | Re-trigger Greptile
📝 WalkthroughWalkthroughThe HF classifier retrieval flows now propagate transformed ChangesHF classifier retrieval propagation
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 `@tests/test_hf_classifier_retrieval_global.py`:
- Around line 1-13: Remove the manually added copyright and Apache license
header from tests/test_hf_classifier_retrieval_global.py, leaving pre-commit to
insert the repository-standard header automatically.
- Line 36: Remove the newly added explanatory # comments throughout the test
cases in tests/test_hf_classifier_retrieval_global.py, including the listed
ranges, while preserving all test code and behavior unchanged.
- Around line 202-240: Update
test_hf_classifier_v1_retrieval_blocked_with_exceptions to exercise the
retrieval flow and changed retrieval scope rather than registering and executing
hf_classifier_check_input. Either move the test into the input-flow test area if
it is intended to cover input behavior, or register and invoke the retrieval
action/flow while preserving the assertion that blocked processing leaves
relevant_chunks unchanged.
- Around line 163-200: Update
test_hf_classifier_v1_retrieval_with_empty_transform_text so
MockHfClassifierResponse.transform_text includes an empty relevant_chunks value,
matching the v1 flow’s transform_text["relevant_chunks"] lookup. Assert both the
original_chunks context and relevant_chunks context, verifying the original
remains unchanged while the transformed value is propagated.
🪄 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: baf1210b-6c7a-4c74-848f-478752181795
📒 Files selected for processing (3)
nemoguardrails/library/hf_classifier/flows.conemoguardrails/library/hf_classifier/flows.v1.cotests/test_hf_classifier_retrieval_global.py
|
@Pouyanpi ptal made the reqd changes |
Description
Added
global $relevant_chunksbefore the reassignment in both flow files:nemoguardrails/library/hf_classifier/flows.conemoguardrails/library/hf_classifier/flows.v1.coRelated Issue(s)
Every PR must link to a triaged issue assigned to the PR author.
Verification
AI Assistance
Checklist
Summary by CodeRabbit
Bug Fixes
Tests