MOD-14632 Eliminate panics across codebase#1530
Open
AvivDavid23 wants to merge 2 commits intomasterfrom
Open
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1530 +/- ##
==========================================
- Coverage 76.84% 75.08% -1.77%
==========================================
Files 15 15
Lines 4004 4218 +214
==========================================
+ Hits 3077 3167 +90
- Misses 927 1051 +124 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Trying to eliminate as much a possible from all the panic and unwanted
unwrapsin. the codebase.SelectValuetrait getters, returning anOptionto align we current solution ofget_key,get_values, etc...len()call returnedNoneon aStringvalue type, adebug_assertwill be attached to each of such cases.Note
Medium Risk
Touches core JSONPath evaluation and RedisJSON command/FFI plumbing by changing
SelectValuegetter semantics and adding defensive None/error handling, which could subtly change behavior for edge cases. The change reduces crash risk but needs careful review for any newNull/error returns in previously-panicking paths.Overview
Eliminates panics/
unwrap()in JSONPath and RedisJSON hot paths by changingSelectValuescalar getters (get_str/as_str/get_bool/get_long/get_double) to returnOptionand updating callers to propagateNoneas not comparable / null / error instead of crashing.JSONPath compilation and evaluation is made more defensive (missing parse nodes/filters/ranges now short-circuit with
trace!logging; container iteration macros tolerate absentitems()/values(); tracked-path invariants are asserted via explicitexpect). RedisJSON RDB loading and C API entrypoints now return structured errors/null on invalid inputs rather than panicking, and numeric/object errors are centralized via newerr_not_a_number/err_bad_objecthelpers.CI now runs
cargo clippy(with warnings denied and panic/todo/unimplemented lints) via a new reusableflow-clippy.ymlwired intoevent-ci.yml.Written by Cursor Bugbot for commit 2a4c067. This will update automatically on new commits. Configure here.