refactor(storage): remove the dead state-based comparisons sync path#3215
refactor(storage): remove the dead state-based comparisons sync path#3215chefsale wants to merge 1 commit into
Conversation
The legacy state-based Merkle comparison sync (`compare_trees` /
`StorageDelta::Comparisons`) is superseded by the HashComparison / level-wise /
DAG-CausalActions protocols and is unreachable in production. This was
confirmed by hard-abort probes at all three of its entry points (emit via
`commit_root`, receive via `apply_comparisons`, and the `Action::Compare`
receive-arm) riding the real multi-node divergence e2e suite
(partition / peer-restart / peer-pause / 8-node mesh-soak / concurrent-rotation /
HashComparison-reconcile / member-removed-catchup): none fired.
Removed:
- `Interface::{compare_trees, compare_affective, generate_comparison_data}`
- `StorageDelta::Comparisons` variant, `Comparison` (integration.rs, file
deleted), `ComparisonData` (action.rs)
- `Root::apply_comparisons` + the `Comparisons` arm of `Root::sync`
- `delta::push_comparison`, the `DeltaContext.comparisons` field, and the
Comparisons branch of `commit_root` / `commit_causal_delta`
- `Index::get_collection_names_for` (only used by the removed path)
- the inert `Action::Compare` pushes in `apply_action` (they only fed the
removed protocol; Merkle convergence is handled by HashComparison) and the
stale "ships in the next outbound delta" comment
Kept:
- the `Action::Compare` enum variant (still referenced defensively across
op-adapter / node delta_store / signing / runtime); its `Root::sync` and
`apply_action` arms are now inert no-ops / rejections
- wire tags: `StorageDelta` gains a hand-rolled `BorshSerialize` so
`CausalActions` keeps tag 2 (tag 1, the removed variant, is now rejected) —
every persisted and in-flight delta stays decodable. The zero-byte no-op
sentinel now decodes to `Actions(vec![])`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🤖 MeroReviewer
Reviewed by 1 agents | Quality score: 85% | Review time: 527.2s
✅ No Issues Found
All agents reviewed the code and found no issues. LGTM! 🎉
🤖 Generated by MeroReviewer | Review ID: review-3fa9af2b
Documentation ReviewThe following documentation may need updates based on the changes in this PR:
|
There was a problem hiding this comment.
🤖 AI Code Reviewer
Reviewed by 3 agents | Quality score: 95% | Review time: 1180.4s
⚠️ Review Incomplete
1 of 3 agent(s) did not finish (security-reviewer) and no findings were produced. Treat this PR as not yet reviewed, not as approved.
🤖 Generated by AI Code Reviewer | Review ID: review-d135c8bf
|
Superseded by #3216, which merged the identical removal to master (same hand-rolled |
What
Removes the legacy state-based Merkle comparison sync (
compare_trees/StorageDelta::Comparisons), which is superseded by the HashComparison / level-wise / DAG-CausalActions protocols and is unreachable in production. Net −680 lines.Why it's safe (evidence, not just static analysis)
Follow-up to the probe PR (#3209). Static analysis showed the path was dead; to confirm it independent of log capture, that PR made all three of its entry points hard-abort:
commit_rootproducing aComparisonsartifact,Root::sync→apply_comparisons,Action::Comparereceive-arm inapply_actions.CI ran the full multi-node divergence e2e suite (partition, peer-restart, peer-pause, 8-node mesh-soak, concurrent-rotation-converge, HashComparison-reconcile, member-removed-catchup). None of the aborts fired → the path is exercised by neither production sync nor the test suite.
Removed
Interface::{compare_trees, compare_affective, generate_comparison_data}StorageDelta::Comparisonsvariant;Comparison(integration.rs — file deleted);ComparisonData(action.rs)Root::apply_comparisons+ theComparisonsarm ofRoot::syncdelta::push_comparison,DeltaContext.comparisons, and the Comparisons branch ofcommit_root/commit_causal_deltaIndex::get_collection_names_for(only the removed path used it)Action::Comparepushes inapply_action(they only fed the removed protocol) and the now-false "ships in the next outbound delta" commentKept / compatibility
Action::Compareenum variant stays — it's referenced defensively across op-adapter / nodedelta_store/ signing / runtime. ItsRoot::syncandapply_actionarms are now inert (no-op / reject).StorageDeltagains a hand-rolledBorshSerializesoCausalActionskeeps tag 2 (tag 1 — the removed variant — is now rejected). Every persisted and in-flight delta stays decodable; this is wire-stability, not a migration shim. The zero-byte no-op sentinel now decodes toActions(vec![]).Verification
cargo clippy --workspace --all-targets --features calimero-storage/testing -- -D warnings— cleancargo test -p calimero-storage --features testing— 667 passed, 0 failed (incl. rewrittenStorageDeltawire-format roundtrip tests)🤖 Generated with Claude Code