You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(axum-rest-api-server): [#2745] gate the test environment behind a testing feature - #2747
Row 6 of sub-EPIC #2482: applies rule A of ADR 20261021190318 to axum-rest-api-server. The spec merged in #2746.
What changes
src/testing/ compiles only with the new non-default testing feature (test support outside semver; not in default or docs.rs metadata).
Seven dependencies become optional behind it: torrust-tracker-core, torrust-tracker-http-core, torrust-tracker-udp-core, torrust-tracker-udp-server, torrust-tracker-swarm-coordination-registry, torrust-tracker-rest-api-client and torrust-clock (35 direct normal dependencies become 28).
The unused CurrentClock alias (the only production use of torrust-clock) is deleted; the stale rest-api-core note in src/testing/mod.rs is replaced.
The package's own targets enable the feature through a path-only self dev-dependency, with its deny.toml wrapper in the same commit; axum-health-check-api-server enables it from its [dev-dependencies].
The package has no examples, so none are added. No behaviour changes.
Verification
Evidence is in docs/issues/open/2745-2482-gate-axum-rest-api-server-test-environment/manual-verification-evidence.md.
Plain cargo test (no --all-features) keeps the baseline counts: axum-rest-api-server 162 unit + 58 integration, axum-health-check-api-server 15 + 11 (measured, equal with and without --all-features).
cargo check -p torrust-tracker-axum-rest-api-server --lib with no features passes; the depth-1 tree has none of the seven.
Shipped Features check passes (and fails with the feature on a [dependencies] edge); cargo deny check bans passes (and fails without the self wrapper); machete, cargo package --workspace --no-verify and the nightly all-targets check pass.
…ent behind a testing feature
Compile src/testing/ only with the new non-default testing feature and make the seven dependencies only it and the tests use optional (tracker-core, http-core, udp-core, udp-server, swarm-coordination-registry, rest-api-client, torrust-clock). Delete the unused CurrentClock alias, add the path-only self dev-dependency and its deny.toml wrapper. Plain cargo test keeps 162 unit and 58 integration tests.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
No open issues 🎉
What changed in this PR
Gates the axum-rest-api-server test environment behind a new non-default testing feature, reducing shipped dependency surface while keeping workspace tests working via dev-dependency feature enablement.
Changes:
Added testing feature and made seven previously-normal dependencies optional behind it.
Restricted src/testing/ exports to #[cfg(feature = "testing")] and removed the unused CurrentClock alias / torrust-clock production import.
Updated workspace consumer and policy/docs (deny.toml wrapper, evidence/spec/inventory) to reflect the new feature-gated test support.
[Minor][R1] T4 is marked complete, but docs/media/packages/dependencies-workspace-packages.md:134–150 still draws the seven axum-rest dependency edges made optional here. Its legend excludes edges enabled only by testing, so the diagram now overstates direct runtime coupling. Remove those seven edges and refresh the accompanying description before marking the diagram update complete.
Response to Copilot review 5799327636 (head fb782194f), finding F1 (R1, Minor): the dependency diagram still drew the seven axum-rest edges that the testing feature makes optional.
Valid. Fixed in docs(packages): [#2745] remove the seven testing-only axum-rest edges from the dependency diagram: the seven edges (clock, tracker-core, http-core, rest-client, swarm, udp-core, udp-srv) are removed, and the legend paragraph now names them as the example. The ten edges that stay match cargo tree -p torrust-tracker-axum-rest-api-server -e normal --depth 1. The review had no inline thread, so there is nothing to resolve. Audit: docs/pr-reviews/pr-2747-review/PR-REVIEW.md.
…docs/issues/closed
1ba0389 chore(issues): [#2745] archive the closed issue spec to docs/issues/closed (josecelano-bot)
Pull request description:
Archives the spec for issue #2745 (closed on GitHub by PR #2747) from `docs/issues/open/` to `docs/issues/closed/`, the last step of row 6 of the #2482 EPIC.
- Verified #2745 is `CLOSED` and PR #2747 is `MERGED` on GitHub
- Moved the folder (`ISSUE.md`, `manual-verification-evidence.md`); frontmatter now `status: done`, `spec-path` under `closed/`, `related-pr: 2747`, current `last-updated-utc`; the last workflow checkpoint is ticked and a progress-log entry is added
- Repaired the live links in the #2482 EPIC (row 6 is DONE), the test support inventory, the coupling report and the #2637 spec; no stale `open/2745-...` path remains in tracked files
- Pre-commit and pre-push hooks passed
Related to #2482.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
ACKs for top commit:
josecelano:
ACK 1ba0389
Tree-SHA512: 9cc90064c8b1b298b7094f8d50bbaecbe66a8bfd5db0461ce1fec51cafb16316c6678289350c9a10afa90a62b06c58d0442dc3577ce15267a6a533418b439d06
The reason will be displayed to describe this comment to others. Learn more.
Post-merge review of the change from #2747 as it stands at e170b9620 on the default branch.
What still runs: src/testing/ of torrust-tracker-axum-rest-api-server is compiled only with the non-default testing feature (packages/axum-rest-api-server/src/lib.rs:163); the seven crates that only that module and test code use are optional behind it (packages/axum-rest-api-server/Cargo.toml:23-31); the package's own targets turn it on through the path-only self dev-dependency (packages/axum-rest-api-server/Cargo.toml:72, allowed by deny.toml:47-48 and recorded at Cargo.lock:5156); and axum-health-check-api-server turns it on from its [dev-dependencies] (packages/axum-health-check-api-server/Cargo.toml:50). The CurrentClock alias removed from lib.rs has not come back. Later commits changed the surrounding manifests (versions, metadata, new dev-dependencies) but none of these lines.
[Minor] packages/axum-rest-api-server/Cargo.toml:68 keeps url = "2" as a normal dependency, but no file under src/ names the url crate: not production code, not src/testing/, not a #[cfg(test)] module. src/server.rs:279-280 calls .url() on a ServiceBinding and .join on the result, which needs no direct dependency on url. The only user is tests/server/v1/contract/context/health_check.rs:5, and the dev-dependency at Cargo.toml:82 already serves it. The dependency audit recorded with #2745, which #2747 applied, counts url among the 28 direct dependencies "used by production code", so the rule A.2 audit of ADR 20261021190318 missed it, and the default build of the crate still declares a dependency that only the tests use. The build graph is unaffected today because other dependencies such as reqwest pull url in, but the manifest no longer states what production code needs. Fix: delete line 68 and keep the dev-dependency.
[Nit] packages/axum-rest-api-server/src/testing/mod.rs:8-10 says the feature is enabled from [dev-dependencies] entries only and that the Shipped Features job enforces it. That job (.github/workflows/testing.yaml, run with --package torrust-tracker) reads only the normal and build dependency tree of torrust-tracker: it fails when a testing feature reaches that tree, and it does not read the [dependencies] entries of members outside it. For this package the sentence holds today only together with deny.toml:44-49, whose wrappers limit direct dependents to torrust-tracker, axum-health-check-api-server and the package itself, all inside the shipped tree. A member outside that tree that is added to the wrappers and enables testing from [dependencies] would pass both. Fix: say that the Shipped Features job fails if the feature reaches the torrust-tracker build and that the deny.toml wrappers limit which packages may depend on this one.
Checked and found sound: no code outside src/testing/ and the #[cfg(test)] modules uses any of the seven optional crates, so the library builds without the feature. src/testing/ needs no other crate's testing feature: it uses peer::Peer, not peer::fixture, and the container modules it imports are compiled unconditionally, so a consumer that enables only this feature compiles. The tests' uses of torrust-clock (src/server.rs:338, src/test_support.rs:15, tests/integration.rs:7) are served through the self dev-dependency. The self dev-dependency has no version, so packaging strips it. All seven optional dependencies carry a version and are publishable. testing is not in default, and the manifest has no docs.rs metadata. The shipped binary is built by cargo build --release --package torrust-tracker --bins (Containerfile:180), which leaves dev-dependency features off. Deleting the pub(crate) alias CurrentClock changes no behaviour. The description's counts (35 direct normal dependencies before, 28 after) match the manifest.
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
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.
Closes #2745
Row 6 of sub-EPIC #2482: applies rule A of ADR 20261021190318 to
axum-rest-api-server. The spec merged in #2746.What changes
src/testing/compiles only with the new non-defaulttestingfeature (test support outside semver; not indefaultor docs.rs metadata).torrust-tracker-core,torrust-tracker-http-core,torrust-tracker-udp-core,torrust-tracker-udp-server,torrust-tracker-swarm-coordination-registry,torrust-tracker-rest-api-clientandtorrust-clock(35 direct normal dependencies become 28).CurrentClockalias (the only production use oftorrust-clock) is deleted; the stalerest-api-corenote insrc/testing/mod.rsis replaced.deny.tomlwrapper in the same commit;axum-health-check-api-serverenables it from its[dev-dependencies].Verification
Evidence is in
docs/issues/open/2745-2482-gate-axum-rest-api-server-test-environment/manual-verification-evidence.md.cargo test(no--all-features) keeps the baseline counts:axum-rest-api-server162 unit + 58 integration,axum-health-check-api-server15 + 11 (measured, equal with and without--all-features).cargo check -p torrust-tracker-axum-rest-api-server --libwith no features passes; the depth-1 tree has none of the seven.[dependencies]edge);cargo deny check banspasses (and fails without the self wrapper); machete,cargo package --workspace --no-verifyand the nightly all-targets check pass.torrust-cargo-chef0.1.79prepare --external-onlythencook --tests --workspace --all-featuresexit 0.🤖 Generated with Claude Code