Skip to content

Commit ca97cce

Browse files
committed
Merge #1796: feat(primitives): move AnnouncePolicy from configuration to primitives (#1795)
0bcb28e docs(issues): update spec #1795 with related PR #1796 (Jose Celano) 3643296 docs(skills): add AI agent guidance for git push in pre-push skill (Jose Celano) 9186fe8 feat(primitives): move AnnouncePolicy from configuration to primitives (#1795) (Jose Celano) b3c7795 docs(issues): add issue specification for #1795 (Jose Celano) Pull request description: ## Summary Moves `AnnouncePolicy` from `torrust-tracker-configuration` into `torrust-tracker-primitives`, fixing an inverted dependency where a `primitives` package depended on a `configuration` package. - **Before**: `primitives` → `configuration` (for `AnnouncePolicy`) - **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 ## Verification - `cargo build --workspace`: clean - `cargo test --workspace`: all pass - `linter all`: exit code 0 - `cargo machete`: no unused deps Closes #1795 Part of #1669 (SI-04) ACKs for top commit: josecelano: ACK 0bcb28e Tree-SHA512: 0b950a78eef9078ab6c66209930f6a7d6fe0ab20119e658c3f710bfd8824075d33a76a39ad258d91c8a984e7522c2bdb3428762002fe14be5a20acf22ef3caef
2 parents 6b8cb35 + 0bcb28e commit ca97cce

14 files changed

Lines changed: 125 additions & 96 deletions

File tree

