feat(primitives): move AnnouncePolicy from configuration to primitives (#1795)#1796
Merged
josecelano merged 4 commits intoMay 19, 2026
Conversation
Move AnnouncePolicy from torrust-tracker-configuration to torrust-tracker-primitives (SI-04 of EPIC torrust#1669). - Move spec from drafts/ to open/ with issue number prefix - Update EPIC torrust#1669 subissues table with torrust#1795 issue link - Link torrust#1795 as subissue of torrust#1669 on GitHub
torrust#1795) Fixes the inverted dependency where torrust-tracker-primitives depended on torrust-tracker-configuration for AnnouncePolicy. After this change: - Before: primitives -> configuration (inverted dep) - After: configuration -> primitives (natural direction) Changes: - Move AnnouncePolicy struct+impls into packages/primitives/src/announce.rs - Export AnnouncePolicy from torrust_tracker_primitives lib.rs - Remove torrust-tracker-configuration dep from primitives/Cargo.toml - Add torrust-tracker-primitives dep to configuration/Cargo.toml - Replace AnnouncePolicy definition in configuration/src/lib.rs with a #[deprecated] re-export for external consumer backwards compatibility - Update configuration/src/v2_0_0/core.rs to import from torrust_tracker_primitives - Update bittorrent-http-tracker-protocol test import + remove unused torrust-tracker-configuration dep from its Cargo.toml - Update bittorrent-tracker-core integration test import - Update announce_handler.rs doc comment import path All acceptance criteria verified: - cargo build --workspace: clean - cargo test --workspace: all pass - linter all: exit code 0 - cargo machete: no unused deps - grep torrust_tracker_configuration::AnnouncePolicy: zero matches Closes torrust#1795 Part of torrust#1669 (SI-04)
Add a note to the run-pre-push-checks skill warning agents that git push is a long-running command (~5 minutes with the pre-push hook installed). Agents must wait for the terminal-completion notification before acting, and should redirect push output to .tmp/ to avoid parsing shared terminal history that may contain unrelated commands.
Member
Author
|
ACK 0bcb28e |
There was a problem hiding this comment.
Pull request overview
Moves AnnouncePolicy from torrust-tracker-configuration to torrust-tracker-primitives to fix an inverted dependency where primitives depended on configuration. A #[deprecated] re-export is kept in configuration for external backwards compatibility.
Changes:
- Moved
AnnouncePolicystruct + impls intopackages/primitives/src/announce.rsand exported fromprimitives/lib.rs. - Flipped the dependency direction: removed
torrust-tracker-configurationfromprimitives/Cargo.toml, addedtorrust-tracker-primitivestoconfiguration/Cargo.toml, and droppedconfigurationfromhttp-protocol/Cargo.toml. - Updated all in-workspace imports (
configuration/v2_0_0/core.rs,tracker-coreintegration test,http-protocoltest, and a doc-comment inannounce_handler.rs) and updated spec/EPIC docs.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/primitives/src/announce.rs | New definition of AnnouncePolicy with serde defaults and Default/Constructor impls. |
| packages/primitives/src/lib.rs | Re-export AnnouncePolicy alongside AnnounceData/AnnounceEvent. |
| packages/primitives/Cargo.toml | Dropped inverted torrust-tracker-configuration dependency. |
| packages/configuration/src/lib.rs | Replaced struct definition with a #[deprecated] pub use re-export. |
| packages/configuration/src/v2_0_0/core.rs | Imports AnnouncePolicy from torrust_tracker_primitives. |
| packages/configuration/Cargo.toml | Adds torrust-tracker-primitives dependency. |
| packages/http-protocol/Cargo.toml | Removes now-unused torrust-tracker-configuration dependency. |
| packages/http-protocol/src/v1/responses/announce.rs | Test import switched to torrust_tracker_primitives. |
| packages/tracker-core/tests/integration.rs | Test import switched to torrust_tracker_primitives. |
| packages/tracker-core/src/announce_handler.rs | Doc-comment import path updated. |
| Cargo.lock | Reflects the dependency flip. |
| docs/issues/open/1795-1669-04-...md | Spec moved from draft to open and marked completed. |
| docs/issues/open/1669-overhaul-packages/EPIC.md | EPIC table updated with issue #1795 links. |
| .github/skills/dev/git-workflow/run-pre-push-checks/SKILL.md | Unrelated guidance for AI agents on long-running git push. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1796 +/- ##
===========================================
- Coverage 77.73% 77.64% -0.09%
===========================================
Files 378 379 +1
Lines 28602 28602
Branches 28602 28602
===========================================
- Hits 22233 22209 -24
- Misses 6063 6080 +17
- Partials 306 313 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
Moves
AnnouncePolicyfromtorrust-tracker-configurationintotorrust-tracker-primitives, fixing an inverted dependency where aprimitivespackage depended on aconfigurationpackage.primitives→configuration(forAnnouncePolicy)configuration→primitives(natural direction)Changes
AnnouncePolicystruct + impls intopackages/primitives/src/announce.rsAnnouncePolicyfromtorrust_tracker_primitiveslib.rstorrust-tracker-configurationdep fromprimitives/Cargo.tomltorrust-tracker-primitivesdep toconfiguration/Cargo.tomlAnnouncePolicydefinition inconfiguration/src/lib.rswith a#[deprecated]re-export for external consumer backwards compatibilityconfiguration/src/v2_0_0/core.rsto import fromtorrust_tracker_primitivesbittorrent-http-tracker-protocoltest import + remove unusedtorrust-tracker-configurationdep from itsCargo.tomlbittorrent-tracker-coreintegration test importannounce_handler.rsdoc comment import pathVerification
cargo build --workspace: cleancargo test --workspace: all passlinter all: exit code 0cargo machete: no unused depsCloses #1795
Part of #1669 (SI-04)