Skip to content

test(dht): guard sync_inventory loss branch uses active retract_own_provider (#1962) - #145

Merged
MichaelTaylor3d merged 1 commit into
mainfrom
test/1962-active-retract-guard
Aug 2, 2026
Merged

test(dht): guard sync_inventory loss branch uses active retract_own_provider (#1962)#145
MichaelTaylor3d merged 1 commit into
mainfrom
test/1962-active-retract-guard

Conversation

@MichaelTaylor3d

Copy link
Copy Markdown
Contributor

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 active retract_own_provider (immediate local self-record delete) rather than the passive withdraw_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 to withdraw_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-process DhtHandle/DhtService (the existing test_transport harness — deterministic, no network/port binding), it:

  1. announces a capsule via reconcile_inventory,
  2. evicts it (empty inventory) — driving the loss branch,
  3. asserts find_providers for the evicted id returns empty — proof the local provider record was actively deleted.

Red mutation: reverting the loss branch to withdraw_provider leaves the local record present, so find_providers returns self and the assertion fails.

Verification

  • cargo test -p dig-node-core evicted_capsule_is_actively_retracted_from_local_providersPASS (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].version 0.75.3 → 0.75.4. Cargo.lock updated + committed.


Generated by Claude Code

…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>
@MichaelTaylor3d
MichaelTaylor3d merged commit 80b97dc into main Aug 2, 2026
15 checks passed
@MichaelTaylor3d
MichaelTaylor3d deleted the test/1962-active-retract-guard branch August 2, 2026 15:21
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.

1 participant