test(dht): guard sync_inventory loss branch uses active retract_own_provider (#1962) - #145
Merged
Merged
Conversation
…rovider (#1962) An evicted capsule's find_providers returns empty; red-mutation = revert dht.rs:460 to withdraw_provider. Closes #1962 Co-Authored-By: Claude <noreply@anthropic.com>
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.
What changed
Closes DIG-Network/dig_ecosystem#1962.
sync_inventory(crates/dig-node-core/src/seams/dig_peer/dht.rs) retracts an evicted capsule's provider record via the activeretract_own_provider(immediate local self-record delete) rather than the passivewithdraw_provider(which only stops re-announcing and lets the record lapse over the ~2h provider TTL). That method-selection — shipped in #1429 and confirmed by the #1632 assessment — had no dig-node-level test pinning it, so a future revert towithdraw_provider(silently reintroducing the 2h stale-self-provider window, where readers keep dialing a node that no longer holds the content) would pass CI unnoticed.This adds that regression guard:
evicted_capsule_is_actively_retracted_from_local_providers. Over an in-processDhtHandle/DhtService(the existingtest_transportharness — deterministic, no network/port binding), it:reconcile_inventory,find_providersfor the evicted id returns empty — proof the local provider record was actively deleted.Red mutation: reverting the loss branch to
withdraw_providerleaves the local record present, sofind_providersreturns self and the assertion fails.Verification
cargo test -p dig-node-core evicted_capsule_is_actively_retracted_from_local_providers→ PASS (1.37s; in-process, not among the known env-limited port-bind tests).cargo fmt --all -- --check→ 0 ·cargo clippy -p dig-node-core --all-targets --all-features -- -D warnings→ 0.Version
test:(test-only addition; the repo's version-increment gate requires a bump) →[workspace.package].version0.75.3 → 0.75.4.Cargo.lockupdated + committed.Generated by Claude Code