fix(files): never mutate the shared PROPFIND property lists - #455
Conversation
|
Warning Review limit reached
Next review available in: 24 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change prevents shared PROPFIND property collections from growing across calls. It uses immutable typed constants, fresh lists for extensions, sequence-based annotations, and regression tests for synchronous and asynchronous TrashBin requests. ChangesPROPFIND property handling
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
get_propfind_properties() aliased the module-level PROPFIND_PROPERTIES and extended it with +=, and both trashbin_list() implementations did the same, so the shared list grew by 7 entries per call on servers advertising files.locking and by 3 per trashbin_list(). A long-running client ended up sending multi-megabyte PROPFIND bodies, and the server cost is O(properties x resources), so it could starve the Nextcloud instance it was talking to. Build a fresh list in each of the three places and turn both constants into tuples, so any future in-place mutation fails immediately instead of silently corrupting shared state. Closes #453 Signed-off-by: Oleksandr Piskun <oleksandr2088@icloud.com>
b429b26 to
e03c69a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #455 +/- ##
==========================================
+ Coverage 94.69% 94.75% +0.06%
==========================================
Files 48 49 +1
Lines 5650 5724 +74
==========================================
+ Hits 5350 5424 +74
Misses 300 300
🚀 New features to boost your workflow:
|
The mutation checks bound the constants by name instead of copying them, so the comparison could never fail if the constants were ever lists again: on the unfixed code that test passed while the list was being corrupted. Snapshot both constants at import time and assert against those copies, and pin that the helper still returns a list. Signed-off-by: Oleksandr Piskun <oleksandr2088@icloud.com>
get_propfind_properties()and bothtrashbin_list()implementations extended the sharedPROPFIND_PROPERTIESconstant with+=instead of copying it, so it grew on every call: +7 entries when the server advertisesfiles.locking, +3 pertrashbin_list(). Long-running clients ended up sending multi-megabyte PROPFIND bodies (measured: ~138 bytes of growth perlistdir()call), and the server cost isO(properties x resources).Final[tuple[str, ...]], so in-place mutation cannot come backSequence[str]where those lists are only iteratedtests_unit/, verified to fail onmainCloses #453
Summary by CodeRabbit
Bug Fixes
Tests