feat(version): add GROVE_V4, behaviourally identical to V3 - #777
Conversation
GROVE_V3 is live, so a fix that changes an accepted/rejected outcome, a committed root hash, or a tracked cost cannot be applied unconditionally — nodes carrying it would diverge from nodes that do not. There is currently nowhere for such a fix to land, which has left several of them stuck: - #776: overwriting an indexed tree with a bare Reference skips the per-axis secondary cleanup. Closing it costs an extra stored-element read on EVERY reference overwrite (+1 seek, +79 storage_loaded_bytes, measured by the refresh-reference cost tests), and references over plain trees are shipped functionality. - Batch DeleteTree treats the caller-declared tree type as authoritative when selecting cleanup namespaces. Reading the stored element instead fixes both an indexed type-confusion and a live CommitmentTree wrong-emptiness-path bug, but adds a read to a released path. - Per project notes, five audit-fix PRs (#726, #730, #732, #734, #739) are gated on v3 and need re-gating before they can merge. This adds the version and nothing else. Every method-version slot is copied from V3 unchanged, so activating protocol version 4 today is a no-op; each gate is a deliberate, separately-reviewable slot bump. Verified rather than assumed: registering V4 changes what `GroveVersion::latest()` resolves to, and the whole test suite defaults to latest. The full workspace suite passes with V4 as latest (2459 grovedb + 705 merk + the rest), and the only two failures were the version registry's own self-describing tests — `grove_version_latest_returns_v3` and `grove_versions_count` — which are updated here. That is the evidence the change is inert. Adds `grove_v4_is_behaviourally_identical_to_v3_until_a_gate_is_added`, which compares every slot and fails the moment one is bumped. That failure is the intended prompt to document the gate rather than let V4 accrete behaviour silently. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 55 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. 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: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughProtocol V4 is added as a public Grove version constant, registered in ChangesGrove protocol V4
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 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 |
It pinned V4's initial state as inert, which was worth verifying once but becomes churn the moment a gate is added — and the DeleteTree read and #776 are both queued to gate on V4 next, so it would fail immediately and be deleted anyway. The evidence it provided is preserved where it belongs: the PR description records that the full workspace suite passed with V4 as latest and that only the registry's own self-describing tests changed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #777 +/- ##
========================================
Coverage 91.49% 91.49%
========================================
Files 240 240
Lines 67763 67763
========================================
Hits 62003 62003
Misses 5760 5760
🚀 New features to boost your workflow:
|
Why
GROVE_V3is live. A fix that changes an accepted/rejected outcome, a committed root hash, or a tracked cost therefore cannot be applied unconditionally — nodes carrying it would diverge from nodes that do not. Today there is nowhere for such a fix to land, which has left several stuck:Referenceoverwrite skips indexed secondary cleanupstorage_loaded_bytes, measured by the refresh-reference cost tests); references over plain trees are shippedDeleteTreetrusts the caller-declared tree type when selecting cleanup namespacesCommitmentTreewrong-emptiness-path bug, but adds a read to a released pathWhat this does
Adds the version and nothing else. Every method-version slot is copied from V3 unchanged, so activating protocol version 4 today is a no-op. Each future gate is a deliberate, separately-reviewable slot bump — the same pattern
add_element_on_transaction: 1already uses inv3.rs.Landing it standalone rather than inside a feature branch means all six of the PRs above can target it independently, and avoids a multi-way conflict in
v4.rs.Verification
Registering V4 changes what
GroveVersion::latest()resolves to, and the whole test suite defaults to latest — so "identical to V3" needed checking, not assuming.The full workspace suite passes with V4 as latest (2459 grovedb + 705 merk + the rest). The only two failures were the version registry's own self-describing tests,
grove_version_latest_returns_v3andgrove_versions_count, both updated here. That the behavioural suite is untouched is the evidence this change is inert.Also adds
grove_v4_is_behaviourally_identical_to_v3_until_a_gate_is_added, which compares every slot and fails the moment one is bumped — the intended prompt to document a gate rather than let V4 accrete behaviour silently.Note for reviewers
This does not activate anything. Platform must adopt protocol version 4 for any future gate to take effect, and until then V1–V3 behaviour is entirely unchanged. Worth deciding the full gate list before activation so "what changes when we turn on 4?" has one answer.
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Tests