Skip to content

Remove unused AddAssign impl for AggregateActiveSwarmMetadata #2823

Closed

Description

@josecelano-bot

Part of EPIC #1347 (finding F4 of the packages/primitives analysis).

impl AddAssign for AggregateActiveSwarmMetadata in packages/primitives/src/swarm_metadata.rs does a plain += on four u64 fields. On overflow it panics in debug and silently wraps in release. Overflow is practically impossible, but we want the edge case to be an explicit, documented decision so agents stop reporting it again and again.

Unused code should not be kept, so the first step is to check whether the impl is used. A removal experiment shows it is not: with the impl deleted, cargo check --workspace --all-targets --all-features and cargo test --doc --workspace both pass. The registry (get_aggregate_swarm_metadata) and torrent-repository-benchmarking sum the fields by hand instead.

Decision (approved by the maintainer): delete the impl and its import. If a user turns up, the fallback is checked_add(..).expect(..) on each field, a #[should_panic] test and a comment saying overflow is practically impossible.

The spec also records, as a lessons-style note, that the registry and the five benchmarking repositories duplicate the aggregate summation.

Activity

  1. added 3 commits that reference this issue on Nov 11, 2026
  2. added a commit that references this issue on Nov 11, 2026
  3. added a commit that references this issue on Nov 11, 2026
  4. added 3 commits that reference this issue on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions