Skip to content

Gate tracker-core's test modules and mocks (#2482 subissue 3) #2681

Description

@josecelano

Subissue 3 of sub-EPIC #2482 (Reorganize test support code shared between workspace packages), itself a sub-EPIC of EPIC #1669 (Overhaul: Packages). It applies rules C and D of the ADR docs/adrs/20261021190318_share_workspace_test_support_through_testing_features.md to tracker-core, and it is the first row that adds a testing feature to a real crate, so the Shipped Features job of #2670 finally has something to check.

Goal

Make tracker-core's crate-private test helper modules private, and compile the one mock that other packages' tests use (MockTorrentMetricsStore) only behind a non-default testing feature, so mockall leaves tracker-core's normal dependencies and no Mock* type is in its default public API.

Why

lib.rs and whitelist/mod.rs declare pub mod peer_tests; and pub mod test_helpers; although their content is #[cfg(test)], which adds empty public modules to the API. The four #[automock] database traits make mockall a normal dependency and put four Mock* types in the public API, but only MockTorrentMetricsStore is used by other packages (http-core and udp-core unit tests). The other three are crate-private test support and use cfg_attr(test, automock) (rule D.2).

Tasks

  • T1: record the baseline (dependency tree and test counts) and audit the other normal dependencies.
  • T2: rule C: make the three helper modules private.
  • T3: rule D.2: the three crate-private mocks use cfg_attr(test, automock).
  • T4: rule D: gate MockTorrentMetricsStore behind testing with an optional mockall, the path-only self dev-dependency, the deny.toml wrapper entry and the consumers' dev-dependency entries.
  • T5: verify (builds without the feature, tests with and without --all-features, Shipped Features red and green, coupling labels, packaging).
  • T6: update the inventory.
  • T7: add a dated amendment note to ADR rule D.1.
  • T8: manual verification evidence, acceptance review, completion review.

The full specification is in the spec PR that follows.

Activity

  1. added 5 commits that reference this issue on Oct 28, 2026
  2. self-assigned this
    on Oct 28, 2026
  3. added 3 commits that reference this issue on Oct 28, 2026
  4. josecelano commented on Oct 28, 2026

    @josecelano
    MemberAuthor

    Reopened by the #2482 coordinator: spec-only PR #2682 closed this issue by accident. Its body said the implementation PR "will close" the issue, and the maintainer merge tool copies the PR body into the merge commit, so GitHub applied the closing keyword. The implementation PR is still to come and will close it.

  5. 12 remaining items

  6. added 8 commits that reference this issue on Oct 29, 2026
  7. added a commit that references this issue on Oct 29, 2026
  8. added 5 commits that reference this issue on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions