Skip to content

fix(replication): gate audits by mature repair proofs#106

Open
mickvandijke wants to merge 7 commits into
WithAutonomi:mainfrom
mickvandijke:fix/replication-repair-proof-epochs
Open

fix(replication): gate audits by mature repair proofs#106
mickvandijke wants to merge 7 commits into
WithAutonomi:mainfrom
mickvandijke:fix/replication-repair-proof-epochs

Conversation

@mickvandijke
Copy link
Copy Markdown
Collaborator

Summary:

  • Track repair proofs with close-group snapshots and local sync-cycle epochs.
  • Require mature key-specific proofs for normal audits and prune-confirmation audits.
  • Invalidate stale proofs on close-group changes, local key deletion, and peer removal so re-entry requires a fresh hint.

SemVer: patch

Tests:

  • cargo fmt --all -- --check
  • cargo check --lib
  • cargo test --lib replication::types::tests::repair_proofs
  • cargo test --lib replication::
  • cargo clippy --lib --all-features -- -D warnings

Note: full all-target clippy is still blocked locally by the existing duplicate saorsa_core path override in unstaged Cargo.toml/Cargo.lock.

Copilot AI review requested due to automatic review settings May 20, 2026 13:47
Track key-specific repair hints per close group and require proof before auditing or prune-confirming a peer for a key.

SemVer: patch
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens replication audit and prune-confirmation eligibility by requiring key-specific “repair proof” evidence (tied to a close-group snapshot and local sync-cycle epoch) before a peer can be audited or used for prune-confirmation. It also adds lifecycle invalidation for those proofs (close-group changes, local key deletion, peer removal) and wires proof tracking through neighbor-sync, audit, and pruning.

Changes:

  • Introduce RepairProofs to record per-(peer, key) replica-hint evidence, including maturity by local sync-cycle epoch and invalidation rules.
  • Gate normal audits and prune-confirmation audits on mature repair proofs; clear proofs on record deletion and peer removal.
  • Update replication internals and e2e tests to pass new context (repair proofs + epoch) through pruning and audit flows.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/e2e/replication.rs Updates prune-pass e2e test to construct/seed RepairProofs and provide sync epoch context.
src/replication/types.rs Adds RepairProofs data structure + unit tests for proof recording, maturity, and invalidation.
src/replication/pruning.rs Refactors prune pass to take a context struct and requires mature proofs before prune-confirmation audits; clears proofs on deletion.
src/replication/neighbor_sync.rs Returns NeighborSyncOutcome to track which replica hints were sent (for proof recording).
src/replication/mod.rs Adds sync-cycle epoch + proof table to the engine, records sent hints as proofs, clears proofs on peer removal, and threads new parameters into audit/prune.
src/replication/audit.rs Filters audited (peer, key) pairs to those with mature repair proofs.
docs/REPLICATION_DESIGN.md Updates design doc invariants/rules to describe key-specific RepairProof and maturity gating.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/replication/mod.rs
Comment thread src/replication/mod.rs Outdated
Comment thread src/replication/pruning.rs Outdated
Comment thread src/replication/neighbor_sync.rs
Comment thread src/replication/audit.rs
Invalidate key repair proofs when close-group membership changes and require a completed sync-cycle epoch before audits or prune-confirmation challenges can use a proof.

SemVer: patch
@mickvandijke mickvandijke force-pushed the fix/replication-repair-proof-epochs branch from 99846c5 to 98c20ea Compare May 20, 2026 14:01
Avoid cloning full neighbor-sync responses when recording repair hints, and carry close-group snapshots from hint construction into proof recording instead of performing another DHT lookup per hinted key.

Keep the public audit, prune, and neighbor-sync entry points compatible while routing the engine through proof-aware internal variants.

SemVer: patch
Copilot AI review requested due to automatic review settings May 20, 2026 14:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread src/replication/mod.rs Outdated
Comment thread src/replication/pruning.rs
Document the send success boolean used by repair proof recording and make the conservative behavior of the legacy prune wrapper explicit.

SemVer: patch
Copilot AI review requested due to automatic review settings May 20, 2026 16:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread src/replication/types.rs
Comment thread src/replication/pruning.rs
Copilot AI review requested due to automatic review settings May 20, 2026 17:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src/replication/mod.rs
Comment on lines 1533 to +1549
@@ -1484,13 +1546,13 @@ async fn send_replication_response(
request_id: u64,
body: ReplicationMessageBody,
rr_message_id: Option<&str>,
) {
) -> bool {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants