Skip to content

feat(workspace): adopt independent package versioning policy - #1961

Merged
josecelano merged 4 commits into
torrust:developfrom
josecelano:1926-1669-si-32-define-package-versioning-strategy
Jul 13, 2026
Merged

josecelano merged 4 commits into
torrust:developfrom
josecelano:1926-1669-si-32-define-package-versioning-strategy

Conversation

@josecelano

@josecelano josecelano commented Jun 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Define and implement a SemVer policy for all workspace packages, replacing the implicit "everything shares one workspace version" with independent versioning for every crate.

Issue: #1926 (SI-32) — subissue of EPIC #1669 (Overhaul: Packages)

Phase Progress

✅ Phase 1 — Policy Definition (committed)

All policy definition work is complete and ready for review:

  • Issue spec with three-tier versioning model (tracker runtime / API contract / platform-utility / unpublished tooling), release process implications, and Appendix A with version assignment table per crate
  • ADR (20260629000000) documenting the independent versioning decision, alternatives considered, and rationale
  • EPIC and DECISIONS log updated with references
  • .github/workflows/deployment.yaml — refined to publish only torrust-tracker
  • .github/workflows/deployment-packages.yaml — new workflow for per-package publishing
  • docs/release_process.md — split into two paths (tracker release + per-package publish)

✅ Phase 2 — Version Migration (completed)

  • ✅ Removed version.workspace = true from all 26 Cargo.toml manifests
  • ✅ Set explicit initial versions per Appendix A:
    • 4 crates keep 3.0.0 (already on crates.io)
    • 23 crates start at 0.1.0
    • Root binary keeps 3.0.0-develop
  • ✅ Removed version from [workspace.package] in root Cargo.toml
  • ✅ Updated all inter-package dependency version references
  • ✅ Regenerated Cargo.lock for consistency
  • ✅ cargo check --workspace passes
  • ✅ linter all passes
  • ✅ cargo test --doc --workspace passes

✅ Phase 3 — CI/Release Refinements (completed)

Any remaining polish after Phase 2 is committed.


Key Decisions

  1. All packages version independently — path dependencies guarantee workspace compatibility regardless of declared version numbers
  2. Two-concept release model: tracker application release (releases/v*) and per-package publish (releases/pkg/<crate>/v<semver>)
  3. Glob safety: releases/v* does NOT match releases/pkg/... in GitHub Actions
  4. Version by namespace for public contracts (REST API v1/ modules, config v2_0_0/)
  5. 4 crates never published (e2e-tools, persistence-benchmark, torrent-repository-benchmarking, workspace-coupling)

Verification

  • linter all passes
  • cargo test --doc --workspace passes
  • cargo +nightly fmt --check passes
  • cargo +nightly check --tests --benches --examples --workspace --all-targets --all-features passes
  • cargo +stable test --tests --benches --examples --workspace --all-targets --all-features passes
  • GPG-signed commits (all 5 commits)
  • cargo check --workspace passes with new versions
  • All 21 Copilot review comments addressed
  • All 27 files changed (292 insertions, 439 deletions)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR documents and codifies a shift from lockstep workspace versioning to independent per-crate versioning, including corresponding release/publish workflow documentation and CI workflow split for tracker vs. per-package publishing.

Changes:

  • Adds an ADR and updates EPIC/decision logs to formally adopt independent versioning for workspace crates.
  • Updates the tracker deployment workflow to publish only torrust-tracker and introduces a new workflow for publishing individual workspace packages.
  • Extends release-process documentation to include a per-package publishing path and updates project spellcheck dictionary.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