.github/skills/dev/git-workflow/run-pre-push-checks/SKILL.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ manually before each push.
3434
> **⏱️ Expected runtime: ~5 minutes** on a modern developer machine with warm caches.
3535
> AI agents should set a command timeout of **at least 15 minutes** before invoking
3636
> `./contrib/dev-tools/git/hooks/pre-push.sh`.
37+
>
38+
> **For AI agents — `git push` is a long-running command:**
39+
> When the pre-push hook is installed, `git push` runs the full check suite (~5 minutes)
40+
> before sending objects to the remote. Do **not** poll, retry, or issue a second `git push`
41+
> while the first is still running. Wait for the IDE terminal-completion notification
42+
> (exit code + output) before taking any follow-up action.
43+
>
44+
> To avoid parsing shared terminal history (which other commands or the user may have
45+
> populated), redirect the output to a dedicated file and read that file for results:
46+
>
47+
> ```bash
48+
> git push <remote> <branch> > .tmp/push-output.txt 2>&1; echo "Exit: $?" >> .tmp/push-output.txt
49+
> ```
50+
>
51+
> The `.tmp/` directory is git-ignored. Clean stale files periodically.
3752
3853
Run the pre-push script. **It must exit with code `0` before every push.**
3954

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/issues/open/1669-overhaul-packages/EPIC.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ Status: TODO unless noted. `SI-XX` = recommended implementation sequence number.
207207
- [ ] SI-01 — Establish baseline: dependency graph + README audit _(analysis; no blockers; informs all other subissues)_
208208
- [x] SI-02 — Move `DurationSinceUnixEpoch` from `torrust-tracker-primitives` to `torrust-tracker-clock` _(Rule M; no hard blockers)_
209209
- [ ] SI-03 — Define per-package default timeout constants and remove `DEFAULT_TIMEOUT` from `torrust-tracker-configuration` _(Rule M; no blockers)_
210-
- [ ] SI-04 — Move `AnnouncePolicy` from `torrust-tracker-configuration` to `torrust-tracker-primitives` _(Rule M; no blockers)_
210+
- [ ] SI-04 — [#1795](https://github.com/torrust/torrust-tracker/issues/1795) Move `AnnouncePolicy` from `torrust-tracker-configuration` to `torrust-tracker-primitives` _(Rule M; no blockers)_
211211
- [ ] SI-05 — Create `torrust-net-primitives` and move `ServiceBinding` from `torrust-tracker-primitives` _(Rule M + new package; no blockers)_
212212
- [ ] SI-06 — Resolve `bittorrent-tracker-core``torrust-rest-tracker-api-client` layer violation _(Rule M; prerequisite for `bittorrent-tracker-core` extraction)_
213213
- [ ] SI-07 — Align `torrust-` prefix: rename 7 tracker-specific packages to `torrust-tracker-` _(Rule U; no blockers)_
@@ -227,7 +227,7 @@ Details:
227227
| SI-01 | #TBD — Establish baseline: dependency graph + README audit | [docs/issues/drafts/1669-01-establish-baseline-analysis.md](../../drafts/1669-01-establish-baseline-analysis.md) | TODO | No blockers; informs extraction decisions |
228228
| SI-02 | [#1790](https://github.com/torrust/torrust-tracker/issues/1790) — Move `DurationSinceUnixEpoch` from `torrust-tracker-primitives` to `torrust-tracker-clock` | [docs/issues/open/1790-move-duration-since-unix-epoch-to-torrust-tracker-clock.md](../../open/1790-move-duration-since-unix-epoch-to-torrust-tracker-clock.md) | DONE | Rule M; no hard blockers; prerequisite for SI-13 |
229229
| SI-03 | [#1793](https://github.com/torrust/torrust-tracker/issues/1793) — Define per-package default timeout constants and remove `DEFAULT_TIMEOUT` from `torrust-tracker-configuration` | [docs/issues/open/1793-1669-03-define-per-package-default-timeout-constants.md](../../open/1793-1669-03-define-per-package-default-timeout-constants.md) | TODO | Rule M; no blockers; SI-09 no longer depends on this |
230-
| SI-04 | #TBD — Move `AnnouncePolicy` from `torrust-tracker-configuration` to `torrust-tracker-primitives` | [docs/issues/drafts/1669-04-move-announce-policy-to-torrust-tracker-primitives.md](../../drafts/1669-04-move-announce-policy-to-torrust-tracker-primitives.md) | TODO | Rule M; fixes inverted dep (primitives → configuration); no blockers |
230+
| SI-04 | [#1795](https://github.com/torrust/torrust-tracker/issues/1795) — Move `AnnouncePolicy` from `torrust-tracker-configuration` to `torrust-tracker-primitives` | [docs/issues/open/1795-1669-04-move-announce-policy-to-torrust-tracker-primitives.md](../../open/1795-1669-04-move-announce-policy-to-torrust-tracker-primitives.md) | TODO | Rule M; fixes inverted dep (primitives → configuration); no blockers |
231231
| SI-05 | #TBD — Create `torrust-net-primitives` and move `ServiceBinding` from `torrust-tracker-primitives` | [docs/issues/drafts/1669-05-create-torrust-net-primitives-and-move-service-binding.md](../../drafts/1669-05-create-torrust-net-primitives-and-move-service-binding.md) | TODO | Rule M + new package; generic networking type; breaks server-lib → tracker-primitives dep |
232232
| SI-06 | #TBD — Resolve `bittorrent-tracker-core``torrust-rest-tracker-api-client` layer violation | [docs/issues/drafts/1669-06-resolve-bittorrent-tracker-core-rest-api-layer-violation.md](../../drafts/1669-06-resolve-bittorrent-tracker-core-rest-api-layer-violation.md) | TODO | Rule M; stale unused dev dep — one-line `Cargo.toml` deletion; unblocks `bittorrent-tracker-core` extraction |
233233
| SI-07 | #TBD — Align `torrust-` prefix: rename 7 tracker-specific packages to `torrust-tracker-` | [docs/issues/drafts/1669-07-align-torrust-prefix-rename-tracker-specific-packages.md](../../drafts/1669-07-align-torrust-prefix-rename-tracker-specific-packages.md) | TODO | Rule U; none of the 7 are published; pure workspace rename; no blockers |

docs/issues/drafts/1669-04-move-announce-policy-to-torrust-tracker-primitives.md renamed to docs/issues/open/1795-1669-04-move-announce-policy-to-torrust-tracker-primitives.md

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
doc-type: issue
33
issue-type: task
4-
status: draft
4+
status: open
55
priority: p2
6-
github-issue: null
7-
spec-path: docs/issues/drafts/1669-04-move-announce-policy-to-torrust-tracker-primitives.md
8-
branch: null
9-
related-pr: null
6+
github-issue: 1795
7+
spec-path: docs/issues/open/1795-1669-04-move-announce-policy-to-torrust-tracker-primitives.md
8+
branch: 1669-04-move-announce-policy-to-torrust-tracker-primitives
9+
related-pr: 1796
1010
last-updated-utc: 2026-05-18 00:00
1111
semantic-links:
1212
skill-links:
@@ -16,12 +16,13 @@ semantic-links:
1616
- packages/primitives/src/lib.rs
1717
- packages/primitives/Cargo.toml
1818
- docs/issues/open/1669-overhaul-packages/EPIC.md
19+
- https://github.com/torrust/torrust-tracker/issues/1795
1920
- docs/issues/open/1669-overhaul-packages/workspace-coupling-report.md
2021
---
2122

2223
<!-- skill-link: create-issue -->
2324

24-
# Issue #[To be assigned] - Move `AnnouncePolicy` from `torrust-tracker-configuration` to `torrust-tracker-primitives`
25+
# Issue #1795 - Move `AnnouncePolicy` from `torrust-tracker-configuration` to `torrust-tracker-primitives`
2526

2627
## Goal
2728

@@ -80,25 +81,25 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`.
8081

8182
| ID | Status | Task | Notes / Expected Output |
8283
| --- | ------ | -------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
83-
| T1 | TODO | Locate all definition and usage sites of `AnnouncePolicy` across the workspace | `grep -r "AnnouncePolicy" . --include="*.rs"` — build a full consumer list |
84-
| T2 | TODO | Move `AnnouncePolicy` definition to `packages/primitives/src/` (e.g. `primitives/src/announce_policy.rs`) | Public module exported from `packages/primitives/src/lib.rs` |
85-
| T3 | TODO | Remove `AnnouncePolicy` from `packages/configuration/src/` | Definition gone; re-export or direct dep on `torrust-tracker-primitives` added to configuration |
86-
| T4 | TODO | Add `torrust-tracker-primitives` as a dep of `packages/configuration/Cargo.toml` if not already present | `torrust-tracker-primitives` in `[dependencies]` |
87-
| T5 | TODO | Remove `torrust-tracker-configuration` dep from `packages/primitives/Cargo.toml` if `AnnouncePolicy` was its sole reason | `cargo machete` reports no unused dep |
88-
| T6 | TODO | Update all workspace files that import `AnnouncePolicy` from `torrust_tracker_configuration` to use `torrust_tracker_primitives` | One-line change per file |
89-
| T7 | TODO | Run `cargo build --workspace` and `cargo test --workspace` | Clean build; all tests pass |
90-
| T8 | TODO | Run `linter all` | Exit code `0` |
84+
| T1 | DONE | Locate all definition and usage sites of `AnnouncePolicy` across the workspace | `grep -r "AnnouncePolicy" . --include="*.rs"` — build a full consumer list |
85+
| T2 | DONE | Move `AnnouncePolicy` definition to `packages/primitives/src/` (e.g. `primitives/src/announce_policy.rs`) | Public module exported from `packages/primitives/src/lib.rs` |
86+
| T3 | DONE | Remove `AnnouncePolicy` from `packages/configuration/src/` | Definition gone; re-export or direct dep on `torrust-tracker-primitives` added to configuration |
87+
| T4 | DONE | Add `torrust-tracker-primitives` as a dep of `packages/configuration/Cargo.toml` if not already present | `torrust-tracker-primitives` in `[dependencies]` |
88+
| T5 | DONE | Remove `torrust-tracker-configuration` dep from `packages/primitives/Cargo.toml` if `AnnouncePolicy` was its sole reason | `cargo machete` reports no unused dep |
89+
| T6 | DONE | Update all workspace files that import `AnnouncePolicy` from `torrust_tracker_configuration` to use `torrust_tracker_primitives` | One-line change per file |
90+
| T7 | DONE | Run `cargo build --workspace` and `cargo test --workspace` | Clean build; all tests pass |
91+
| T8 | DONE | Run `linter all` | Exit code `0` |
9192

9293
## Progress Tracking
9394

9495
### Workflow Checkpoints
9596

96-
- [ ] Spec drafted in `docs/issues/drafts/`
97-
- [ ] Spec reviewed and approved by user/maintainer
98-
- [ ] GitHub issue created and issue number added to this spec
99-
- [ ] Spec moved to `docs/issues/open/` with issue number prefix
100-
- [ ] Implementation completed
101-
- [ ] Automatic verification completed (`linter all`, `cargo test --workspace`)
97+
- [x] Spec drafted in `docs/issues/drafts/`
98+
- [x] Spec reviewed and approved by user/maintainer
99+
- [x] GitHub issue created and issue number added to this spec
100+
- [x] Spec moved to `docs/issues/open/` with issue number prefix
101+
- [x] Implementation completed
102+
- [x] Automatic verification completed (`linter all`, `cargo test --workspace`)
102103
- [ ] Manual verification scenarios executed and recorded
103104
- [ ] Acceptance criteria reviewed after implementation and updated with evidence
104105
- [ ] EPIC #1669 Active Subissues table updated to `DONE`
@@ -108,17 +109,20 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`.
108109

109110
- 2026-05-18 00:00 UTC - josecelano - Spec drafted as subissue of EPIC #1669, addressing F-03
110111
from the coupling analysis report.
112+
- 2026-05-19 UTC - josecelano - Implementation completed: moved `AnnouncePolicy` to
113+
`primitives/src/announce.rs`, removed inverted dep, added deprecated re-export in
114+
`configuration`, updated all workspace consumers. All checks pass.
111115

112116
## Acceptance Criteria
113117

114-
- [ ] `packages/primitives/src/` defines `AnnouncePolicy` and exports it publicly.
115-
- [ ] `packages/primitives/Cargo.toml` does not list `torrust-tracker-configuration` as a dependency.
116-
- [ ] `packages/configuration/src/` no longer defines `AnnouncePolicy`; it imports from `torrust-tracker-primitives`.
117-
- [ ] No workspace file imports `AnnouncePolicy` from `torrust_tracker_configuration`
118+
- [x] `packages/primitives/src/` defines `AnnouncePolicy` and exports it publicly.
119+
- [x] `packages/primitives/Cargo.toml` does not list `torrust-tracker-configuration` as a dependency.
120+
- [x] `packages/configuration/src/` no longer defines `AnnouncePolicy`; it imports from `torrust-tracker-primitives`.
121+
- [x] No workspace file imports `AnnouncePolicy` from `torrust_tracker_configuration`
118122
(all migrated to `torrust_tracker_primitives` or re-exported through it).
119-
- [ ] `cargo build --workspace` succeeds with zero errors.
120-
- [ ] `cargo test --workspace` passes with zero failures.
121-
- [ ] `linter all` exits with code `0`.
123+
- [x] `cargo build --workspace` succeeds with zero errors.
124+
- [x] `cargo test --workspace` passes with zero failures.
125+
- [x] `linter all` exits with code `0`.
122126

123127
## Verification Plan
124128

@@ -134,8 +138,8 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`.
134138

135139
Status values: `TODO`, `IN_PROGRESS`, `DONE`, `FAILED`, `BLOCKED`.
136140

137-
| ID | Scenario | Command / Steps | Expected Result | Status | Evidence |
138-
| --- | ------------------------------------------------------------ | ---------------------------------------------------------------------------- | ----------------------- | ------ | -------- |
139-
| M1 | No workspace import of `AnnouncePolicy` from `configuration` | `grep -r "torrust_tracker_configuration::AnnouncePolicy" . --include="*.rs"` | Zero matches | TODO | |
140-
| M2 | `primitives` exports `AnnouncePolicy` | `grep "AnnouncePolicy" packages/primitives/src/lib.rs` | `pub` declaration found | TODO | |
141-
| M3 | `primitives` dep list does not include `configuration` | `grep "torrust-tracker-configuration" packages/primitives/Cargo.toml` | Zero matches | TODO | |
141+
| ID | Scenario | Command / Steps | Expected Result | Status | Evidence |
142+
| --- | ------------------------------------------------------------ | ---------------------------------------------------------------------------- | ----------------------- | ------ | ------------------------------------------------------------------ |
143+
| M1 | No workspace import of `AnnouncePolicy` from `configuration` | `grep -r "torrust_tracker_configuration::AnnouncePolicy" . --include="*.rs"` | Zero matches | DONE | `grep` returned zero matches |
144+
| M2 | `primitives` exports `AnnouncePolicy` | `grep "AnnouncePolicy" packages/primitives/src/lib.rs` | `pub` declaration found | DONE | `pub use announce::{AnnounceData, AnnounceEvent, AnnouncePolicy};` |
145+
| M3 | `primitives` dep list does not include `configuration` | `grep "torrust-tracker-configuration" packages/primitives/Cargo.toml` | Zero matches | DONE | `grep` returned zero matches |

packages/configuration/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ serde_with = "3"
2424
thiserror = "2"
2525
toml = "0"
2626
torrust-tracker-located-error = { version = "3.0.0-develop", path = "../located-error" }
27+
torrust-tracker-primitives = { version = "3.0.0-develop", path = "../primitives" }
2728
tracing = "0"
2829
tracing-subscriber = { version = "0", features = [ "json" ] }
2930
url = "2"

0 commit comments

Comments
 (0)