Skip to content

fix(id-core): reconcile full holder announcements with prior holdings #10889

Closed

Description

@dezren39

Evidence

pkgs/id/crates/id-core/src/holders.rs:177-181 implements ProviderTable::apply_announcement by recording every hash in the incoming announcement, but it never removes that endpoint's previously announced hashes that are absent from a later complete announcement. The HolderAnnouncement::truncated flag is ignored by this method. The only cleanup is remove_stale at :206-220, which retains records until their age exceeds the stale threshold.

A minimal sequence demonstrates the issue: apply a non-truncated announcement from endpoint E containing hashes A and B, then apply a non-truncated announcement from E containing only A. holders(world, B) still returns E until stale cleanup expires it, despite the refreshed complete announcement saying E no longer holds B. This can direct retrieval toward a peer that no longer has the content. The existing apply_announcement test only covers insertion (:312-320), not replacement/removal.

Why it matters

Fresh announcements refresh records but cannot correct changed holdings. Provider results therefore remain false-positive for a full staleness window, degrading lookup and retrieval reliability.

Suggested fix / acceptance criteria

  • Treat non-truncated announcements as a complete snapshot for that (world, endpoint): remove that endpoint's records for hashes omitted from the snapshot, then record the included hashes.
  • For truncated announcements, do not interpret the prefix as a complete set; retain omitted prior records (or define another explicit reconciliation mechanism).
  • Add regression tests showing complete announcements remove omitted hashes, truncated announcements do not remove omitted hashes, and empty complete announcements clear the endpoint's holdings for that world.
  • Preserve other endpoints and other world buckets during reconciliation.

Related context: closed #2260 established the provider-table foundation and stale expiry; open PR #10576 implements that foundation but does not add snapshot reconciliation.

Activity

  1. developing-today commented on Nov 17, 2026

    @developing-today
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions