Repository navigation
fix(rotortree): read snapshot root at maximum depth - #51
Merged
rymnc merged 1 commit intoOct 13, 2026
Merged
Conversation
rymnc
reviewed
Oct 13, 2026
rymnc
left a comment
Member
There was a problem hiding this comment.
thank you for your contribution! please sign the commit so that we can merge after you address the comments :)
Serve root-level snapshot reads from the stored root. Address all review feedback with a focused, shared accessor regression and empty/single-leaf controls. Validation: default and no-default-feature builds each pass 107 tests; all features pass 180 tests. Clippy with warnings denied, nightly formatting, and diff whitespace checks pass. Signed-off-by: Arunim Shukla <54760103+arunimshukla@users.noreply.github.com>
arunimshukla
force-pushed
the
fix/rotortree-snapshot-root-level
branch
from
October 13, 2026 09:07
bd59550 to
83826e9
Compare
rymnc
approved these changes
Oct 13, 2026
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.
Summary
Snapshot root-level accessors could panic after valid insertions reach
MAX_DEPTH. The tree accepts that depth, butlevelshas onlyMAX_DEPTHslots; the root is also stored separately. Readinglevels[depth]at maximum depth indexes beyond that array.The fix serves root-level reads from the snapshot's existing root value. Empty trees still have zero nodes at level zero; non-empty roots have one. Invalid root indices return
IndexOutOfRange. This includes maximum-depth trees before they reach full leaf capacity.The diff remains limited to the two accessors and their tests.
Review changes
self.root, including that the branch applies at every depth.snapshot_get_node_and_level_len.Regression coverage
The consolidated regression checks root length, root hash, and invalid root indices through the public snapshot interface. It covers sequential and batch insertion for binary depths one and three and ternary depth two, including every leaf count in each configuration's maximum-depth range. A separate control preserves empty and single-leaf behaviour.
With the revised tests and the upstream implementation at
e5061c8,cargo test -p rotortree --test tree snapshot_reports 1 failed, 3 passed. The maximum-depth regression fails with an index-out-of-bounds panic. Restoring the patch produces 4 passed, 0 failed.Validation
Rechecked the revised code using Rust 1.95.0:
cargo test -p rotortreecargo test -p rotortree --all-featurescargo test -p rotortree --no-default-featurescargo clippy -p rotortree --all-features -- -D warningscargo +nightly fmt --all --checkgit diff --checkCounts include doctests where applicable. The test count drops by one because the accessor regressions are consolidated. These are local results; the repository's complete CI feature powerset is checked separately by CI. The updated upstream CI run currently requires maintainer approval to run the fork workflow.
The revised PR contains one commit with a GitHub-verified signature and a sign-off.