Repository navigation
Fix [Bug]: Save parser configs in dataset configuration page is not working #15175 - #15177
Conversation
📝 WalkthroughWalkthroughThe PR modifies ChangesAvatar validation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@api/utils/validation_utils.py`:
- Around line 560-561: The current check "if not v: return v" in
validation_utils.py returns empty strings as-is which causes empty avatar to be
persisted; change this branch to explicitly normalize empty string to None
(i.e., if v is None or v == "" return None) so empty avatars are treated as
unset, and add a debug/info log entry (using the module logger) indicating an
avatar value was normalized to None to satisfy the "*.py logging" guideline;
update references to the symbol v and the surrounding validation function so
callers receive None instead of "".
🪄 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: ba542ecd-5492-44cc-be86-01ad4cfeaa54
📒 Files selected for processing (1)
api/utils/validation_utils.py
| if not v: # cover both None and empty string | ||
| return v |
There was a problem hiding this comment.
Normalize empty avatar to None instead of persisting empty string.
This branch currently returns "" unchanged, and that value flows into dataset creation/persistence. Treating empty avatar as None avoids inconsistent “unset” representations downstream.
Suggested fix
- if not v: # cover both None and empty string
- return v
+ if not v: # cover both None and empty string
+ return NoneAs per coding guidelines, "**/*.py: Add logging for new flows" and this new flow should keep behavior explicit and consistent in backend request handling.
🤖 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 `@api/utils/validation_utils.py` around lines 560 - 561, The current check "if
not v: return v" in validation_utils.py returns empty strings as-is which causes
empty avatar to be persisted; change this branch to explicitly normalize empty
string to None (i.e., if v is None or v == "" return None) so empty avatars are
treated as unset, and add a debug/info log entry (using the module logger)
indicating an avatar value was normalized to None to satisfy the "*.py logging"
guideline; update references to the symbol v and the surrounding validation
function so callers receive None instead of "".
|
LGTM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15177 +/- ##
==========================================
- Coverage 94.53% 93.12% -1.41%
==========================================
Files 10 10
Lines 713 713
Branches 116 116
==========================================
- Hits 674 664 -10
- Misses 25 29 +4
- Partials 14 20 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What problem does this PR solve?
Fix [Bug]: Save parser configs in dataset configuration page is not working #15175
Type of change