fix: handle escaped dots in nested paths - #33528
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Greptile SummaryThis PR fixes
Confidence Score: 5/5This PR is safe to merge — it makes a minimal, targeted change to a single utility function with no effect on callers that use unescaped paths. The regex change correctly handles the new escape syntax while preserving identical behavior for all existing paths that don’t contain No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/litellm_core_utils/dot_notation_indexing.py | Updated _parse_path_segments regex to treat \. as part of the field name rather than a separator, then unescape it before traversal; return type narrowed to list[str]. Change is logically correct and backward-compatible. |
| tests/test_litellm/litellm_core_utils/test_dot_notation_indexing.py | Three new regression tests added: nested key with escaped dot (original bug), top-level key with escaped dot, and key with multiple escaped dots — all with docstrings, addressing previous review feedback. |
Reviews (2): Last reviewed commit: "test: cover escaped dotted path edge cas..." | Re-trigger Greptile
|
This PR is ready for maintainer review The focused core utility tests, lint checks, and coverage checks pass, Greptile scored it 5/5, and there are no unresolved review threads The three remaining CI failures appear unrelated to this change:
This PR changes neither the affected documentation nor dependencies Could a maintainer review the implementation and confirm whether these base-branch failures can be disregarded or rerun after the OSS daily branch is refreshed? |
Relevant issues
No duplicate issue or pull request found after searching for escaped dotted-key deletion behavior
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review)
Screenshots / Proof of Fix
Before at
265bf871bcb85ef09466b59d1cd93b02d2a0f79eAfter at
638b5e92Type
Bug Fix
Changes
Updates nested-path parsing so an escaped dot remains part of a field segment and is unescaped before dictionary traversal
Adds a regression test for deleting a literal dotted key while preserving sibling data
Final Attestation