project-words.txt Adds new dictionary terms for cspell.
docs/release_process.md Documents the split release model (tracker release vs. per-package publish).
docs/issues/open/1926-1669-si-32-define-package-versioning-strategy.md Updates the issue spec with the independent-versioning policy and related process details.
docs/issues/open/1669-overhaul-packages/EPIC.md Links the EPIC to the new ADR/issue and updates versioning-policy narrative.
docs/issues/open/1669-overhaul-packages/DECISIONS.md Adds DEC-16 documenting adoption of independent package versioning.
docs/adrs/index.md Registers the new ADR in the ADR index.
docs/adrs/20260629000000_adopt_independent_package_versioning.md New ADR describing the independent-versioning policy and release model split.
docs/adrs/20260623200526_adopt_contract-first_architecture_for_rest_api.md Adds a reference to the new ADR for “version by namespace” rationale.
.github/workflows/deployment.yaml Narrows tracker deployment to releases/v* and publishes only torrust-tracker.
.github/workflows/deployment-packages.yaml New workflow to publish a single crate based on releases/pkg/** branches or manual dispatch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread project-words.txt Resolved
Comment thread docs/release_process.md Resolved
Comment thread .github/workflows/deployment.yaml Resolved
@josecelano
josecelano force-pushed the 1926-1669-si-32-define-package-versioning-strategy branch from a88721d to 4cb1889 Compare June 30, 2026 06:59
@josecelano
josecelano requested a review from Copilot June 30, 2026 07:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 36 out of 37 changed files in this pull request and generated 4 comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 36 out of 37 changed files in this pull request and generated 4 comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 36 out of 37 changed files in this pull request and generated 4 comments.

Comment thread packages/rest-api-client/Cargo.toml Resolved
Comment thread .github/workflows/deployment.yaml Resolved
Define and document the policy that all workspace packages version
independently, replacing the implicit shared workspace version.

Includes:
- Issue spec with four-tier versioning model and Appendix A
- ADR documenting the decision
- EPIC and DECISIONS log updates
- CI workflows (deployment-packages.yaml, deployment.yaml)
- Release process documentation update
- Branch format validation and output injection protection
- Secret scoping and review feedback from all rounds
Remove version.workspace = true from all 26 workspace Cargo.toml
manifests and set explicit versions per the approved version
assignment table (Appendix A in issue spec).

Key changes:
- Root torrust-tracker binary: 3.0.0-develop
- Published crates (4): 3.0.0 (primitives, configuration, test-helpers)
- Unpublished crates (23): 0.1.0
- Removed version from [workspace.package]
- Updated all inter-package dependency version references
- Set publish = false for unpublished tooling crates
- Regenerated Cargo.lock for consistency
@josecelano
josecelano force-pushed the 1926-1669-si-32-define-package-versioning-strategy branch from da13b1e to b24149f Compare July 1, 2026 07:33
@josecelano
josecelano requested a review from Copilot July 1, 2026 07:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 36 out of 37 changed files in this pull request and generated 1 comment.

@josecelano
josecelano marked this pull request as ready for review July 1, 2026 08:13
@josecelano
josecelano requested a review from a team as a code owner July 1, 2026 08:13
@josecelano

Copy link
Copy Markdown
Member Author

ACK d19d13a

@josecelano
josecelano merged commit 9411353 into torrust:develop Jul 13, 2026
25 checks passed
@josecelano
josecelano deleted the 1926-1669-si-32-define-package-versioning-strategy branch July 13, 2026 08:56
@josecelano josecelano linked an issue Jul 13, 2026 that may be closed by this pull request
8 tasks
josecelano added a commit that referenced this pull request Jul 15, 2026
…ssues/open to docs/issues/closed

174904d chore(ci): point to ADR instead of closed issue spec in deployment-packages.yaml (Jose Celano)
2e2178f docs(skill): document branch-already-exists edge case in cleanup-completed-issues skill (Jose Celano)
1bfd306 chore(issues): archive closed issue specs #1447, #1459, #1505, #1926, #1938, #1944, #1959, #1964, #1965, #1969 to docs/issues/closed (Jose Celano)

Pull request description:

  Archives the following 10 issue specs that are closed on GitHub, moving them from `docs/issues/open/` to `docs/issues/closed/`:

  | Issue | Title | PR |
  |-------|-------|-----|
  | #1447 | Change logging threshold for connection ID error to WARNING | #1975 |
  | #1459 | Docker Security Overhaul | #1958 |
  | #1505 | Optimize peer IP list from swarm (implementation rejected) | #1949 |
  | #1926 | Define package versioning strategy | #1961 |
  | #1938 | REST API Contract-First Migration EPIC | #1960 (SI-1→5) |
  | #1944 | SI-6: Align REST API client | #1968 |
  | #1959 | SI-7: Review tests, align v1 namespace | #1963 |
  | #1964 | Rename number-of-downloads BTreeMap type alias | #1972 |
  | #1965 | SI-34: Consolidate duplicate HTTP types | #1974 |
  | #1969 | SI-8: Eliminate unwraps from REST API client | #1973 |

  ### Changes Made

  - All 10 specs verified `CLOSED` on GitHub with merged PRs
  - Files/directories moved via `git mv` to `docs/issues/closed/`
  - Frontmatter updated: `status: done`, `spec-path` → closed path, `last-updated-utc: 2026-07-15`
  - Workflow checkpoints updated and progress log entries added
  - Supplementary files in multi-file directories updated with new paths
  - Parent EPIC specs (#1669, #1938) updated: subissue status, spec paths, and table references
  - Fixed stale references in `.github/workflows/deployment-packages.yaml`, `docs/adrs/`, and `docs/issues/closed/` files
  - Pre-commit and pre-push hooks passed (linter, tests, doc-tests, nightly checks)

ACKs for top commit:
  josecelano:
    ACK 174904d

Tree-SHA512: c7e38354bb5898fc5125a0b68fd61a02ca273689593638eb3b955b9176038ef82c40fc98b0a2f722eb18d8d429d2f2dbb6f205eee3061211ab9906c5be46942b

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a post-merge review of the change from #1961 as it stands at a94c3ced8 on the default branch.

What still runs: .github/workflows/deployment-packages.yaml is the file #1961 added, with only the checkout pin (v7.0.1), its document pointers and its markers changed since. A push to a releases/pkg/<crate-name>/v<semver> branch takes the crate name from the branch, tests that crate on nightly and stable, and publishes it to crates.io from the deployment environment. .github/workflows/deployment.yaml triggers only on releases/v* and publishes only torrust-tracker. Every member manifest declares its own version, [workspace.package] declares none, and the release procedure lives in docs/release-process/workspace-packages.md and docs/release-process/tracker.md.

[Minor] A hardening gap in the release path: the published version is never compared with the version in the release branch name. .github/workflows/deployment-packages.yaml:77-78 strips /v<semver> from the branch name and discards it, and the verify-version check (lines 142-158) only confirms that the manifest does not inherit its version. Suppose the commit pushed to releases/pkg/torrust-tracker-udp-protocol/v0.2.0 declares an unpublished 0.1.1, because the wrong commit was pushed or the bump chose another number. The workflow then publishes 0.1.1 to crates.io and reports success, and a crates.io version can be yanked but never reused. If the crates.io check at docs/release-process/workspace-packages.md:108-109 is skipped, the tag from docs/release-process/workspace-packages.md:110-116 then names v0.2.0 on a commit that published 0.1.1. The required dry run (docs/release-process/workspace-packages.md:86-90) prints the packaged version, so this missing check only matters when a manual slip goes unnoticed. Smallest fix: keep the v<semver> part of the branch name as a second output of the extract-crate job, and in the publish job fail before cargo publish when it differs from the crate's version read from cargo metadata --no-deps --format-version 1.

[Minor] The ADR states the opposite of what Cargo does with path dependencies. docs/adrs/20260629000000_adopt_independent_package_versioning.md:62-64 and :108-109, and the argument for discarding the hybrid alternative at :157, say Cargo resolves the local copy of a path dependency regardless of the declared version. In fact Cargo checks a path dependency's version requirement against the local package. An incompatible bump therefore does not build until every dependent's requirement is raised. The declared requirement is also what a published dependent asks crates.io for, so a dependent that starts using a newer API but keeps the old requirement publishes a false compatibility claim. docs/release-process/workspace-packages.md:73-79 states this correctly, so the decision record and the procedure disagree. Smallest fix: rewrite the two ADR passages to say that path dependencies keep the workspace on local code, while the declared requirement must match the local version and is what consumers of the published crate receive.

[Nit] A hardening note: neither deployment workflow declares permissions: (.github/workflows/deployment-packages.yaml:32-45, .github/workflows/deployment.yaml:1-18). The GITHUB_TOKEN in jobs that check out the repository and run the build scripts of crates.io dependencies therefore gets the repository's default scopes, although .github/workflows/AGENTS.md:15 asks for least privilege. The practical exposure is small: the rulesets recorded in docs/github-rulesets.md:43-51 already limit what the workflow token can change, and nothing in these jobs needs more than read access. Smallest fix: a top-level permissions: contents: read in both files.

[Nit] The verify-version check (.github/workflows/deployment-packages.yaml:142-158) cannot fail in practice. [workspace.package] in Cargo.toml:80-91 has no version, so a member with version.workspace = true already fails to load in the test job, before this check runs. The check also matches only that one spelling (version = { workspace = true } passes), and it locates the manifest with grep -rl ... | head -1. That lookup is correct at a94c3ced8 only because every publishable crate name matches exactly one manifest. Smallest fix: replace the check with the cargo metadata version comparison suggested above.

Checked and found sound: the trigger split (releases/v* cannot match releases/pkg/...); the tracker workflow, which publishes only torrust-tracker after the full workspace tests; the per-crate versions and path requirements in every member manifest (each requirement is satisfied by the local version, no publishable crate depends on an unpublished one, and the type added with primitives 3.1.0 in 9628a06 is not yet used by any dependent that still requires 3.0.0); the container workflow, whose releases/**/* trigger also fires on package branches but whose semver check stops any image publish there; and the agreement of docs/release-process/tracker.md with deployment.yaml.

This branch was previously deployed

1 inactive deployment
coverage — d19d13a1 Deployed Jul 13, 2026 by josecelano via Generate Coverage Report #1545
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SI-32: Define package versioning strategy for EPIC #1669

3 participants