You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Directory.dir_root in xrpl/models/requests/ledger_entry.py is changed from a required field (str = REQUIRED) to an optional field (Optional[str] = None). A new test verifies that a LedgerEntry with a Directory using only owner and sub_index (no dir_root) passes validation.
Changes
Directory.dir_root optionality fix
Layer / File(s)
Summary
Directory.dir_root made optional + test coverage xrpl/models/requests/ledger_entry.py, tests/unit/models/requests/test_ledger_entry.py
dir_root is changed from str = REQUIRED to Optional[str] = None with an updated docstring. Directory is imported in the test module and a new test asserts that LedgerEntry(directory=Directory(owner=..., sub_index=0), ledger_index="validated") is valid.
Estimated code review effort
🎯 1 (Trivial) | ⏱️ ~3 minutes
Poem
A rabbit once tripped on a field marked "required,"
But dir_root was optional — just poorly attired.
Now None by default, it hops free with delight,
With owner and sub_index both doing it right.
🐇✨ No more XRPLModelException in sight!
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name
Status
Explanation
Resolution
Docstring Coverage
⚠️ Warning
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check
❓ Inconclusive
The PR description covers the high-level overview, context of change, type of change, and test plan, but is missing the CHANGELOG.md update section.
Add a clear indication of whether CHANGELOG.md was updated, following the template's 'Did you update CHANGELOG.md?' section with Yes/No and reasoning.
✅ Passed checks (3 passed)
Check name
Status
Explanation
Title check
✅ Passed
The title clearly and specifically identifies the main change: making the dir_root field optional in the Directory ledger entry request model.
Linked Issues check
✅ Passed
The PR successfully addresses issue #885 by making dir_root optional in the Directory model and adding unit test coverage for owner+sub_index lookups, directly resolving the reported validation error.
Out of Scope Changes check
✅ Passed
All changes are directly scoped to fixing issue #885: modifying the Directory model's dir_root field and adding corresponding unit test coverage with no unrelated alterations.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches🧪 Generate unit tests (beta)
Create PR with unit tests
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 @coderabbitai help to get the list of available commands and usage tips.
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
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.
High Level Overview
Make
Directory.dir_rootoptional in theledger_entryrequest model so lookups byowner+sub_indexwork with the typed Python API.Context of Change
Fixes #885. The XRPL server accepts directory lookups without
dir_root, but xrpl-py rejected them at model validation time.Type of Change
Test plan
poetry run poe test tests/unit/models/requests/test_ledger_entry.pypoetry run poe lint