docs: document chunk restore height placeholder safety (#15)#619
Conversation
During chunk restoration, Link::Reference entries at chunk boundaries store placeholder child heights (0,0) because the referenced subtree has not been received yet. This is safe by design: the Restorer owns the Merk exclusively, no balancing occurs during restoration, and finalize() verifies and rewrites all heights before returning. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #619 +/- ##
========================================
Coverage 90.70% 90.70%
========================================
Files 182 182
Lines 50734 50734
========================================
Hits 46016 46016
Misses 4718 4718
🚀 New features to boost your workflow:
|
Summary
Restorerstruct,write_chunk,finalize,rewrite_heights, andChild::as_linkexplaining the three-layer safety guarantee: exclusive ownership, no structural mutations during restore, and mandatory height verification/rewrite infinalize()Analysis
During chunk restoration,
Link::Referenceentries at chunk boundaries are written with placeholderchild_heightsof(0, 0)because the actual subtree behind aNode::Hashhas not yet been received. Finding #15 noted these heights are "trusted before verification."Conclusion: Safe by design. The Restorer exclusively owns the Merk during restoration -- no external queries, inserts, or AVL rebalancing occur on the partially-restored tree. The
finalize()method performs a full recursive height audit viaverify_height()and, if any discrepancy is found,rewrite_heights()traverses the entire tree bottom-up to compute correct heights from the actual structure. A Merk with incorrect heights can never escape the Restorer.Test plan
cargo check -p grovedb-merk --features fullpassescargo fmt -- --checkpasses🤖 Generated with Claude Code