Repository navigation
Description
Goal
Move the torrust-clock crate out of the torrust-tracker workspace into its own standalone repository so that it can be maintained, versioned, and published independently of the tracker.
Background
The torrust-clock package provides a mockable time abstraction for deterministic testing. It contains no tracker-specific logic, making it a general-purpose utility reusable by any Rust project (e.g., torrust-index already contains a local copy of equivalent clock code). Keeping it inside the tracker workspace couples its release cycle to the tracker's and limits its visibility to potential consumers.
After the preceding subissues are complete (torrust-tracker-clock renamed to torrust-clock and DurationSinceUnixEpoch moved from torrust-tracker-primitives to torrust-clock), the crate has zero workspace-path dependencies — all its runtime deps (chrono, tracing) are published crates. Extraction is therefore unblocked.
Prerequisites:
- Clock rename subissue (Rename
torrust-tracker-clocktotorrust-clock#1821) must be complete — in particular T8 (publishtorrust-clockon crates.io). DurationSinceUnixEpochmove subissue (MoveDurationSinceUnixEpochfromtorrust-tracker-primitivestotorrust-tracker-clock#1790) must be complete — in particular T4 (torrust-tracker-primitivesdep removed frompackages/clock/Cargo.toml).
This issue is a subissue of EPIC #1669 (Overhaul: Packages).
Scope
In Scope
- Create a new standalone repository
torrust/torrust-clockin the Torrust GitHub organization. - Move
packages/clock/to the new repository, preserving git history (usinggit filter-repo). - Verify the standalone repository builds and tests pass independently.
- Set up CI in the new repository (mirror the relevant CI workflows from the tracker repo).
- Update all 13 workspace consumers (root
Cargo.toml+ 12 packages) to referencetorrust-clockas a crates.io version dependency instead of a path dependency. - Remove
packages/clockfrom the workspacememberslist in rootCargo.toml. - Delete the
packages/clock/directory from the tracker repository. - Update prose references in
packages/AGENTS.md,AGENTS.md, anddocs/packages.md(movetorrust-clockto the "Extracted" section).
Out of Scope
- Changes to the crate's API or behaviour.
- Yanking the old crates.io name
torrust-tracker-clock(that is handled by the rename subissue T11, aftertorrust-indexmigration).
Workspace consumers to migrate
The following 13 files must have their torrust-clock dep changed from a path dep to a crates.io version dep:
Cargo.toml(root — workspace dep registration)packages/axum-health-check-api-server/Cargo.tomlpackages/axum-http-server/Cargo.tomlpackages/axum-rest-api-server/Cargo.tomlpackages/http-protocol/Cargo.tomlpackages/http-tracker-core/Cargo.tomlpackages/metrics/Cargo.tomlpackages/primitives/Cargo.tomlpackages/swarm-coordination-registry/Cargo.tomlpackages/tracker-core/Cargo.tomlpackages/torrent-repository-benchmarking/Cargo.tomlpackages/udp-server/Cargo.tomlpackages/udp-tracker-core/Cargo.toml
Implementation Plan
| ID | Task | Notes / Expected Output |
|---|---|---|
| T1 | Verify clock rename completion state (T8 of rename spec: torrust-clock published on crates.io) |
packages/clock/Cargo.toml has name = "torrust-clock" |
| T2 | Verify DurationSinceUnixEpoch move completion state (T4 of move spec) |
packages/clock/Cargo.toml does not list torrust-tracker-primitives |
| T3 | Create standalone repository torrust/torrust-clock |
Empty repo with license and basic README |
| T4 | Move packages/clock/ to the new repository, preserving git history (git filter-repo) |
New repo contains full history for packages/clock/ |
| T5 | Verify standalone repository: cargo build and cargo test pass with no path deps |
Clean build in the new repo; Cargo.toml has only external (non-path) deps |
| T6 | Set up CI in the new repository | Copy/adapt relevant GitHub Actions workflows; CI passes |
| T7 | Update all 13 workspace consumers (see list above): path dep → crates.io version dep | torrust-clock = "X.Y.Z" (or workspace dep) in each Cargo.toml |
| T8 | Remove packages/clock entry from workspace members in root Cargo.toml |
packages/clock absent from [workspace] members list |
| T9 | Delete packages/clock/ directory from the tracker repository |
Directory removed; git status shows deletions |
| T10 | Update packages/AGENTS.md, AGENTS.md, docs/packages.md |
torrust-clock moved to an "Extracted packages" section |
| T11 | Run cargo build --workspace and cargo test --workspace |
Clean build and all tests pass |
| T12 | Run linter all |
Exit code 0 |
| T13 | Update EPIC #1669 tables | Package inventory and desired state tables updated; subissue row set to DONE |
Acceptance Criteria
- A standalone repository
torrust/torrust-clockexists on GitHub. - The repository contains the full git history for
packages/clock/. - CI in the new repository passes.
- No
Cargo.tomlin the tracker workspace referencestorrust-clockwith a path dep. -
packages/clockis absent from the[workspace]members list in rootCargo.toml. - The
packages/clock/directory no longer exists in the tracker repository. -
cargo build --workspacein the tracker repository succeeds with zero errors. -
cargo test --workspacein the tracker repository passes with zero failures. -
linter allexits with code0. -
packages/AGENTS.md,AGENTS.md, anddocs/packages.mdreflect the extraction.
Related to #1669
Activity
fix(container): remove packages/clock references from Containerfile
docs(issues): add issue specification for #1879
docs(issues): update #1879 spec — T1–T6 DONE, deferred CI setup
Merge #1880: feat(packages): extract torrust-clock to standalone repo…
chore(issues): address Copilot PR review comments on torrust#1886
chore(issues): address Copilot PR review comments on torrust#1886
Merge #1886: chore(issues): maintain issue specs — archive closed, pr…
feat(spec): add subissue spec for extracting torrust-server-lib to st…
feat(packages): extract torrust-clock to standalone repository (torru…