From 6c7345ed3e802f797a7c8b9576f8ccb44f28f6f8 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Sat, 21 Nov 2026 13:31:28 +0000 Subject: [PATCH 01/14] test(tracker-core): [#2916] add red tests that tracker-core error texts name no source path Unit tests at the tracker-core seams (whitelist authorization, the authentication service, the shared driver tests and the keys handler) and protocol tests through the UDP, HTTP and REST API servers. The REST helper assert_unhandled_rejection now also forbids source paths, and the ErrorKind::Whitelist payload tests pin the full message. Co-Authored-By: Claude Opus 5.5 --- .../open/2916-2912-si-4-tracker-core/ISSUE.md | 9 ++-- .../failure_reasons_hold_no_source_path.rs | 44 ++++++++++++++++++- .../tests/server/v1/asserts.rs | 22 ++++++++++ .../server/v1/contract/context/auth_key.rs | 34 ++++++++++++++ .../src/authentication/handler.rs | 43 ++++++++++++++++++ .../src/authentication/service.rs | 33 ++++++++++++++ .../tracker-core/src/databases/driver/mod.rs | 43 +++++++++++++++++- packages/tracker-core/src/test_helpers.rs | 21 +++++++++ .../src/whitelist/authorization.rs | 12 +++++ packages/udp-server/src/event.rs | 8 ++-- packages/udp-server/tests/server/asserts.rs | 21 +++++++++ packages/udp-server/tests/server/contract.rs | 29 +++++++++++- 12 files changed, 307 insertions(+), 12 deletions(-) diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md b/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md index 0695e8265a..d7240ea8dd 100644 --- a/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md +++ b/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md @@ -2,14 +2,14 @@ schema-version: 1 doc-type: issue issue-type: bug -status: planned +status: in-progress priority: p1 epic: 2912 github-issue: 2916 spec-path: docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md branch: "2916-tracker-core" related-pr: null -last-updated-utc: "2026-11-18 19:11" +last-updated-utc: "2026-11-21 13:31" semantic-links: skill-links: - create-issue @@ -147,8 +147,8 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. | ID | Status | Task | Notes / Expected Output | | --- | --- | --- | --- | -| T1 | TODO | Reproduce and record | UDP, HTTP and REST replies with a library path, in `manual-verification-evidence.md`. | -| T2 | TODO | Red tests | Unit tests for the 7 variants and the `PeerKeyError`/database sources; protocol tests for UDP, HTTP and REST; red output recorded. | +| T1 | DONE | Reproduce and record | UDP, HTTP and REST replies with a library path, in `manual-verification-evidence.md`. | +| T2 | IN_PROGRESS | Red tests | Unit tests for the 7 variants and the `PeerKeyError`/database sources; protocol tests for UDP, HTTP and REST; red output recorded. | | T3 | TODO | Whitelist and key errors | `location` removed from `WhitelistError` and `authentication::key::Error` and their sites, including `http-core`. | | T4 | TODO | Database errors | `location` removed from the three variants and 12 driver sites; `LocatedError` sources replaced; `tracing` event added where needed. | | T5 | TODO | `PeerKeyError` sources and dependency | Plain sources; six `Located(..).into()` removed; `torrust-located-error` removed from `tracker-core/Cargo.toml`. | @@ -210,6 +210,7 @@ the model that produced them. - 2026-11-11 17:05 UTC - Claude Code (Fable 5.2) - Drafted from the audit of issue #2804 (`docs/issues/open/2804-location-caller-track-caller-audit/inventory.md`, `options.md`) as a sub-issue of the EPIC draft. Not yet approved; line numbers are those of `develop` at `4f0af379a` and must be re-checked before implementation. - 2026-11-17 17:30 UTC - Claude Code (Claude Opus 5.5) - EPIC coordinator: the maintainer approved the specification on 2026-11-17; issue #2916 created as `josecelano-bot` and the specification moved from `docs/issues/drafts/` to `docs/issues/open/` (SI-4 of EPIC #2912). +- 2026-11-21 13:31 UTC - Claude Code (Claude Opus 5.5) - T1: reproduced on `develop` at `4be22ee66` with a listed and a private tracker (UDP, HTTP and REST replies all hold `packages/...rs:line` paths; a duplicate key over REST holds two, from the driver and from `authentication/handler.rs`). T2: red tests added at the tracker-core seams (whitelist authorization, authentication service, the shared driver tests, the keys handler) and at the protocol servers (UDP contract, HTTP `failure_reasons_hold_no_source_path.rs`, REST `assert_unhandled_rejection`, which now also forbids source paths), and the `ErrorKind::Whitelist` payload tests in `udp-server/src/event.rs` pinned to the full message. Decisions pending for T3 to T5 are recorded when made. ## Acceptance Criteria diff --git a/packages/axum-http-server/tests/server/v1/contract/failure_reasons_hold_no_source_path.rs b/packages/axum-http-server/tests/server/v1/contract/failure_reasons_hold_no_source_path.rs index 2dea396cef..9b9db4040b 100644 --- a/packages/axum-http-server/tests/server/v1/contract/failure_reasons_hold_no_source_path.rs +++ b/packages/axum-http-server/tests/server/v1/contract/failure_reasons_hold_no_source_path.rs @@ -3,8 +3,9 @@ //! source path of the tracker (see //! `docs/adrs/20261118045443_errors_do_not_record_source_locations.md`). //! -//! One test per failure family of request parsing, key extraction and peer-IP -//! resolution, through a running HTTP tracker. +//! One test per failure family of request parsing, key extraction, peer-IP +//! resolution, whitelist authorization and key authentication, through a +//! running HTTP tracker. use std::sync::Arc; use std::time::Duration; @@ -177,3 +178,42 @@ async fn an_announce_to_a_tracker_behind_a_reverse_proxy_without_the_x_forwarded assert_names_no_source_path(&failure_reason); assert!(failure_reason.contains("X-Forwarded-For"), "{failure_reason:?}"); } + +#[tokio::test] +async fn an_announce_to_a_listed_tracker_for_a_torrent_that_is_not_whitelisted() { + let failure_reason = failure_reason_for( + configuration::ephemeral_listed(), + &format!("announce?info_hash={VALID_INFO_HASH}&peer_id={VALID_PEER_ID}&port=17548"), + ) + .await; + + assert_names_no_source_path(&failure_reason); + assert!( + failure_reason.contains("The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted"), + "{failure_reason:?}" + ); +} + +#[tokio::test] +async fn an_announce_to_a_private_tracker_without_a_key() { + let failure_reason = failure_reason_for( + configuration::ephemeral_private(), + &format!("announce?info_hash={VALID_INFO_HASH}&peer_id={VALID_PEER_ID}&port=17548"), + ) + .await; + + assert_names_no_source_path(&failure_reason); + assert!(failure_reason.contains("Missing authentication key"), "{failure_reason:?}"); +} + +#[tokio::test] +async fn an_announce_to_a_private_tracker_with_an_unregistered_key() { + let failure_reason = failure_reason_for( + configuration::ephemeral_private(), + &format!("announce/YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ?info_hash={VALID_INFO_HASH}&peer_id={VALID_PEER_ID}&port=17548"), + ) + .await; + + assert_names_no_source_path(&failure_reason); + assert!(failure_reason.contains("Failed to read key"), "{failure_reason:?}"); +} diff --git a/packages/axum-rest-api-server/tests/server/v1/asserts.rs b/packages/axum-rest-api-server/tests/server/v1/asserts.rs index f5e1732730..03f99d5095 100644 --- a/packages/axum-rest-api-server/tests/server/v1/asserts.rs +++ b/packages/axum-rest-api-server/tests/server/v1/asserts.rs @@ -177,4 +177,26 @@ async fn assert_unhandled_rejection(response: Response, reason: &str) { response_text.contains(&reason_text), ":\n response: `\"{response_text}\"`\n does not contain: `\"{reason_text}\"`." ); + assert_names_no_source_path(&response_text); +} + +/// Fails when `message` contains anything that looks like a source path: a workspace path, a +/// registry checkout, the standard library sources, or a `file.rs:line` suffix, written with +/// either path separator. It reports a failure at the caller's line. +#[track_caller] +pub fn assert_names_no_source_path(message: &str) { + for fragment in [ + ".rs:", + "packages/", + "packages\\", + "src/", + "src\\", + ".cargo/registry", + "rustlib/src", + ] { + assert!( + !message.contains(fragment), + "the error message must not hold a source path, but it contains {fragment:?}: {message:?}" + ); + } } diff --git a/packages/axum-rest-api-server/tests/server/v1/contract/context/auth_key.rs b/packages/axum-rest-api-server/tests/server/v1/contract/context/auth_key.rs index 0406000e8b..887cd8f445 100644 --- a/packages/axum-rest-api-server/tests/server/v1/contract/context/auth_key.rs +++ b/packages/axum-rest-api-server/tests/server/v1/contract/context/auth_key.rs @@ -403,6 +403,40 @@ async fn should_fail_when_the_auth_key_cannot_be_deleted() { env.stop().await; } +#[tokio::test] +async fn should_fail_without_a_source_path_when_the_same_auth_key_is_uploaded_twice() { + logging::setup(); + let env = Started::new(&configuration::ephemeral_private().into()).await; + let client = ApiHttpClient::new(env.get_connection_info()).unwrap(); + let upload = || AddKeyForm { + opt_key: Some("Xc1L4PbQJSFGlrgSRZl8wxSFAuMa21z5".to_string()), + opt_seconds_valid: Some(60), + }; + assert_auth_key_utf8(client.add_auth_key(upload(), None).await.unwrap()).await; + + let response = client.add_auth_key(upload(), None).await.unwrap(); + + assert_failed_to_add_key(response).await; + + env.stop().await; +} + +#[tokio::test] +async fn should_fail_without_a_source_path_when_the_auth_key_to_delete_does_not_exist() { + logging::setup(); + let env = Started::new(&configuration::ephemeral_private().into()).await; + + let response = ApiHttpClient::new(env.get_connection_info()) + .unwrap() + .delete_auth_key("Xc1L4PbQJSFGlrgSRZl8wxSFAuMa21z5", None) + .await + .unwrap(); + + assert_failed_to_delete_key(response).await; + + env.stop().await; +} + #[tokio::test] async fn should_not_allow_deleting_an_auth_key_for_unauthenticated_users() { logging::setup(); diff --git a/packages/tracker-core/src/authentication/handler.rs b/packages/tracker-core/src/authentication/handler.rs index 9619d5f3f7..58c95350f9 100644 --- a/packages/tracker-core/src/authentication/handler.rs +++ b/packages/tracker-core/src/authentication/handler.rs @@ -705,5 +705,48 @@ mod tests { } } } + mod peer_key_errors { + use std::error::Error as _; + + use crate::authentication::handler::AddKeyRequest; + use crate::authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::{ + instantiate_keys_handler, private_tracker_configuration, + }; + use crate::error::PeerKeyError; + use crate::test_helpers::tests::assert_names_no_source_path; + + fn add_key_request(key: &str) -> AddKeyRequest { + AddKeyRequest { + opt_key: Some(key.to_string()), + opt_seconds_valid: None, + } + } + + #[tokio::test] + async fn it_should_fail_without_a_source_path_when_the_database_rejects_a_duplicate_key() { + let ephemeral = private_tracker_configuration(); + let keys_handler = instantiate_keys_handler(&ephemeral.config).await; + let key = "YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ"; + keys_handler.add_peer_key(add_key_request(key)).await.unwrap(); + + let error = keys_handler.add_peer_key(add_key_request(key)).await.unwrap_err(); + + assert!(matches!(error, PeerKeyError::DatabaseError { .. }), "{error:?}"); + assert_names_no_source_path(&error.to_string()); + assert_names_no_source_path(&error.source().unwrap().to_string()); + } + + #[tokio::test] + async fn it_should_fail_without_a_source_path_when_the_key_is_invalid() { + let ephemeral = private_tracker_configuration(); + let keys_handler = instantiate_keys_handler(&ephemeral.config).await; + + let error = keys_handler.add_peer_key(add_key_request("INVALID KEY")).await.unwrap_err(); + + assert!(matches!(error, PeerKeyError::InvalidKey { .. }), "{error:?}"); + assert_names_no_source_path(&error.to_string()); + assert_names_no_source_path(&error.source().unwrap().to_string()); + } + } } } diff --git a/packages/tracker-core/src/authentication/service.rs b/packages/tracker-core/src/authentication/service.rs index 67e0c05c88..4a3d40f48b 100644 --- a/packages/tracker-core/src/authentication/service.rs +++ b/packages/tracker-core/src/authentication/service.rs @@ -211,6 +211,39 @@ mod tests { assert!(result.is_err()); } + #[tokio::test] + async fn it_should_reject_an_unregistered_key_with_a_message_that_holds_no_source_path() { + let authentication = instantiate_authentication_for_private_tracker(); + let unregistered_key = authentication::Key::from_str("YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ").unwrap(); + + let error = authentication.authenticate(&unregistered_key).await.unwrap_err(); + + assert_eq!(error.to_string(), "Failed to read key: YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ"); + } + + #[tokio::test] + async fn it_should_reject_an_expired_key_with_a_message_that_holds_no_source_path() { + let in_memory_key_repository = Arc::new(InMemoryKeyRepository::default()); + let key = authentication::Key::from_str("YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ").unwrap(); + in_memory_key_repository + .insert(&PeerKey { + key: key.clone(), + valid_until: Some(Duration::from_secs(0)), + }) + .await; + let authentication = AuthenticationService::new( + &Core { + private: true, + ..Default::default() + }, + &in_memory_key_repository, + ); + + let error = authentication.authenticate(&key).await.unwrap_err(); + + assert_eq!(error.to_string(), "Key has expired"); + } + #[tokio::test] async fn it_should_not_authenticate_a_registered_but_expired_key_by_default() { let config = Core { diff --git a/packages/tracker-core/src/databases/driver/mod.rs b/packages/tracker-core/src/databases/driver/mod.rs index 314c053398..c961793327 100644 --- a/packages/tracker-core/src/databases/driver/mod.rs +++ b/packages/tracker-core/src/databases/driver/mod.rs @@ -42,11 +42,15 @@ pub(crate) mod tests { handling_authentication_keys::it_should_remove_a_permanent_authentication_key(driver).await; handling_authentication_keys::it_should_save_and_load_expiring_authentication_keys(driver).await; handling_authentication_keys::it_should_remove_an_expiring_authentication_key(driver).await; + handling_authentication_keys::it_should_fail_without_a_source_path_trying_to_add_the_same_key_twice(driver).await; + handling_authentication_keys::it_should_fail_without_a_source_path_trying_to_remove_a_missing_key(driver).await; handling_the_whitelist::it_should_load_the_whitelist(driver).await; handling_the_whitelist::it_should_add_and_get_infohashes(driver).await; handling_the_whitelist::it_should_remove_an_infohash_from_the_whitelist(driver).await; handling_the_whitelist::it_should_fail_trying_to_add_the_same_infohash_twice(driver).await; + handling_the_whitelist::it_should_fail_without_a_source_path_trying_to_add_the_same_infohash_twice(driver).await; + handling_the_whitelist::it_should_fail_without_a_source_path_trying_to_remove_a_missing_infohash(driver).await; } async fn database_setup(driver: &Arc>) { @@ -215,6 +219,7 @@ pub(crate) mod tests { use crate::authentication::key::{generate_expiring_key, generate_permanent_key}; use crate::databases::traits::Database; + use crate::test_helpers::tests::assert_names_no_source_path; pub async fn it_should_load_the_keys(driver: &Arc>) { let permanent_peer_key = generate_permanent_key(); @@ -265,6 +270,24 @@ pub(crate) mod tests { assert!(driver.get_key_from_keys(&peer_key.key()).await.unwrap().is_none()); } + + pub async fn it_should_fail_without_a_source_path_trying_to_add_the_same_key_twice(driver: &Arc>) { + let peer_key = generate_permanent_key(); + driver.add_key_to_keys(&peer_key).await.unwrap(); + + let error = driver.add_key_to_keys(&peer_key).await.unwrap_err(); + + assert_names_no_source_path(&error.to_string()); + } + + pub async fn it_should_fail_without_a_source_path_trying_to_remove_a_missing_key(driver: &Arc>) { + let missing_key = generate_permanent_key().key(); + + let error = driver.remove_key_from_keys(&missing_key).await.unwrap_err(); + + assert_names_no_source_path(&error.to_string()); + assert!(error.to_string().starts_with("Failed to remove record from "), "{error}"); + } } mod handling_the_whitelist { @@ -272,7 +295,7 @@ pub(crate) mod tests { use std::sync::Arc; use crate::databases::traits::Database; - use crate::test_helpers::tests::random_info_hash; + use crate::test_helpers::tests::{assert_names_no_source_path, random_info_hash}; pub async fn it_should_load_the_whitelist(driver: &Arc>) { let infohash = random_info_hash(); @@ -310,5 +333,23 @@ pub(crate) mod tests { assert!(result.is_err()); } + + pub async fn it_should_fail_without_a_source_path_trying_to_add_the_same_infohash_twice(driver: &Arc>) { + let infohash = random_info_hash(); + driver.add_info_hash_to_whitelist(infohash).await.unwrap(); + + let error = driver.add_info_hash_to_whitelist(infohash).await.unwrap_err(); + + assert_names_no_source_path(&error.to_string()); + } + + pub async fn it_should_fail_without_a_source_path_trying_to_remove_a_missing_infohash(driver: &Arc>) { + let missing_infohash = random_info_hash(); + + let error = driver.remove_info_hash_from_whitelist(missing_infohash).await.unwrap_err(); + + assert_names_no_source_path(&error.to_string()); + assert!(error.to_string().starts_with("Failed to remove record from "), "{error}"); + } } } diff --git a/packages/tracker-core/src/test_helpers.rs b/packages/tracker-core/src/test_helpers.rs index 7cd17f065c..4469157d18 100644 --- a/packages/tracker-core/src/test_helpers.rs +++ b/packages/tracker-core/src/test_helpers.rs @@ -247,4 +247,25 @@ pub mod tests { }; temp_file.to_str().unwrap().clone_into(path); } + + /// Fails when `message` contains anything that looks like a source path: a workspace path, a + /// registry checkout, the standard library sources, or a `file.rs:line` suffix, written with + /// either path separator. It reports a failure at the caller's line. + #[track_caller] + pub fn assert_names_no_source_path(message: &str) { + for fragment in [ + ".rs:", + "packages/", + "packages\\", + "src/", + "src\\", + ".cargo/registry", + "rustlib/src", + ] { + assert!( + !message.contains(fragment), + "the error message must not hold a source path, but it contains {fragment:?}: {message:?}" + ); + } + } } diff --git a/packages/tracker-core/src/whitelist/authorization.rs b/packages/tracker-core/src/whitelist/authorization.rs index 91c2f05c84..a097007d32 100644 --- a/packages/tracker-core/src/whitelist/authorization.rs +++ b/packages/tracker-core/src/whitelist/authorization.rs @@ -138,6 +138,18 @@ mod tests { assert!(matches!(result.unwrap_err(), WhitelistError::TorrentNotWhitelisted { .. })); } + + #[tokio::test] + async fn should_reject_a_non_whitelisted_infohash_with_a_message_that_names_it_and_holds_no_source_path() { + let whitelist_authorization = initialize_whitelist_authorization_with(&configuration_for_listed_tracker()); + + let error = whitelist_authorization.authorize(&sample_info_hash()).await.unwrap_err(); + + assert_eq!( + error.to_string(), + format!("The torrent: {}, is not whitelisted", sample_info_hash()) + ); + } } mod when_the_tacker_is_not_configured_as_listed { diff --git a/packages/udp-server/src/event.rs b/packages/udp-server/src/event.rs index dbce5939e6..4fc777cf14 100644 --- a/packages/udp-server/src/event.rs +++ b/packages/udp-server/src/event.rs @@ -288,7 +288,7 @@ mod tests { // Assert assert!( - matches!(actual, ErrorKind::Whitelist(message) if message.contains("The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted")) + matches!(actual, ErrorKind::Whitelist(message) if message == "The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted") ); } @@ -306,7 +306,7 @@ mod tests { // Assert assert!( - matches!(actual, ErrorKind::Whitelist(message) if message.contains("The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted")) + matches!(actual, ErrorKind::Whitelist(message) if message == "The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted") ); } @@ -346,7 +346,7 @@ mod tests { // Assert assert!( - matches!(actual, ErrorKind::Whitelist(message) if message.contains("The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted")) + matches!(actual, ErrorKind::Whitelist(message) if message == "The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted") ); } @@ -364,7 +364,7 @@ mod tests { // Assert assert!( - matches!(actual, ErrorKind::Whitelist(message) if message.contains("The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted")) + matches!(actual, ErrorKind::Whitelist(message) if message == "The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted") ); } diff --git a/packages/udp-server/tests/server/asserts.rs b/packages/udp-server/tests/server/asserts.rs index 5a89cb6eee..4b7d81af8f 100644 --- a/packages/udp-server/tests/server/asserts.rs +++ b/packages/udp-server/tests/server/asserts.rs @@ -21,3 +21,24 @@ pub const fn is_ipv4_announce_response(response: &Response) -> bool { pub const fn is_scrape_response(response: &Response) -> bool { matches!(response, Response::Scrape(_)) } + +/// Fails when `message` contains anything that looks like a source path: a workspace path, a +/// registry checkout, the standard library sources, or a `file.rs:line` suffix, written with +/// either path separator. It reports a failure at the caller's line. +#[track_caller] +pub fn assert_names_no_source_path(message: &str) { + for fragment in [ + ".rs:", + "packages/", + "packages\\", + "src/", + "src\\", + ".cargo/registry", + "rustlib/src", + ] { + assert!( + !message.contains(fragment), + "the error message must not hold a source path, but it contains {fragment:?}: {message:?}" + ); + } +} diff --git a/packages/udp-server/tests/server/contract.rs b/packages/udp-server/tests/server/contract.rs index 312a598dbb..a88fb2f618 100644 --- a/packages/udp-server/tests/server/contract.rs +++ b/packages/udp-server/tests/server/contract.rs @@ -138,7 +138,7 @@ mod receiving_an_announce_request { use super::DEFAULT_UDP_TIMEOUT; use crate::common::fixtures::{random_info_hash, random_transaction_id}; - use crate::server::asserts::is_ipv4_announce_response; + use crate::server::asserts::{assert_names_no_source_path, get_error_response_message, is_ipv4_announce_response}; use crate::server::contract::send_connection_request; pub async fn assert_send_and_get_announce( @@ -219,6 +219,33 @@ mod receiving_an_announce_request { env.stop().await; } + #[tokio::test] + async fn should_reject_a_torrent_that_is_not_whitelisted_with_a_message_that_holds_no_source_path() { + logging::setup(); + + let cfg = configuration::ephemeral_listed(); + let core_config = Arc::new(cfg.core.clone()); + let udp_tracker_config = Arc::new(cfg.udp_trackers.unwrap()[0].clone()); + let env = torrust_tracker_udp_server::testing::environment::Started::new(&core_config, &udp_tracker_config).await; + let client = UdpTrackerClient::new(env.bind_address(), DEFAULT_UDP_TIMEOUT) + .await + .expect("UDP client should connect to the ephemeral tracker"); + let tx_id = TransactionId::new(123); + let c_id = send_connection_request(tx_id, &client).await; + let info_hash = random_info_hash(); + + let response = send_and_get_announce(tx_id, c_id, info_hash, &client).await; + + let message = get_error_response_message(&response).expect("an error response"); + assert_names_no_source_path(&message); + assert!( + message.contains(&format!("The torrent: {info_hash}, is not whitelisted")), + "{message:?}" + ); + + env.stop().await; + } + #[tokio::test] async fn should_return_many_announce_response() { logging::setup(); From fd913403a62b1afd305500b867e1b9b7ff8eb552 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Sat, 21 Nov 2026 13:34:43 +0000 Subject: [PATCH 02/14] fix(tracker-core): [#2916] remove source locations from whitelist and authentication key errors WhitelistError::TorrentNotWhitelisted and the UnableToReadKey, KeyExpired and MissingAuthKey variants of authentication::key::Error no longer hold a location. The UDP error response, the HTTP failure reason and the ErrorKind::Whitelist event payload built from them now hold no source path. KeyExpired and MissingAuthKey become unit variants. Co-Authored-By: Claude Opus 5.5 --- .../open/2916-2912-si-4-tracker-core/ISSUE.md | 7 ++++--- packages/http-core/src/services/announce.rs | 10 ++-------- .../http-core/src/services/error_mapping.rs | 14 ++++--------- packages/http-core/src/services/scrape.rs | 6 +----- .../src/authentication/key/mod.rs | 20 +++++++------------ .../src/authentication/service.rs | 4 +--- packages/tracker-core/src/error.rs | 20 ++++++------------- .../src/whitelist/authorization.rs | 6 +----- packages/udp-server/src/event.rs | 5 +---- 9 files changed, 27 insertions(+), 65 deletions(-) diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md b/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md index d7240ea8dd..a2285f1449 100644 --- a/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md +++ b/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md @@ -9,7 +9,7 @@ github-issue: 2916 spec-path: docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md branch: "2916-tracker-core" related-pr: null -last-updated-utc: "2026-11-21 13:31" +last-updated-utc: "2026-11-21 13:34" semantic-links: skill-links: - create-issue @@ -148,8 +148,8 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. | ID | Status | Task | Notes / Expected Output | | --- | --- | --- | --- | | T1 | DONE | Reproduce and record | UDP, HTTP and REST replies with a library path, in `manual-verification-evidence.md`. | -| T2 | IN_PROGRESS | Red tests | Unit tests for the 7 variants and the `PeerKeyError`/database sources; protocol tests for UDP, HTTP and REST; red output recorded. | -| T3 | TODO | Whitelist and key errors | `location` removed from `WhitelistError` and `authentication::key::Error` and their sites, including `http-core`. | +| T2 | DONE | Red tests | Unit tests for the 7 variants and the `PeerKeyError`/database sources; protocol tests for UDP, HTTP and REST; red output recorded. | +| T3 | DONE | Whitelist and key errors | `location` removed from `WhitelistError` and `authentication::key::Error` and their sites, including `http-core`. | | T4 | TODO | Database errors | `location` removed from the three variants and 12 driver sites; `LocatedError` sources replaced; `tracing` event added where needed. | | T5 | TODO | `PeerKeyError` sources and dependency | Plain sources; six `Located(..).into()` removed; `torrust-located-error` removed from `tracker-core/Cargo.toml`. | | T6 | TODO | Consumers | `udp-core`, `udp-server`, `http-core`, `rest-api-runtime-adapter` compile and their tests are updated. | @@ -211,6 +211,7 @@ the model that produced them. - 2026-11-11 17:05 UTC - Claude Code (Fable 5.2) - Drafted from the audit of issue #2804 (`docs/issues/open/2804-location-caller-track-caller-audit/inventory.md`, `options.md`) as a sub-issue of the EPIC draft. Not yet approved; line numbers are those of `develop` at `4f0af379a` and must be re-checked before implementation. - 2026-11-17 17:30 UTC - Claude Code (Claude Opus 5.5) - EPIC coordinator: the maintainer approved the specification on 2026-11-17; issue #2916 created as `josecelano-bot` and the specification moved from `docs/issues/drafts/` to `docs/issues/open/` (SI-4 of EPIC #2912). - 2026-11-21 13:31 UTC - Claude Code (Claude Opus 5.5) - T1: reproduced on `develop` at `4be22ee66` with a listed and a private tracker (UDP, HTTP and REST replies all hold `packages/...rs:line` paths; a duplicate key over REST holds two, from the driver and from `authentication/handler.rs`). T2: red tests added at the tracker-core seams (whitelist authorization, authentication service, the shared driver tests, the keys handler) and at the protocol servers (UDP contract, HTTP `failure_reasons_hold_no_source_path.rs`, REST `assert_unhandled_rejection`, which now also forbids source paths), and the `ErrorKind::Whitelist` payload tests in `udp-server/src/event.rs` pinned to the full message. Decisions pending for T3 to T5 are recorded when made. +- 2026-11-21 13:34 UTC - Claude Code (Claude Opus 5.5) - T2: red run at `test(tracker-core): [#2916] add red tests that tracker-core error texts name no source path`, all new and changed tests fail with a `packages/...rs:line` path (output in `evidence/`). T3: `location` removed from `WhitelistError::TorrentNotWhitelisted` and `authentication::key::Error::{UnableToReadKey, KeyExpired, MissingAuthKey}`; `KeyExpired` and `MissingAuthKey` become unit variants; the build sites in `whitelist/authorization.rs`, `authentication/service.rs`, `authentication/key/mod.rs` and `http-core/src/services/announce.rs` and the tests of `http-core` and `udp-server/src/event.rs` follow. The whitelist and key tests turn green; the database and `PeerKeyError` ones stay red until T4 and T5. ## Acceptance Criteria diff --git a/packages/http-core/src/services/announce.rs b/packages/http-core/src/services/announce.rs index 93e8d64059..a8d859b9c8 100644 --- a/packages/http-core/src/services/announce.rs +++ b/packages/http-core/src/services/announce.rs @@ -7,7 +7,6 @@ //! //! It also sends an [`Event`] //! because events are specific for the HTTP tracker. -use std::panic::Location; use std::sync::Arc; use torrust_info_hash::InfoHash; @@ -304,9 +303,7 @@ impl AnnounceService { async fn authenticate(&self, maybe_key: Option) -> Result<(), authentication::key::Error> { if self.core_config.private { - let key = maybe_key.ok_or(authentication::key::Error::MissingAuthKey { - location: Location::caller(), - })?; + let key = maybe_key.ok_or(authentication::key::Error::MissingAuthKey)?; self.authentication_service.authenticate(&key).await?; } @@ -434,7 +431,6 @@ impl From for HttpProtocolErrorResponse { mod tests { use std::future; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; - use std::panic::Location; use std::sync::Arc; use rstest::rstest; @@ -1019,7 +1015,7 @@ mod tests { result, Err(HttpAnnounceError::TrackerCoreError { source: TrackerCoreError::AuthenticationError { - source: AuthenticationKeyError::MissingAuthKey { .. } + source: AuthenticationKeyError::MissingAuthKey } }) ), @@ -1514,7 +1510,6 @@ mod tests { // Arrange let tracker_core_error = TrackerCoreError::from(WhitelistError::TorrentNotWhitelisted { info_hash: sample_info_hash(), - location: Location::caller(), }); let tracker_core_response = protocol_error_from_tracker_core_error(tracker_core_error.clone()); @@ -1530,7 +1525,6 @@ mod tests { // Arrange let tracker_core_error = TrackerCoreError::from(WhitelistError::TorrentNotWhitelisted { info_hash: sample_info_hash(), - location: Location::caller(), }); // Act diff --git a/packages/http-core/src/services/error_mapping.rs b/packages/http-core/src/services/error_mapping.rs index 497444df19..099b2c93fe 100644 --- a/packages/http-core/src/services/error_mapping.rs +++ b/packages/http-core/src/services/error_mapping.rs @@ -23,8 +23,6 @@ pub fn protocol_error_from_tracker_core_error(error: TrackerCoreError) -> HttpPr #[cfg(test)] mod tests { - use std::panic::Location; - use rstest::rstest; use torrust_tracker_core::authentication::key::Error as AuthenticationKeyError; use torrust_tracker_core::error::{AnnounceError, ScrapeError, TrackerCoreError, WhitelistError}; @@ -32,20 +30,16 @@ mod tests { use super::protocol_error_from_tracker_core_error; use crate::tests::sample_info_hash; - // Each helper returns an equal error on every call, because `Location::caller()` - // names the call site inside the helper. A test builds the error under test and - // the text it expects from two separate calls. + // A test builds the error under test and the text it expects from two + // separate calls of the same helper. fn not_whitelisted() -> WhitelistError { WhitelistError::TorrentNotWhitelisted { info_hash: sample_info_hash(), - location: Location::caller(), } } - fn missing_key() -> AuthenticationKeyError { - AuthenticationKeyError::MissingAuthKey { - location: Location::caller(), - } + const fn missing_key() -> AuthenticationKeyError { + AuthenticationKeyError::MissingAuthKey } #[rstest] diff --git a/packages/http-core/src/services/scrape.rs b/packages/http-core/src/services/scrape.rs index 652d7cfe9b..2f966e467f 100644 --- a/packages/http-core/src/services/scrape.rs +++ b/packages/http-core/src/services/scrape.rs @@ -214,7 +214,6 @@ mod tests { use std::collections::BTreeMap; use std::future; use std::net::{IpAddr, SocketAddr}; - use std::panic::Location; use std::sync::Arc; use rstest::rstest; @@ -830,7 +829,6 @@ mod tests { // Arrange let whitelist_error = WhitelistError::TorrentNotWhitelisted { info_hash: sample_info_hash(), - location: Location::caller(), }; // Act @@ -851,9 +849,7 @@ mod tests { #[test] fn it_should_wrap_an_authentication_error_in_the_tracker_core_variant() { // Arrange - let authentication_error = AuthenticationKeyError::MissingAuthKey { - location: Location::caller(), - }; + let authentication_error = AuthenticationKeyError::MissingAuthKey; // Act let error = HttpScrapeError::from(authentication_error); diff --git a/packages/tracker-core/src/authentication/key/mod.rs b/packages/tracker-core/src/authentication/key/mod.rs index 6e5d39289b..b6b9eee9a8 100644 --- a/packages/tracker-core/src/authentication/key/mod.rs +++ b/packages/tracker-core/src/authentication/key/mod.rs @@ -43,7 +43,6 @@ pub mod peer_key; pub mod repository; -use std::panic::Location; use std::sync::Arc; use std::time::Duration; @@ -154,9 +153,7 @@ pub fn verify_key_expiration(auth_key: &PeerKey) -> Result<(), Error> { || Ok(()), |valid_until| { if valid_until < current_time { - Err(Error::KeyExpired { - location: Location::caller(), - }) + Err(Error::KeyExpired) } else { Ok(()) } @@ -177,19 +174,16 @@ pub enum Error { }, /// Indicates that the key could not be read or found. - #[error("Failed to read key: {key}, {location}")] - UnableToReadKey { - location: &'static Location<'static>, - key: Box, - }, + #[error("Failed to read key: {key}")] + UnableToReadKey { key: Box }, /// Indicates that the key has expired. - #[error("Key has expired, {location}")] - KeyExpired { location: &'static Location<'static> }, + #[error("Key has expired")] + KeyExpired, /// Indicates that the required key for authentication was not provided. - #[error("Missing authentication key, {location}")] - MissingAuthKey { location: &'static Location<'static> }, + #[error("Missing authentication key")] + MissingAuthKey, } impl From for Error { diff --git a/packages/tracker-core/src/authentication/service.rs b/packages/tracker-core/src/authentication/service.rs index 4a3d40f48b..a23e741b24 100644 --- a/packages/tracker-core/src/authentication/service.rs +++ b/packages/tracker-core/src/authentication/service.rs @@ -1,5 +1,4 @@ //! Authentication service. -use std::panic::Location; use std::sync::Arc; use torrust_tracker_configuration::v3_0_0::core::Core; @@ -76,7 +75,7 @@ impl AuthenticationService { /// Verifies the authentication key against the in-memory repository. /// /// This function retrieves the key from the repository. If the key is not - /// found, it returns an error with the caller's location. If the key is + /// found, it returns an error that names the key. If the key is /// found, the function then checks the key's expiration based on the /// tracker configuration. The behavior differs depending on whether a /// `private` configuration is provided and whether key expiration checking @@ -95,7 +94,6 @@ impl AuthenticationService { async fn verify_auth_key(&self, key: &Key) -> Result<(), Error> { match self.in_memory_key_repository.get(key).await { None => Err(Error::UnableToReadKey { - location: Location::caller(), key: Box::new(key.clone()), }), Some(key) => match self.config.private_mode { diff --git a/packages/tracker-core/src/error.rs b/packages/tracker-core/src/error.rs index e41ed4cdf7..4b2f8927d7 100644 --- a/packages/tracker-core/src/error.rs +++ b/packages/tracker-core/src/error.rs @@ -4,10 +4,9 @@ //! tracker core. //! //! These errors encapsulate issues such as whitelisting violations, invalid -//! peer key data, and database persistence failures. Each error variant -//! includes contextual information (such as source code location) to facilitate -//! debugging. -use std::panic::Location; +//! peer key data, and database persistence failures. Each error variant names +//! what failed and the offending input; none records a source location (see +//! `docs/adrs/20261118045443_errors_do_not_record_source_locations.md`). use torrust_info_hash::InfoHash; use torrust_located_error::LocatedError; @@ -101,11 +100,8 @@ pub enum ScrapeError { #[non_exhaustive] pub enum WhitelistError { /// Indicates that the torrent identified by `info_hash` is not whitelisted. - #[error("The torrent: {info_hash}, is not whitelisted, {location}")] - TorrentNotWhitelisted { - info_hash: InfoHash, - location: &'static Location<'static>, - }, + #[error("The torrent: {info_hash}, is not whitelisted")] + TorrentNotWhitelisted { info_hash: InfoHash }, } /// Errors related to peer key operations. @@ -151,15 +147,11 @@ mod tests { fn torrent_not_whitelisted() { let err = WhitelistError::TorrentNotWhitelisted { info_hash: sample_info_hash(), - location: std::panic::Location::caller(), }; let err_msg = format!("{err}"); - assert!( - err_msg.contains(&format!("The torrent: {}, is not whitelisted", sample_info_hash())), - "Error message did not contain expected text: {err_msg}" - ); + assert_eq!(err_msg, format!("The torrent: {}, is not whitelisted", sample_info_hash())); } } diff --git a/packages/tracker-core/src/whitelist/authorization.rs b/packages/tracker-core/src/whitelist/authorization.rs index a097007d32..7ed60972e4 100644 --- a/packages/tracker-core/src/whitelist/authorization.rs +++ b/packages/tracker-core/src/whitelist/authorization.rs @@ -1,5 +1,4 @@ //! Whitelist authorization. -use std::panic::Location; use std::sync::Arc; use torrust_info_hash::InfoHash; @@ -56,10 +55,7 @@ impl WhitelistAuthorization { return Ok(()); } - Err(WhitelistError::TorrentNotWhitelisted { - info_hash: *info_hash, - location: Location::caller(), - }) + Err(WhitelistError::TorrentNotWhitelisted { info_hash: *info_hash }) } /// Checks if the tracker is running in "listed" mode. diff --git a/packages/udp-server/src/event.rs b/packages/udp-server/src/event.rs index 4fc777cf14..5c48a878a8 100644 --- a/packages/udp-server/src/event.rs +++ b/packages/udp-server/src/event.rs @@ -223,10 +223,7 @@ mod tests { let info_hash = InfoHash::from_str("3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0") // DevSkim: ignore DS173237 .expect("test info hash should be valid"); - WhitelistError::TorrentNotWhitelisted { - info_hash, - location: Location::caller(), - } + WhitelistError::TorrentNotWhitelisted { info_hash } } #[test] From fa34f8d922e714734b6c99d6dd32aa1989efb107 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Sat, 21 Nov 2026 13:37:17 +0000 Subject: [PATCH 03/14] fix(tracker-core): [#2916] remove source locations from database errors InsertFailed, UpdateFailed and DeleteFailed no longer hold a location, and the 12 driver sites that build them emit a tracing event naming the driver and the table instead. The LocatedError sources of the other variants become plain shareable sources, and the sqlx and migrate conversions lose #[track_caller]. Co-Authored-By: Claude Opus 5.5 --- .../open/2916-2912-si-4-tracker-core/ISSUE.md | 5 +- .../src/authentication/handler.rs | 32 +----- .../databases/driver/mysql/auth_key_store.rs | 8 +- .../databases/driver/mysql/whitelist_store.rs | 9 +- .../driver/postgres/auth_key_store.rs | 8 +- .../driver/postgres/whitelist_store.rs | 9 +- .../databases/driver/sqlite/auth_key_store.rs | 10 +- .../driver/sqlite/whitelist_store.rs | 9 +- packages/tracker-core/src/databases/error.rs | 100 +++++++++++------- packages/tracker-core/src/error.rs | 5 +- .../src/statistics/event/handler.rs | 10 +- 11 files changed, 88 insertions(+), 117 deletions(-) diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md b/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md index a2285f1449..7f96e74e39 100644 --- a/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md +++ b/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md @@ -9,7 +9,7 @@ github-issue: 2916 spec-path: docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md branch: "2916-tracker-core" related-pr: null -last-updated-utc: "2026-11-21 13:34" +last-updated-utc: "2026-11-21 13:37" semantic-links: skill-links: - create-issue @@ -150,7 +150,7 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. | T1 | DONE | Reproduce and record | UDP, HTTP and REST replies with a library path, in `manual-verification-evidence.md`. | | T2 | DONE | Red tests | Unit tests for the 7 variants and the `PeerKeyError`/database sources; protocol tests for UDP, HTTP and REST; red output recorded. | | T3 | DONE | Whitelist and key errors | `location` removed from `WhitelistError` and `authentication::key::Error` and their sites, including `http-core`. | -| T4 | TODO | Database errors | `location` removed from the three variants and 12 driver sites; `LocatedError` sources replaced; `tracing` event added where needed. | +| T4 | DONE | Database errors | `location` removed from the three variants and 12 driver sites; `LocatedError` sources replaced; `tracing` event added where needed. | | T5 | TODO | `PeerKeyError` sources and dependency | Plain sources; six `Located(..).into()` removed; `torrust-located-error` removed from `tracker-core/Cargo.toml`. | | T6 | TODO | Consumers | `udp-core`, `udp-server`, `http-core`, `rest-api-runtime-adapter` compile and their tests are updated. | | T7 | TODO | Green and recheck | Green output, then the T1 requests repeated against the running tracker. | @@ -212,6 +212,7 @@ the model that produced them. - 2026-11-17 17:30 UTC - Claude Code (Claude Opus 5.5) - EPIC coordinator: the maintainer approved the specification on 2026-11-17; issue #2916 created as `josecelano-bot` and the specification moved from `docs/issues/drafts/` to `docs/issues/open/` (SI-4 of EPIC #2912). - 2026-11-21 13:31 UTC - Claude Code (Claude Opus 5.5) - T1: reproduced on `develop` at `4be22ee66` with a listed and a private tracker (UDP, HTTP and REST replies all hold `packages/...rs:line` paths; a duplicate key over REST holds two, from the driver and from `authentication/handler.rs`). T2: red tests added at the tracker-core seams (whitelist authorization, authentication service, the shared driver tests, the keys handler) and at the protocol servers (UDP contract, HTTP `failure_reasons_hold_no_source_path.rs`, REST `assert_unhandled_rejection`, which now also forbids source paths), and the `ErrorKind::Whitelist` payload tests in `udp-server/src/event.rs` pinned to the full message. Decisions pending for T3 to T5 are recorded when made. - 2026-11-21 13:34 UTC - Claude Code (Claude Opus 5.5) - T2: red run at `test(tracker-core): [#2916] add red tests that tracker-core error texts name no source path`, all new and changed tests fail with a `packages/...rs:line` path (output in `evidence/`). T3: `location` removed from `WhitelistError::TorrentNotWhitelisted` and `authentication::key::Error::{UnableToReadKey, KeyExpired, MissingAuthKey}`; `KeyExpired` and `MissingAuthKey` become unit variants; the build sites in `whitelist/authorization.rs`, `authentication/service.rs`, `authentication/key/mod.rs` and `http-core/src/services/announce.rs` and the tests of `http-core` and `udp-server/src/event.rs` follow. The whitelist and key tests turn green; the database and `PeerKeyError` ones stay red until T4 and T5. +- 2026-11-21 13:37 UTC - Claude Code (Claude Opus 5.5) - T4: `location` removed from `databases::error::Error::{InsertFailed, UpdateFailed, DeleteFailed}` and from the 12 driver sites (an insert and a delete in `whitelist_store.rs` and `auth_key_store.rs` of each of the three drivers). The message names the driver but not the table, so each site now emits a `tracing::warn!` with the driver, the table and, for the whitelist, the info-hash (never the key). The four `LocatedError` sources become a plain `Arc` (still `Clone`), and the two `From` conversions lose `#[track_caller]`. Decision on `UpdateFailed`: kept. No production code builds it (`grep -rn UpdateFailed packages` finds only the variant and the test double in `statistics/event/handler.rs`), but it is a public variant of a `#[non_exhaustive]` enum, removing it is not needed to remove the location, and the test double uses it as a representative persistence failure; removal can be its own change if wanted. Pinned-message unit tests added for the three variants and for a converted `sqlx` error. The driver tests are green; the `PeerKeyError` ones stay red until T5. ## Acceptance Criteria diff --git a/packages/tracker-core/src/authentication/handler.rs b/packages/tracker-core/src/authentication/handler.rs index 58c95350f9..7eccd1592d 100644 --- a/packages/tracker-core/src/authentication/handler.rs +++ b/packages/tracker-core/src/authentication/handler.rs @@ -354,7 +354,6 @@ mod tests { } mod randomly_generated { - use std::panic::Location; use std::sync::Arc; use std::time::Duration; @@ -407,12 +406,7 @@ mod tests { })) .times(1) .returning(|_peer_key| { - Box::pin(async move { - Err(databases::error::Error::InsertFailed { - location: Location::caller(), - driver: Driver::Sqlite3, - }) - }) + Box::pin(async move { Err(databases::error::Error::InsertFailed { driver: Driver::Sqlite3 }) }) }); let auth_key_store: Arc = Arc::new(database_mock); @@ -430,7 +424,6 @@ mod tests { } mod pre_generated { - use std::panic::Location; use std::sync::Arc; use std::time::Duration; @@ -518,12 +511,7 @@ mod tests { .with(predicate::eq(expected_peer_key)) .times(1) .returning(|_peer_key| { - Box::pin(async move { - Err(databases::error::Error::InsertFailed { - location: Location::caller(), - driver: Driver::Sqlite3, - }) - }) + Box::pin(async move { Err(databases::error::Error::InsertFailed { driver: Driver::Sqlite3 }) }) }); let auth_key_store: Arc = Arc::new(database_mock); @@ -545,7 +533,6 @@ mod tests { mod randomly_generated { - use std::panic::Location; use std::sync::Arc; use mockall::predicate::function; @@ -594,12 +581,7 @@ mod tests { .with(function(move |peer_key: &PeerKey| peer_key.valid_until.is_none())) .times(1) .returning(|_peer_key| { - Box::pin(async move { - Err(databases::error::Error::InsertFailed { - location: Location::caller(), - driver: Driver::Sqlite3, - }) - }) + Box::pin(async move { Err(databases::error::Error::InsertFailed { driver: Driver::Sqlite3 }) }) }); let auth_key_store: Arc = Arc::new(database_mock); @@ -618,7 +600,6 @@ mod tests { mod pre_generated_keys { - use std::panic::Location; use std::sync::Arc; use mockall::predicate; @@ -683,12 +664,7 @@ mod tests { .with(predicate::eq(expected_peer_key)) .times(1) .returning(|_peer_key| { - Box::pin(async move { - Err(databases::error::Error::InsertFailed { - location: Location::caller(), - driver: Driver::Sqlite3, - }) - }) + Box::pin(async move { Err(databases::error::Error::InsertFailed { driver: Driver::Sqlite3 }) }) }); let auth_key_store: Arc = Arc::new(database_mock); diff --git a/packages/tracker-core/src/databases/driver/mysql/auth_key_store.rs b/packages/tracker-core/src/databases/driver/mysql/auth_key_store.rs index e9150d21ac..fac325e8f9 100644 --- a/packages/tracker-core/src/databases/driver/mysql/auth_key_store.rs +++ b/packages/tracker-core/src/databases/driver/mysql/auth_key_store.rs @@ -78,10 +78,8 @@ impl AuthKeyStore for Mysql { .rows_affected(); if insert == 0 { - Err(Error::InsertFailed { - location: std::panic::Location::caller(), - driver: DRIVER, - }) + tracing::warn!(driver = %DRIVER, table = "keys", "the insert affected no rows"); + Err(Error::InsertFailed { driver: DRIVER }) } else { usize::try_from(insert).map_err(|e| Error::MalformedDatabaseRecord { message: format!("rows_affected does not fit in usize: {e}"), @@ -101,8 +99,8 @@ impl AuthKeyStore for Mysql { if deleted == 1 { Ok(1) } else { + tracing::warn!(driver = %DRIVER, table = "keys", rows_deleted = deleted, "the delete did not remove exactly one row"); Err(Error::DeleteFailed { - location: std::panic::Location::caller(), error_code: usize::try_from(deleted).unwrap_or(0), driver: DRIVER, }) diff --git a/packages/tracker-core/src/databases/driver/mysql/whitelist_store.rs b/packages/tracker-core/src/databases/driver/mysql/whitelist_store.rs index be504693fc..d24902c6fa 100644 --- a/packages/tracker-core/src/databases/driver/mysql/whitelist_store.rs +++ b/packages/tracker-core/src/databases/driver/mysql/whitelist_store.rs @@ -1,4 +1,3 @@ -use std::panic::Location; use std::str::FromStr; use ::sqlx::Row; @@ -55,10 +54,8 @@ impl WhitelistStore for Mysql { .rows_affected(); if insert == 0 { - Err(Error::InsertFailed { - location: Location::caller(), - driver: DRIVER, - }) + tracing::warn!(driver = %DRIVER, table = "whitelist", %info_hash, "the insert affected no rows"); + Err(Error::InsertFailed { driver: DRIVER }) } else { usize::try_from(insert).map_err(|e| Error::MalformedDatabaseRecord { message: format!("rows_affected does not fit in usize: {e}"), @@ -78,8 +75,8 @@ impl WhitelistStore for Mysql { if deleted == 1 { Ok(1) } else { + tracing::warn!(driver = %DRIVER, table = "whitelist", %info_hash, rows_deleted = deleted, "the delete did not remove exactly one row"); Err(Error::DeleteFailed { - location: Location::caller(), error_code: usize::try_from(deleted).unwrap_or(0), driver: DRIVER, }) diff --git a/packages/tracker-core/src/databases/driver/postgres/auth_key_store.rs b/packages/tracker-core/src/databases/driver/postgres/auth_key_store.rs index 273971f58c..daf607e30a 100644 --- a/packages/tracker-core/src/databases/driver/postgres/auth_key_store.rs +++ b/packages/tracker-core/src/databases/driver/postgres/auth_key_store.rs @@ -78,10 +78,8 @@ impl AuthKeyStore for Postgres { .rows_affected(); if insert == 0 { - Err(Error::InsertFailed { - location: std::panic::Location::caller(), - driver: DRIVER, - }) + tracing::warn!(driver = %DRIVER, table = "keys", "the insert affected no rows"); + Err(Error::InsertFailed { driver: DRIVER }) } else { usize::try_from(insert).map_err(|e| Error::MalformedDatabaseRecord { message: format!("rows_affected does not fit in usize: {e}"), @@ -101,8 +99,8 @@ impl AuthKeyStore for Postgres { if deleted == 1 { Ok(1) } else { + tracing::warn!(driver = %DRIVER, table = "keys", rows_deleted = deleted, "the delete did not remove exactly one row"); Err(Error::DeleteFailed { - location: std::panic::Location::caller(), error_code: usize::try_from(deleted).unwrap_or(0), driver: DRIVER, }) diff --git a/packages/tracker-core/src/databases/driver/postgres/whitelist_store.rs b/packages/tracker-core/src/databases/driver/postgres/whitelist_store.rs index 07de8059af..e9c9eb3426 100644 --- a/packages/tracker-core/src/databases/driver/postgres/whitelist_store.rs +++ b/packages/tracker-core/src/databases/driver/postgres/whitelist_store.rs @@ -1,4 +1,3 @@ -use std::panic::Location; use std::str::FromStr; use ::sqlx::Row; @@ -55,10 +54,8 @@ impl WhitelistStore for Postgres { .rows_affected(); if insert == 0 { - Err(Error::InsertFailed { - location: Location::caller(), - driver: DRIVER, - }) + tracing::warn!(driver = %DRIVER, table = "whitelist", %info_hash, "the insert affected no rows"); + Err(Error::InsertFailed { driver: DRIVER }) } else { usize::try_from(insert).map_err(|e| Error::MalformedDatabaseRecord { message: format!("rows_affected does not fit in usize: {e}"), @@ -78,8 +75,8 @@ impl WhitelistStore for Postgres { if deleted == 1 { Ok(1) } else { + tracing::warn!(driver = %DRIVER, table = "whitelist", %info_hash, rows_deleted = deleted, "the delete did not remove exactly one row"); Err(Error::DeleteFailed { - location: Location::caller(), error_code: usize::try_from(deleted).unwrap_or(0), driver: DRIVER, }) diff --git a/packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs b/packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs index fa8edfc237..1edb799362 100644 --- a/packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs +++ b/packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs @@ -1,5 +1,3 @@ -use std::panic::Location; - use ::sqlx::Row; use async_trait::async_trait; use torrust_clock::DurationSinceUnixEpoch; @@ -80,10 +78,8 @@ impl AuthKeyStore for Sqlite { .rows_affected(); if insert == 0 { - Err(Error::InsertFailed { - location: Location::caller(), - driver: DRIVER, - }) + tracing::warn!(driver = %DRIVER, table = "keys", "the insert affected no rows"); + Err(Error::InsertFailed { driver: DRIVER }) } else { usize::try_from(insert).map_err(|e| Error::MalformedDatabaseRecord { message: format!("rows_affected does not fit in usize: {e}"), @@ -104,8 +100,8 @@ impl AuthKeyStore for Sqlite { // should only remove a single record. Ok(1) } else { + tracing::warn!(driver = %DRIVER, table = "keys", rows_deleted = deleted, "the delete did not remove exactly one row"); Err(Error::DeleteFailed { - location: Location::caller(), error_code: usize::try_from(deleted).unwrap_or(0), driver: DRIVER, }) diff --git a/packages/tracker-core/src/databases/driver/sqlite/whitelist_store.rs b/packages/tracker-core/src/databases/driver/sqlite/whitelist_store.rs index 279ee04822..b1202a5d5e 100644 --- a/packages/tracker-core/src/databases/driver/sqlite/whitelist_store.rs +++ b/packages/tracker-core/src/databases/driver/sqlite/whitelist_store.rs @@ -1,4 +1,3 @@ -use std::panic::Location; use std::str::FromStr; use ::sqlx::Row; @@ -55,10 +54,8 @@ impl WhitelistStore for Sqlite { .rows_affected(); if insert == 0 { - Err(Error::InsertFailed { - location: Location::caller(), - driver: DRIVER, - }) + tracing::warn!(driver = %DRIVER, table = "whitelist", %info_hash, "the insert affected no rows"); + Err(Error::InsertFailed { driver: DRIVER }) } else { usize::try_from(insert).map_err(|e| Error::MalformedDatabaseRecord { message: format!("rows_affected does not fit in usize: {e}"), @@ -79,8 +76,8 @@ impl WhitelistStore for Sqlite { // should only remove a single record. Ok(1) } else { + tracing::warn!(driver = %DRIVER, table = "whitelist", %info_hash, rows_deleted = deleted, "the delete did not remove exactly one row"); Err(Error::DeleteFailed { - location: Location::caller(), error_code: usize::try_from(deleted).unwrap_or(0), driver: DRIVER, }) diff --git a/packages/tracker-core/src/databases/error.rs b/packages/tracker-core/src/databases/error.rs index b483f41e19..10b31eb15e 100644 --- a/packages/tracker-core/src/databases/error.rs +++ b/packages/tracker-core/src/databases/error.rs @@ -7,15 +7,18 @@ //! the associated database driver and, when applicable, the source error. //! //! External errors from the `sqlx` database library are converted into this -//! error type using the provided `From` implementations. -use std::panic::Location; +//! error type using the provided `From` implementations. No variant records a +//! source location (see +//! `docs/adrs/20261118045443_errors_do_not_record_source_locations.md`). use std::sync::Arc; use sqlx::Error as SqlxError; use sqlx::migrate::MigrateError; -use torrust_located_error::{DynError, LocatedError}; use torrust_tracker_primitives::Driver; +/// A shareable source error, so that [`Error`] stays `Clone`. +type DynError = Arc; + /// Database error type that encapsulates various failures encountered during /// database operations. #[derive(thiserror::Error, Debug, Clone)] @@ -26,49 +29,33 @@ pub enum Error { /// This error variant is used when a query that is expected to return a /// result does not. #[error("The {driver} query unexpectedly returned nothing: {source}")] - QueryReturnedNoRows { - source: LocatedError<'static, dyn std::error::Error + Send + Sync>, - driver: Driver, - }, + QueryReturnedNoRows { source: DynError, driver: Driver }, /// Indicates that the query was malformed. /// /// This error variant is used when the SQL query itself is invalid or /// improperly formatted. #[error("The {driver} query was malformed: {source}")] - InvalidQuery { - source: LocatedError<'static, dyn std::error::Error + Send + Sync>, - driver: Driver, - }, + InvalidQuery { source: DynError, driver: Driver }, /// Indicates a failure to insert a record into the database. /// /// This error is raised when an insertion operation fails. - #[error("Unable to insert record into {driver} database, {location}")] - InsertFailed { - location: &'static Location<'static>, - driver: Driver, - }, + #[error("Unable to insert record into {driver} database")] + InsertFailed { driver: Driver }, /// Indicates a failure to update a record into the database. /// /// This error is raised when an insertion operation fails. - #[error("Unable to update record into {driver} database, {location}")] - UpdateFailed { - location: &'static Location<'static>, - driver: Driver, - }, + #[error("Unable to update record into {driver} database")] + UpdateFailed { driver: Driver }, /// Indicates a failure to delete a record from the database. /// /// This error includes an error code that may be returned by the database /// driver. - #[error("Failed to remove record from {driver} database, error-code: {error_code}, {location}")] - DeleteFailed { - location: &'static Location<'static>, - error_code: usize, - driver: Driver, - }, + #[error("Failed to remove record from {driver} database, error-code: {error_code}")] + DeleteFailed { error_code: usize, driver: Driver }, /// Indicates that a row read from the database contains a malformed value /// (e.g., a corrupt or manually-edited `info_hash` or key string that @@ -81,10 +68,7 @@ pub enum Error { /// This error variant wraps connection-related errors, such as pool /// timeouts, TLS failures, or invalid URL errors. #[error("Failed to connect to {driver} database: {source}")] - ConnectionError { - source: LocatedError<'static, dyn std::error::Error + Send + Sync>, - driver: Driver, - }, + ConnectionError { source: DynError, driver: Driver }, /// Indicates a failure while applying schema migrations. /// @@ -92,10 +76,7 @@ pub enum Error { /// `MIGRATOR.run()` (or by the helpers used to bootstrap the /// `_sqlx_migrations` tracking table on legacy databases). #[error("Failed to apply {driver} schema migrations: {source}")] - MigrationError { - source: LocatedError<'static, dyn std::error::Error + Send + Sync>, - driver: Driver, - }, + MigrationError { source: DynError, driver: Driver }, /// Indicates that a pre-v4 database is in a partially-migrated state and /// cannot be auto-bootstrapped into the `sqlx` migration system. @@ -109,13 +90,12 @@ pub enum Error { } impl From<(SqlxError, Driver)> for Error { - #[track_caller] fn from(value: (SqlxError, Driver)) -> Self { let (err, driver) = value; match err { SqlxError::RowNotFound => Self::QueryReturnedNoRows { - source: (Arc::new(SqlxError::RowNotFound) as DynError).into(), + source: Arc::new(SqlxError::RowNotFound), driver, }, SqlxError::Io(_) @@ -124,11 +104,11 @@ impl From<(SqlxError, Driver)> for Error { | SqlxError::PoolClosed | SqlxError::WorkerCrashed | SqlxError::Configuration(_) => Self::ConnectionError { - source: (Arc::new(err) as DynError).into(), + source: Arc::new(err), driver, }, _ => Self::InvalidQuery { - source: (Arc::new(err) as DynError).into(), + source: Arc::new(err), driver, }, } @@ -136,12 +116,11 @@ impl From<(SqlxError, Driver)> for Error { } impl From<(MigrateError, Driver)> for Error { - #[track_caller] fn from(value: (MigrateError, Driver)) -> Self { let (err, driver) = value; Self::MigrationError { - source: (Arc::new(err) as DynError).into(), + source: Arc::new(err), driver, } } @@ -172,4 +151,43 @@ mod tests { assert!(matches!(err, Error::ConnectionError { .. })); } + + #[test] + fn it_should_render_a_sqlx_error_with_its_own_text_and_no_source_path() { + let err: Error = (sqlx::Error::RowNotFound, Driver::Sqlite3).into(); + + assert_eq!( + err.to_string(), + "The Sqlite3 query unexpectedly returned nothing: no rows returned by a query that expected to return at least one row" + ); + } + + #[test] + fn it_should_render_a_failed_insert_naming_the_driver() { + let err = Error::InsertFailed { driver: Driver::MySQL }; + + assert_eq!(err.to_string(), "Unable to insert record into MySQL database"); + } + + #[test] + fn it_should_render_a_failed_update_naming_the_driver() { + let err = Error::UpdateFailed { + driver: Driver::PostgreSQL, + }; + + assert_eq!(err.to_string(), "Unable to update record into PostgreSQL database"); + } + + #[test] + fn it_should_render_a_failed_delete_naming_the_driver_and_the_rows_removed() { + let err = Error::DeleteFailed { + error_code: 0, + driver: Driver::Sqlite3, + }; + + assert_eq!( + err.to_string(), + "Failed to remove record from Sqlite3 database, error-code: 0" + ); + } } diff --git a/packages/tracker-core/src/error.rs b/packages/tracker-core/src/error.rs index 4b2f8927d7..40cae72cc0 100644 --- a/packages/tracker-core/src/error.rs +++ b/packages/tracker-core/src/error.rs @@ -195,10 +195,7 @@ mod tests { #[test] fn persisting_into_database() { - let err = databases::error::Error::InsertFailed { - location: std::panic::Location::caller(), - driver: Driver::Sqlite3, - }; + let err = databases::error::Error::InsertFailed { driver: Driver::Sqlite3 }; let err = PeerKeyError::DatabaseError { source: Located(err).into(), diff --git a/packages/tracker-core/src/statistics/event/handler.rs b/packages/tracker-core/src/statistics/event/handler.rs index d93cee024d..d7e08ddc2d 100644 --- a/packages/tracker-core/src/statistics/event/handler.rs +++ b/packages/tracker-core/src/statistics/event/handler.rs @@ -132,7 +132,6 @@ async fn increase_global_downloads( #[cfg(test)] mod tests { - use std::panic::Location; use std::sync::Arc; use torrust_clock::DurationSinceUnixEpoch; @@ -253,12 +252,9 @@ mod tests { // Arrange let stats_repository = Arc::new(Repository::new(true, true)); let mut store = MockTorrentMetricsStore::new(); - store.expect_load_torrent_downloads().returning(|_| { - Box::pin(std::future::ready(Err(Error::UpdateFailed { - location: Location::caller(), - driver: Driver::Sqlite3, - }))) - }); + store + .expect_load_torrent_downloads() + .returning(|_| Box::pin(std::future::ready(Err(Error::UpdateFailed { driver: Driver::Sqlite3 })))); store .expect_load_global_downloads() .returning(|| Box::pin(std::future::ready(Ok(None)))); From b14fe4c8d16667e53f6144371ba117d953ee57ee Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Sat, 21 Nov 2026 13:38:49 +0000 Subject: [PATCH 04/14] fix(tracker-core): [#2916] replace LocatedError sources of peer key errors and drop torrust-located-error PeerKeyError and authentication::key::Error keep their source errors as plain sources, so the REST API texts built from them hold no source path. tracker-core no longer depends on torrust-located-error. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 1 - .../open/2916-2912-si-4-tracker-core/ISSUE.md | 5 +++-- packages/tracker-core/Cargo.toml | 1 - .../src/authentication/handler.rs | 21 ++++++------------- .../src/authentication/key/mod.rs | 17 ++++++++++----- .../src/authentication/key/peer_key.rs | 2 +- packages/tracker-core/src/error.rs | 17 ++++----------- 7 files changed, 26 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0cdb9d2731..bb236a3741 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5199,7 +5199,6 @@ dependencies = [ "tokio-util", "torrust-clock", "torrust-info-hash", - "torrust-located-error", "torrust-metrics", "torrust-tracker-configuration", "torrust-tracker-core", diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md b/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md index 7f96e74e39..93d5d6b5aa 100644 --- a/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md +++ b/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md @@ -9,7 +9,7 @@ github-issue: 2916 spec-path: docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md branch: "2916-tracker-core" related-pr: null -last-updated-utc: "2026-11-21 13:37" +last-updated-utc: "2026-11-21 13:38" semantic-links: skill-links: - create-issue @@ -151,7 +151,7 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. | T2 | DONE | Red tests | Unit tests for the 7 variants and the `PeerKeyError`/database sources; protocol tests for UDP, HTTP and REST; red output recorded. | | T3 | DONE | Whitelist and key errors | `location` removed from `WhitelistError` and `authentication::key::Error` and their sites, including `http-core`. | | T4 | DONE | Database errors | `location` removed from the three variants and 12 driver sites; `LocatedError` sources replaced; `tracing` event added where needed. | -| T5 | TODO | `PeerKeyError` sources and dependency | Plain sources; six `Located(..).into()` removed; `torrust-located-error` removed from `tracker-core/Cargo.toml`. | +| T5 | DONE | `PeerKeyError` sources and dependency | Plain sources; six `Located(..).into()` removed; `torrust-located-error` removed from `tracker-core/Cargo.toml`. | | T6 | TODO | Consumers | `udp-core`, `udp-server`, `http-core`, `rest-api-runtime-adapter` compile and their tests are updated. | | T7 | TODO | Green and recheck | Green output, then the T1 requests repeated against the running tracker. | @@ -213,6 +213,7 @@ the model that produced them. - 2026-11-21 13:31 UTC - Claude Code (Claude Opus 5.5) - T1: reproduced on `develop` at `4be22ee66` with a listed and a private tracker (UDP, HTTP and REST replies all hold `packages/...rs:line` paths; a duplicate key over REST holds two, from the driver and from `authentication/handler.rs`). T2: red tests added at the tracker-core seams (whitelist authorization, authentication service, the shared driver tests, the keys handler) and at the protocol servers (UDP contract, HTTP `failure_reasons_hold_no_source_path.rs`, REST `assert_unhandled_rejection`, which now also forbids source paths), and the `ErrorKind::Whitelist` payload tests in `udp-server/src/event.rs` pinned to the full message. Decisions pending for T3 to T5 are recorded when made. - 2026-11-21 13:34 UTC - Claude Code (Claude Opus 5.5) - T2: red run at `test(tracker-core): [#2916] add red tests that tracker-core error texts name no source path`, all new and changed tests fail with a `packages/...rs:line` path (output in `evidence/`). T3: `location` removed from `WhitelistError::TorrentNotWhitelisted` and `authentication::key::Error::{UnableToReadKey, KeyExpired, MissingAuthKey}`; `KeyExpired` and `MissingAuthKey` become unit variants; the build sites in `whitelist/authorization.rs`, `authentication/service.rs`, `authentication/key/mod.rs` and `http-core/src/services/announce.rs` and the tests of `http-core` and `udp-server/src/event.rs` follow. The whitelist and key tests turn green; the database and `PeerKeyError` ones stay red until T4 and T5. - 2026-11-21 13:37 UTC - Claude Code (Claude Opus 5.5) - T4: `location` removed from `databases::error::Error::{InsertFailed, UpdateFailed, DeleteFailed}` and from the 12 driver sites (an insert and a delete in `whitelist_store.rs` and `auth_key_store.rs` of each of the three drivers). The message names the driver but not the table, so each site now emits a `tracing::warn!` with the driver, the table and, for the whitelist, the info-hash (never the key). The four `LocatedError` sources become a plain `Arc` (still `Clone`), and the two `From` conversions lose `#[track_caller]`. Decision on `UpdateFailed`: kept. No production code builds it (`grep -rn UpdateFailed packages` finds only the variant and the test double in `statistics/event/handler.rs`), but it is a public variant of a `#[non_exhaustive]` enum, removing it is not needed to remove the location, and the test double uses it as a representative persistence failure; removal can be its own change if wanted. Pinned-message unit tests added for the three variants and for a converted `sqlx` error. The driver tests are green; the `PeerKeyError` ones stay red until T5. +- 2026-11-21 13:38 UTC - Claude Code (Claude Opus 5.5) - T5: `PeerKeyError::InvalidKey` and `DatabaseError` hold the plain `ParseKeyError` and `databases::error::Error` as sources (`ParseKeyError` now derives `Clone`, `PartialEq` and `Eq`, as `PeerKeyError` is `Clone`); the six `Located(err).into()` calls in `authentication/handler.rs` pass the error itself; `authentication::key::Error::KeyVerificationError` holds a plain `Arc`, with a pinned-message test. `torrust-located-error` is removed from `packages/tracker-core/Cargo.toml`. All `torrust-tracker-core` tests pass. `grep -rn "Location::caller\|track_caller\|Located\|located_error" packages/tracker-core/src packages/http-core/src/services/announce.rs` finds only the `#[track_caller]` of the test helper `assert_names_no_source_path`. ## Acceptance Criteria diff --git a/packages/tracker-core/Cargo.toml b/packages/tracker-core/Cargo.toml index 795df2e140..6557974bcb 100644 --- a/packages/tracker-core/Cargo.toml +++ b/packages/tracker-core/Cargo.toml @@ -39,7 +39,6 @@ tokio-util = "0.7.15" torrust-clock = "3.0.0" torrust-tracker-configuration = { version = "3.0.0", path = "../configuration" } torrust-tracker-events = { version = "0.1.0", path = "../events" } -torrust-located-error = "3.0.0" torrust-metrics = "0.2.0" torrust-tracker-primitives = { version = "3.0.0", path = "../primitives" } torrust-tracker-swarm-coordination-registry = { version = "0.1.0", path = "../swarm-coordination-registry" } diff --git a/packages/tracker-core/src/authentication/handler.rs b/packages/tracker-core/src/authentication/handler.rs index 7eccd1592d..47b3b950e0 100644 --- a/packages/tracker-core/src/authentication/handler.rs +++ b/packages/tracker-core/src/authentication/handler.rs @@ -11,7 +11,6 @@ use std::time::Duration; use torrust_clock::DurationSinceUnixEpoch; use torrust_clock::clock::Time; -use torrust_located_error::Located; use super::key::repository::in_memory::InMemoryKeyRepository; use super::key::repository::persisted::DatabaseKeyRepository; @@ -99,13 +98,11 @@ impl KeysHandler { match key { Ok(key) => match self.add_expiring_peer_key(key, Some(valid_until)).await { Ok(auth_key) => Ok(auth_key), - Err(err) => Err(PeerKeyError::DatabaseError { - source: Located(err).into(), - }), + Err(err) => Err(PeerKeyError::DatabaseError { source: err }), }, Err(err) => Err(PeerKeyError::InvalidKey { key: pre_existing_key, - source: Located(err).into(), + source: err, }), } } else { @@ -116,13 +113,11 @@ impl KeysHandler { match key { Ok(key) => match self.add_permanent_peer_key(key).await { Ok(auth_key) => Ok(auth_key), - Err(err) => Err(PeerKeyError::DatabaseError { - source: Located(err).into(), - }), + Err(err) => Err(PeerKeyError::DatabaseError { source: err }), }, Err(err) => Err(PeerKeyError::InvalidKey { key: pre_existing_key, - source: Located(err).into(), + source: err, }), } } @@ -137,18 +132,14 @@ impl KeysHandler { .await { Ok(auth_key) => Ok(auth_key), - Err(err) => Err(PeerKeyError::DatabaseError { - source: Located(err).into(), - }), + Err(err) => Err(PeerKeyError::DatabaseError { source: err }), } } else { // Permanent key match self.generate_permanent_peer_key().await { Ok(auth_key) => Ok(auth_key), - Err(err) => Err(PeerKeyError::DatabaseError { - source: Located(err).into(), - }), + Err(err) => Err(PeerKeyError::DatabaseError { source: err }), } } } diff --git a/packages/tracker-core/src/authentication/key/mod.rs b/packages/tracker-core/src/authentication/key/mod.rs index b6b9eee9a8..3399bf6519 100644 --- a/packages/tracker-core/src/authentication/key/mod.rs +++ b/packages/tracker-core/src/authentication/key/mod.rs @@ -49,7 +49,6 @@ use std::time::Duration; use thiserror::Error; use torrust_clock::DurationSinceUnixEpoch; use torrust_clock::clock::Time; -use torrust_located_error::{DynError, LocatedError}; use crate::CurrentClock; @@ -170,7 +169,7 @@ pub enum Error { /// Wraps an underlying error encountered during key verification. #[error("Key could not be verified: {source}")] KeyVerificationError { - source: LocatedError<'static, dyn std::error::Error + Send + Sync>, + source: Arc, }, /// Indicates that the key could not be read or found. @@ -188,9 +187,7 @@ pub enum Error { impl From for Error { fn from(e: sqlx::Error) -> Self { - Self::KeyVerificationError { - source: (Arc::new(e) as DynError).into(), - } + Self::KeyVerificationError { source: Arc::new(e) } } } @@ -297,5 +294,15 @@ mod tests { assert!(matches!(err, key::Error::KeyVerificationError { .. })); } + + #[test] + fn should_render_the_database_error_text_and_no_source_path() { + let err: key::Error = sqlx::Error::RowNotFound.into(); + + assert_eq!( + err.to_string(), + "Key could not be verified: no rows returned by a query that expected to return at least one row" + ); + } } } diff --git a/packages/tracker-core/src/authentication/key/peer_key.rs b/packages/tracker-core/src/authentication/key/peer_key.rs index 30e674b9e6..973234ad0a 100644 --- a/packages/tracker-core/src/authentication/key/peer_key.rs +++ b/packages/tracker-core/src/authentication/key/peer_key.rs @@ -188,7 +188,7 @@ impl Key { /// /// If the string does not contains a valid key, the parser function will return /// this error. -#[derive(Debug, Error)] +#[derive(Debug, Error, Clone, PartialEq, Eq)] #[non_exhaustive] pub enum ParseKeyError { /// The provided key does not have exactly 32 characters. diff --git a/packages/tracker-core/src/error.rs b/packages/tracker-core/src/error.rs index 40cae72cc0..1fb0d028a2 100644 --- a/packages/tracker-core/src/error.rs +++ b/packages/tracker-core/src/error.rs @@ -9,7 +9,6 @@ //! `docs/adrs/20261118045443_errors_do_not_record_source_locations.md`). use torrust_info_hash::InfoHash; -use torrust_located_error::LocatedError; use super::authentication::key::ParseKeyError; use super::databases; @@ -123,16 +122,11 @@ pub enum PeerKeyError { /// Returned when the provided peer key is invalid. #[error("Invalid key: {key}")] - InvalidKey { - key: String, - source: LocatedError<'static, ParseKeyError>, - }, + InvalidKey { key: String, source: ParseKeyError }, /// Returned when persisting the peer key to the database fails. #[error("Can't persist key: {source}")] - DatabaseError { - source: LocatedError<'static, databases::error::Error>, - }, + DatabaseError { source: databases::error::Error }, } #[cfg(test)] @@ -156,7 +150,6 @@ mod tests { } mod peer_key_error { - use torrust_located_error::Located; use torrust_tracker_primitives::Driver; use crate::error::PeerKeyError; @@ -182,7 +175,7 @@ mod tests { let err = PeerKeyError::InvalidKey { key: "INVALID KEY".to_string(), - source: Located(err).into(), + source: err, }; let err_msg = format!("{err}"); @@ -197,9 +190,7 @@ mod tests { fn persisting_into_database() { let err = databases::error::Error::InsertFailed { driver: Driver::Sqlite3 }; - let err = PeerKeyError::DatabaseError { - source: Located(err).into(), - }; + let err = PeerKeyError::DatabaseError { source: err }; let err_msg = format!("{err}"); From 5e5b1ac1a1fab2959ac505a41a30bacc5981440d Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Sat, 21 Nov 2026 13:41:45 +0000 Subject: [PATCH 05/14] docs(axum-http-server): [#2916] show the tracker-core authentication failure reasons without source paths Co-Authored-By: Claude Opus 5.5 --- docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md | 5 +++-- .../src/v1/extractors/authentication_key.rs | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md b/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md index 93d5d6b5aa..547ba4efa4 100644 --- a/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md +++ b/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md @@ -9,7 +9,7 @@ github-issue: 2916 spec-path: docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md branch: "2916-tracker-core" related-pr: null -last-updated-utc: "2026-11-21 13:38" +last-updated-utc: "2026-11-21 13:41" semantic-links: skill-links: - create-issue @@ -152,7 +152,7 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. | T3 | DONE | Whitelist and key errors | `location` removed from `WhitelistError` and `authentication::key::Error` and their sites, including `http-core`. | | T4 | DONE | Database errors | `location` removed from the three variants and 12 driver sites; `LocatedError` sources replaced; `tracing` event added where needed. | | T5 | DONE | `PeerKeyError` sources and dependency | Plain sources; six `Located(..).into()` removed; `torrust-located-error` removed from `tracker-core/Cargo.toml`. | -| T6 | TODO | Consumers | `udp-core`, `udp-server`, `http-core`, `rest-api-runtime-adapter` compile and their tests are updated. | +| T6 | DONE | Consumers | `udp-core`, `udp-server`, `http-core`, `rest-api-runtime-adapter` compile and their tests are updated. | | T7 | TODO | Green and recheck | Green output, then the T1 requests repeated against the running tracker. | ## Commit Points @@ -214,6 +214,7 @@ the model that produced them. - 2026-11-21 13:34 UTC - Claude Code (Claude Opus 5.5) - T2: red run at `test(tracker-core): [#2916] add red tests that tracker-core error texts name no source path`, all new and changed tests fail with a `packages/...rs:line` path (output in `evidence/`). T3: `location` removed from `WhitelistError::TorrentNotWhitelisted` and `authentication::key::Error::{UnableToReadKey, KeyExpired, MissingAuthKey}`; `KeyExpired` and `MissingAuthKey` become unit variants; the build sites in `whitelist/authorization.rs`, `authentication/service.rs`, `authentication/key/mod.rs` and `http-core/src/services/announce.rs` and the tests of `http-core` and `udp-server/src/event.rs` follow. The whitelist and key tests turn green; the database and `PeerKeyError` ones stay red until T4 and T5. - 2026-11-21 13:37 UTC - Claude Code (Claude Opus 5.5) - T4: `location` removed from `databases::error::Error::{InsertFailed, UpdateFailed, DeleteFailed}` and from the 12 driver sites (an insert and a delete in `whitelist_store.rs` and `auth_key_store.rs` of each of the three drivers). The message names the driver but not the table, so each site now emits a `tracing::warn!` with the driver, the table and, for the whitelist, the info-hash (never the key). The four `LocatedError` sources become a plain `Arc` (still `Clone`), and the two `From` conversions lose `#[track_caller]`. Decision on `UpdateFailed`: kept. No production code builds it (`grep -rn UpdateFailed packages` finds only the variant and the test double in `statistics/event/handler.rs`), but it is a public variant of a `#[non_exhaustive]` enum, removing it is not needed to remove the location, and the test double uses it as a representative persistence failure; removal can be its own change if wanted. Pinned-message unit tests added for the three variants and for a converted `sqlx` error. The driver tests are green; the `PeerKeyError` ones stay red until T5. - 2026-11-21 13:38 UTC - Claude Code (Claude Opus 5.5) - T5: `PeerKeyError::InvalidKey` and `DatabaseError` hold the plain `ParseKeyError` and `databases::error::Error` as sources (`ParseKeyError` now derives `Clone`, `PartialEq` and `Eq`, as `PeerKeyError` is `Clone`); the six `Located(err).into()` calls in `authentication/handler.rs` pass the error itself; `authentication::key::Error::KeyVerificationError` holds a plain `Arc`, with a pinned-message test. `torrust-located-error` is removed from `packages/tracker-core/Cargo.toml`. All `torrust-tracker-core` tests pass. `grep -rn "Location::caller\|track_caller\|Located\|located_error" packages/tracker-core/src packages/http-core/src/services/announce.rs` finds only the `#[track_caller]` of the test helper `assert_names_no_source_path`. +- 2026-11-21 13:41 UTC - Claude Code (Claude Opus 5.5) - T6: the consumers needed no change beyond the T3 test updates: `cargo clippy --workspace --all-targets --all-features -- -D warnings` (stable Rust toolchain) passes, and the tests of `udp-core`, `udp-server`, `http-core`, `rest-api-runtime-adapter`, `axum-http-server` and `axum-rest-api-server` pass. The module docs of `axum-http-server/src/v1/extractors/authentication_key.rs` showed tracker-core failure reasons with old source paths; they now show the replies recorded in T7. `docs/media/packages/dependencies-workspace-packages.md` still draws `tracker-core --> located-err` (and `http-proto --> located-err` from SI-3): left for SI-6, which redraws that diagram when the crate is dropped. ## Acceptance Criteria diff --git a/packages/axum-http-server/src/v1/extractors/authentication_key.rs b/packages/axum-http-server/src/v1/extractors/authentication_key.rs index f7ed8c80e4..3547811afa 100644 --- a/packages/axum-http-server/src/v1/extractors/authentication_key.rs +++ b/packages/axum-http-server/src/v1/extractors/authentication_key.rs @@ -17,7 +17,7 @@ //! When the key param is **missing**: //! //! ```text -//! d14:failure reason131:Authentication error: Missing authentication key param for private tracker. Error in src/servers/http/v1/handlers/announce.rs:79:31e +//! d14:failure reason56:Tracker authentication error: Missing authentication keye //! ``` //! //! When the key param has an **invalid format**: @@ -29,20 +29,20 @@ //! When the key is **not found** in the database: //! //! ```text -//! d14:failure reason101:Authentication error: Failed to read key: YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ, src/tracker/mod.rs:848:27e +//! d14:failure reason82:Tracker authentication error: Failed to read key: YZSl4lMZupRuOpSRC3krIKR5BPB14nrJe //! ``` //! //! When the key is found in the database but it's **expired**: //! //! ```text -//! d14:failure reason64:Authentication error: Key has expired, src/tracker/auth.rs:88:23e +//! d14:failure reason45:Tracker authentication error: Key has expirede //! ``` //! //! > **NOTICE**: the returned HTTP status code is always `200` for authentication errors. //! > Neither [The `BitTorrent` Protocol Specification](https://www.bittorrent.org/beps/bep_0003.html) //! > nor [The Private Torrents](https://www.bittorrent.org/beps/bep_0027.html) //! > specifications specify any HTTP status code for authentication errors. -// cspell:ignore characterse +// cspell:ignore characterse keye expirede use std::future::Future; use axum::extract::rejection::PathRejection; From 6644887aa340140dcba8ee78ef41a16dcffa4770 Mon Sep 17 00:00:00 2001 From: josecelano-bot Date: Sat, 21 Nov 2026 13:44:44 +0000 Subject: [PATCH 06/14] docs(issues): [#2916] record the reproduction, red and green runs and the manual verification Co-Authored-By: Claude Opus 5.5 --- cspell.json | 1 + .../open/2916-2912-si-4-tracker-core/ISSUE.md | 60 +-- .../evidence/responses-after.txt | 37 ++ .../evidence/responses-before.txt | 37 ++ .../evidence/tests-green.txt | 428 ++++++++++++++++++ .../evidence/tests-red-axum-http-server.txt | 56 +++ .../tests-red-axum-rest-api-server.txt | 218 +++++++++ .../evidence/tests-red-tracker-core.txt | 216 +++++++++ .../tests-red-udp-server-integration.txt | 62 +++ .../evidence/tests-red-udp-server-lib.txt | 340 ++++++++++++++ .../manual-verification-evidence.md | 362 +++++++++++++++ 11 files changed, 1791 insertions(+), 26 deletions(-) create mode 100644 docs/issues/open/2916-2912-si-4-tracker-core/evidence/responses-after.txt create mode 100644 docs/issues/open/2916-2912-si-4-tracker-core/evidence/responses-before.txt create mode 100644 docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-green.txt create mode 100644 docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-axum-http-server.txt create mode 100644 docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-axum-rest-api-server.txt create mode 100644 docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-tracker-core.txt create mode 100644 docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-udp-server-integration.txt create mode 100644 docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-udp-server-lib.txt create mode 100644 docs/issues/open/2916-2912-si-4-tracker-core/manual-verification-evidence.md diff --git a/cspell.json b/cspell.json index 2f114e0840..aa1b28ec93 100644 --- a/cspell.json +++ b/cspell.json @@ -25,6 +25,7 @@ "packages/tracker-core/docs/benchmarking/machine/*.txt", "docs/issues/*/2850-non-negative-number-of-bytes/evidence/*.txt", "docs/issues/*/2915-2912-si-3-http-tracker-request-errors/evidence/*.txt", + "docs/issues/*/2916-2912-si-4-tracker-core/evidence/*.txt", ".github/labels.json", "/project-words.txt", "repomix-output.xml", diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md b/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md index 547ba4efa4..d9a805066f 100644 --- a/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md +++ b/docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md @@ -9,7 +9,7 @@ github-issue: 2916 spec-path: docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md branch: "2916-tracker-core" related-pr: null -last-updated-utc: "2026-11-21 13:41" +last-updated-utc: "2026-11-21 13:44" semantic-links: skill-links: - create-issue @@ -153,7 +153,7 @@ Status values: `TODO`, `IN_PROGRESS`, `BLOCKED`, `DONE`. | T4 | DONE | Database errors | `location` removed from the three variants and 12 driver sites; `LocatedError` sources replaced; `tracing` event added where needed. | | T5 | DONE | `PeerKeyError` sources and dependency | Plain sources; six `Located(..).into()` removed; `torrust-located-error` removed from `tracker-core/Cargo.toml`. | | T6 | DONE | Consumers | `udp-core`, `udp-server`, `http-core`, `rest-api-runtime-adapter` compile and their tests are updated. | -| T7 | TODO | Green and recheck | Green output, then the T1 requests repeated against the running tracker. | +| T7 | DONE | Green and recheck | Green output, then the T1 requests repeated against the running tracker. | ## Commit Points @@ -192,11 +192,11 @@ with the narrow affected scope, and sign every commit with GPG. - [x] Spec reviewed and approved by user/maintainer - [x] GitHub issue created and issue number added to this spec - [ ] (Optional, recommended for complex issues) Spec-only PR merged into `develop` before implementation -- [ ] Implementation completed +- [x] Implementation completed - [ ] Automatic verification completed (`linter all`, relevant tests, and any pre-push checks) -- [ ] Manual verification scenarios executed and recorded in issue-local `manual-verification-evidence.md` -- [ ] Acceptance criteria reviewed after implementation and updated with evidence -- [ ] Evidence-based implementation completion review recorded: issue-local retrospective created for material discoveries, or progress log states why none was needed +- [x] Manual verification scenarios executed and recorded in issue-local `manual-verification-evidence.md` +- [x] Acceptance criteria reviewed after implementation and updated with evidence +- [x] Evidence-based implementation completion review recorded: issue-local retrospective created for material discoveries, or progress log states why none was needed - [ ] Reviewer validated acceptance criteria and updated checkboxes - [ ] Independent reviewer reports recorded in issue-local `agent-review-reports.md` when reviewers received this folder-style specification - [ ] Committer verified spec progress is up to date before commit @@ -215,19 +215,20 @@ the model that produced them. - 2026-11-21 13:37 UTC - Claude Code (Claude Opus 5.5) - T4: `location` removed from `databases::error::Error::{InsertFailed, UpdateFailed, DeleteFailed}` and from the 12 driver sites (an insert and a delete in `whitelist_store.rs` and `auth_key_store.rs` of each of the three drivers). The message names the driver but not the table, so each site now emits a `tracing::warn!` with the driver, the table and, for the whitelist, the info-hash (never the key). The four `LocatedError` sources become a plain `Arc` (still `Clone`), and the two `From` conversions lose `#[track_caller]`. Decision on `UpdateFailed`: kept. No production code builds it (`grep -rn UpdateFailed packages` finds only the variant and the test double in `statistics/event/handler.rs`), but it is a public variant of a `#[non_exhaustive]` enum, removing it is not needed to remove the location, and the test double uses it as a representative persistence failure; removal can be its own change if wanted. Pinned-message unit tests added for the three variants and for a converted `sqlx` error. The driver tests are green; the `PeerKeyError` ones stay red until T5. - 2026-11-21 13:38 UTC - Claude Code (Claude Opus 5.5) - T5: `PeerKeyError::InvalidKey` and `DatabaseError` hold the plain `ParseKeyError` and `databases::error::Error` as sources (`ParseKeyError` now derives `Clone`, `PartialEq` and `Eq`, as `PeerKeyError` is `Clone`); the six `Located(err).into()` calls in `authentication/handler.rs` pass the error itself; `authentication::key::Error::KeyVerificationError` holds a plain `Arc`, with a pinned-message test. `torrust-located-error` is removed from `packages/tracker-core/Cargo.toml`. All `torrust-tracker-core` tests pass. `grep -rn "Location::caller\|track_caller\|Located\|located_error" packages/tracker-core/src packages/http-core/src/services/announce.rs` finds only the `#[track_caller]` of the test helper `assert_names_no_source_path`. - 2026-11-21 13:41 UTC - Claude Code (Claude Opus 5.5) - T6: the consumers needed no change beyond the T3 test updates: `cargo clippy --workspace --all-targets --all-features -- -D warnings` (stable Rust toolchain) passes, and the tests of `udp-core`, `udp-server`, `http-core`, `rest-api-runtime-adapter`, `axum-http-server` and `axum-rest-api-server` pass. The module docs of `axum-http-server/src/v1/extractors/authentication_key.rs` showed tracker-core failure reasons with old source paths; they now show the replies recorded in T7. `docs/media/packages/dependencies-workspace-packages.md` still draws `tracker-core --> located-err` (and `http-proto --> located-err` from SI-3): left for SI-6, which redraws that diagram when the crate is dropped. +- 2026-11-21 13:44 UTC - Claude Code (Claude Opus 5.5) - T7: green run at the T6 commit and the T1 requests repeated against a tracker built from the T5 commit; every reply keeps its text and loses the path, and the driver `tracing` event shows in the tracker log (`manual-verification-evidence.md`, V1 to V3; `evidence/`). M1 to M3 DONE, AC1 to AC5 DONE. Completion review: no retrospective needed. The plan held; the only additions were in scope (the `KeyVerificationError` and `databases::error::Error` `LocatedError` sources, which the spec's "Replace the `LocatedError` sources" item covers), and the one surprise is recorded in V3: duplicate whitelist writes never reach the database, so the REST database case is proven with keys. Open question to the EPIC coordinator: `UnableToReadKey` still prints the peer key ("Failed to read key: {key}"), which ADR rule 3 forbids for changed messages; kept unchanged here, outside the spec's scope. ## Acceptance Criteria -- [ ] AC1: No error type in `packages/tracker-core` has a `location` field or a `LocatedError` source. -- [ ] AC2: `packages/tracker-core/src` and `http-core/src/services/announce.rs` have no `Location::caller()`, `#[track_caller]` or `Located(..).into()` outside test code. -- [ ] AC3: A UDP reply to a non-whitelisted announce, an HTTP failure reason for whitelist and key errors, and a REST API error for a failed key or whitelist write hold no source path, each proven by a test through the protocol server. -- [ ] AC4: The `ErrorKind::Whitelist` event payload holds no source path. -- [ ] AC5: `packages/tracker-core/Cargo.toml` no longer depends on `torrust-located-error`. -- [ ] `linter all` exits with code `0` -- [ ] Relevant tests pass -- [ ] Manual verification scenarios are executed and documented in issue-local `manual-verification-evidence.md` -- [ ] Acceptance criteria are re-reviewed after implementation and reflect actual behavior -- [ ] Documentation is updated when behavior/workflow changes +- [x] AC1: No error type in `packages/tracker-core` has a `location` field or a `LocatedError` source. +- [x] AC2: `packages/tracker-core/src` and `http-core/src/services/announce.rs` have no `Location::caller()`, `#[track_caller]` or `Located(..).into()` outside test code. +- [x] AC3: A UDP reply to a non-whitelisted announce, an HTTP failure reason for whitelist and key errors, and a REST API error for a failed key or whitelist write hold no source path, each proven by a test through the protocol server. +- [x] AC4: The `ErrorKind::Whitelist` event payload holds no source path. +- [x] AC5: `packages/tracker-core/Cargo.toml` no longer depends on `torrust-located-error`. +- [x] `linter all` exits with code `0` +- [x] Relevant tests pass +- [x] Manual verification scenarios are executed and documented in issue-local `manual-verification-evidence.md` +- [x] Acceptance criteria are re-reviewed after implementation and reflect actual behavior +- [x] Documentation is updated when behavior/workflow changes ## Verification Plan @@ -245,9 +246,9 @@ Status values: `TODO`, `IN_PROGRESS`, `DONE`, `FAILED`, `BLOCKED`. | ID | Scenario | Human-oriented command/steps | Expected Result | Status | Evidence | | --- | --- | --- | --- | --- | --- | -| M1 | UDP whitelist rejection | Start a listed tracker; send a UDP announce for an info-hash that is not whitelisted (tracker client or a script) | The error message says the torrent is not whitelisted and holds no path | TODO | `manual-verification-evidence.md` section V1 | -| M2 | HTTP key and whitelist errors | Announce over HTTP for the same info-hash, and on a private tracker with an expired key | The failure reasons hold no path | TODO | `manual-verification-evidence.md` section V2 | -| M3 | REST database failure | Add the same whitelist entry or key twice through the REST API | The error text names the failed operation and holds no path, including no driver file | TODO | `manual-verification-evidence.md` section V3 | +| M1 | UDP whitelist rejection | Start a listed tracker; send a UDP announce for an info-hash that is not whitelisted (tracker client or a script) | The error message says the torrent is not whitelisted and holds no path | DONE | `manual-verification-evidence.md` section V1 | +| M2 | HTTP key and whitelist errors | Announce over HTTP for the same info-hash, and on a private tracker with an expired key | The failure reasons hold no path | DONE | `manual-verification-evidence.md` section V2 | +| M3 | REST database failure | Add the same whitelist entry or key twice through the REST API | The error text names the failed operation and holds no path, including no driver file | DONE | `manual-verification-evidence.md` section V3 | Notes: @@ -281,17 +282,24 @@ Keep the script in the issue-specification folder so later reviewers can inspect the verification performed. Promote durable product-behavior checks into Rust automatic tests when practical, then remove the disposable script. -None planned for this issue. +One disposable client was used, embedded verbatim in `manual-verification-evidence.md` (not kept as +a file): `udp_announce.py`, a 20-line BEP 15 connect-and-announce client for scenario M1, run with +`run.sh` from the agent scratchpad. Why temporary automation: the workspace ships no UDP tracker +client binary (`torrust-tracker-client` is a library), and the manual scenario needs a real client +against the release binary. Why Python rather than Rust: a one-off socket script needs no crate and +no build; the durable check is the Rust UDP contract test +`should_reject_a_torrent_that_is_not_whitelisted_with_a_message_that_holds_no_source_path`. Owner: +none; nothing is retained beyond the evidence document. ### Acceptance Verification | AC ID | Status (`TODO`/`DONE`) | Evidence | | --- | --- | --- | -| AC1 | TODO | {test/log/PR link} | -| AC2 | TODO | {test/log/PR link} | -| AC3 | TODO | {test/log/PR link} | -| AC4 | TODO | {test/log/PR link} | -| AC5 | TODO | {test/log/PR link} | +| AC1 | DONE | `grep -rn "location\|LocatedError" packages/tracker-core/src` finds only the two module docs that cite the ADR; T3 to T5 in the progress log | +| AC2 | DONE | The T5 `grep` finds only the `#[track_caller]` of the test helper `assert_names_no_source_path` | +| AC3 | DONE | UDP contract test, the three `axum-http-server` `failure_reasons_hold_no_source_path` tests, the REST `auth_key` and `whitelist` failure tests; red and green runs in `evidence/`; V1 to V3 | +| AC4 | DONE | The four `udp-server` `event::tests::it_should_classify_*whitelist_error` tests pin the full payload | +| AC5 | DONE | `grep -n located packages/tracker-core/Cargo.toml` finds nothing | ## Risks and Trade-offs @@ -308,7 +316,7 @@ After implementation, compare the result with this specification. Record invalidated assumptions, material design changes, unexpected validation findings, and reusable lessons. -- Retrospective: `Not yet assessed` +- Retrospective: not needed; see the progress-log entry of T7 - If needed, create `implementation-retrospective.md` from the repository template at `docs/templates/IMPLEMENTATION-RETROSPECTIVE.md` in this issue specification's directory. diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/evidence/responses-after.txt b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/responses-after.txt new file mode 100644 index 0000000000..ed10392444 --- /dev/null +++ b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/responses-after.txt @@ -0,0 +1,37 @@ +date -u: 2026-11-21 13:41:15 +U1 UDP announce, info-hash not whitelisted (listed tracker) + udp_announce.py 17069 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0 + action=3 message='tracker announce error: Tracker core whitelist error: The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted' +H1 HTTP announce, info-hash not whitelisted (listed tracker) + GET :17070/announce?info_hash=%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0&peer_id=-qB00000000000000001&port=17548 + d14:failure reason98:Tracker whitelist error: The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelistede +W1 REST whitelist the info-hash + POST :17212/api/v1/whitelist/3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0?token= + {"status":"ok"} +W2 REST whitelist the same info-hash again + POST :17212/api/v1/whitelist/3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0?token= + {"status":"ok"} +W3 REST remove an info-hash that is not whitelisted + DELETE :17212/api/v1/whitelist/9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d?token= + {"status":"ok"} +H2 HTTP announce without key (private tracker) + GET :17080/announce?info_hash=%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0&peer_id=-qB00000000000000001&port=17548 + d14:failure reason56:Tracker authentication error: Missing authentication keye +H3 HTTP announce with an unregistered key (private tracker) + GET :17080/announce/YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ?info_hash=%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0&peer_id=-qB00000000000000001&port=17548 + d14:failure reason82:Tracker authentication error: Failed to read key: YZSl4lMZupRuOpSRC3krIKR5BPB14nrJe +K1 REST add a key valid for 60 s + POST :17213/api/v1/keys?token= + {"key":"YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ","valid_until":1795268536,"expiry_time":"2026-11-21 13:42:16 UTC"} +K2 REST add the same key again + POST :17213/api/v1/keys?token= + Unhandled rejection: Err { reason: "failed to add key: The Sqlite3 query was malformed: error returned from database: (code: 2067) UNIQUE constraint failed: keys.key" } +K3 REST remove a key that does not exist + DELETE :17213/api/v1/key/ZZZZ4lMZupRuOpSRC3krIKR5BPB14nrJ?token= + Unhandled rejection: Err { reason: "failed to delete key: Failed to remove record from Sqlite3 database, error-code: 0" } +K4 REST generate a key valid for 1 s + POST /api/v1/key/1?token= + {"key":"Y1eJWFGXyLqpLd0EmrnV3RQGQo9YfzI6","valid_until":1795268477,"expiry_time":"2026-11-21 13:41:17 UTC"} +H4 HTTP announce with the expired key (private tracker) + GET :17080/announce/Y1eJWFGXyLqpLd0EmrnV3RQGQo9YfzI6?info_hash=%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0&peer_id=-qB00000000000000001&port=17548 + d14:failure reason45:Tracker authentication error: Key has expirede diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/evidence/responses-before.txt b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/responses-before.txt new file mode 100644 index 0000000000..bd889ce57c --- /dev/null +++ b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/responses-before.txt @@ -0,0 +1,37 @@ +date -u: 2026-11-21 13:26:47 +U1 UDP announce, info-hash not whitelisted (listed tracker) + udp_announce.py 17069 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0 + action=3 message='tracker announce error: Tracker core whitelist error: The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted, packages/tracker-core/src/whitelist/authorization.rs:61:23' +H1 HTTP announce, info-hash not whitelisted (listed tracker) + GET :17070/announce?info_hash=%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0&peer_id=-qB00000000000000001&port=17548 + d14:failure reason158:Tracker whitelist error: The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted, packages/tracker-core/src/whitelist/authorization.rs:61:23e +W1 REST whitelist the info-hash + POST :17212/api/v1/whitelist/3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0?token= + {"status":"ok"} +W2 REST whitelist the same info-hash again + POST :17212/api/v1/whitelist/3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0?token= + {"status":"ok"} +W3 REST remove an info-hash that is not whitelisted + DELETE :17212/api/v1/whitelist/9e0217d0fa71c87332cd8bf9dbeabcb2c2cf3c4d?token= + {"status":"ok"} +H2 HTTP announce without key (private tracker) + GET :17080/announce?info_hash=%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0&peer_id=-qB00000000000000001&port=17548 + d14:failure reason108:Tracker authentication error: Missing authentication key, packages/http-core/src/services/announce.rs:308:27e +H3 HTTP announce with an unregistered key (private tracker) + GET :17080/announce/YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ?info_hash=%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0&peer_id=-qB00000000000000001&port=17548 + d14:failure reason141:Tracker authentication error: Failed to read key: YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ, packages/tracker-core/src/authentication/service.rs:98:27e +K1 REST add a key valid for 60 s + POST :17213/api/v1/keys?token= + {"key":"YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ","valid_until":1795267667,"expiry_time":"2026-11-21 13:27:47 UTC"} +K2 REST add the same key again + POST :17213/api/v1/keys?token= + Unhandled rejection: Err { reason: "failed to add key: The Sqlite3 query was malformed: error returned from database: (code: 2067) UNIQUE constraint failed: keys.key, packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs:74:22, packages/tracker-core/src/authentication/handler.rs:103:50" } +K3 REST remove a key that does not exist + DELETE :17213/api/v1/key/ZZZZ4lMZupRuOpSRC3krIKR5BPB14nrJ?token= + Unhandled rejection: Err { reason: "failed to delete key: Failed to remove record from Sqlite3 database, error-code: 0, packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs:108:27" } +K4 REST generate a key valid for 1 s + POST /api/v1/key/1?token= + {"key":"m7FAV1hgRWlU0iLnmOku4ryjW6pg1vtk","valid_until":1795267608,"expiry_time":"2026-11-21 13:26:48 UTC"} +H4 HTTP announce with the expired key (private tracker) + GET :17080/announce/m7FAV1hgRWlU0iLnmOku4ryjW6pg1vtk?info_hash=%3B%24U%04%CF%5F%11%BB%DB%E1%20%1C%EAjk%F4Z%EE%1B%C0&peer_id=-qB00000000000000001&port=17548 + d14:failure reason105:Tracker authentication error: Key has expired, packages/tracker-core/src/authentication/key/mod.rs:158:31e diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-green.txt b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-green.txt new file mode 100644 index 0000000000..6d1cf8eeac --- /dev/null +++ b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-green.txt @@ -0,0 +1,428 @@ + Finished `test` profile [optimized + debuginfo] target(s) in 0.13s + Running unittests src/lib.rs (target/debug/build/torrust-tracker-core/0b706dc5248b0fe7/out/torrust_tracker_core-0b706dc5248b0fe7) + +running 165 tests +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_client_ip_is_a_ipv6_loopback_ip::it_should_use_the_external_ip_in_the_tracker_configuration_if_it_is_defined_even_if_the_external_ip_is_an_ipv4_ip ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_client_ip_is_a_ipv6_loopback_ip::it_should_use_the_external_ip_in_tracker_configuration_if_it_is_defined ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_client_ip_is_a_ipv4_loopback_ip::it_should_use_the_loopback_ip_if_the_tracker_does_not_have_the_external_ip_configuration ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_client_ip_is_a_ipv6_loopback_ip::it_should_use_the_loopback_ip_if_the_tracker_does_not_have_the_external_ip_configuration ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_client_ip_is_a_ipv4_loopback_ip::it_should_use_the_external_ip_in_the_tracker_configuration_if_it_is_defined_even_if_the_external_ip_is_an_ipv6_ip ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_external_ip_is_unspecified::it_should_keep_the_ipv6_loopback_ip_when_the_external_ip_is_the_unspecified_ipv4_address ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_external_ip_is_unspecified::it_should_keep_the_ipv6_loopback_ip_when_the_external_ip_is_the_unspecified_ipv6_address ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_external_ip_is_unspecified::it_should_keep_the_ipv4_loopback_ip_when_the_external_ip_is_the_unspecified_ipv6_address ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_external_ip_is_unspecified::it_should_keep_the_non_loopback_ip_when_the_external_ip_is_unspecified_ipv6 ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_client_ip_is_a_ipv4_loopback_ip::it_should_use_the_external_tracker_ip_in_tracker_configuration_if_it_is_defined ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::using_the_source_ip_instead_of_the_ip_in_the_announce_request ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_external_ip_is_unspecified::it_should_keep_the_ipv4_loopback_ip_when_the_external_ip_is_the_unspecified_ipv4_address ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_allow_limiting_the_peer_list ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_cap_only_peers_wanted_at_limit_time ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_external_ip_is_unspecified::it_should_keep_the_non_loopback_ip_when_the_external_ip_is_unspecified_ipv4 ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_convert_the_peers_wanted_number_from_i32_via_from_client_request ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_return_74_at_the_most_if_the_client_wants_them_all ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_return_the_maximin_number_of_peers_by_default ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_return_the_maximum_when_wanting_more_than_the_maximum ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_return_zero_when_wanting_only_zero ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::pre_generated::it_should_fail_adding_a_pre_generated_key_when_there_is_a_database_error ... ok +test authentication::key::peer_key::tests::key::should_be_generated_randomly ... ok +test authentication::key::peer_key::tests::key::should_be_parsed_from_an_string ... ok +test authentication::key::peer_key::tests::key::should_only_include_alphanumeric_chars ... ok +test authentication::key::peer_key::tests::peer_key::could_be_permanent ... ok +test authentication::key::peer_key::tests::key::length_should_be_32 ... ok +test authentication::key::peer_key::tests::key::should_return_a_reference_to_the_inner_string ... ok +test authentication::key::peer_key::tests::peer_key::could_have_an_expiration_time ... ok +test authentication::key::tests::the_expiring_peer_key::should_be_displayed ... ok +test authentication::key::peer_key::tests::peer_key::expiring::should_be_displayed_when_it_is_expiring ... ok +test authentication::key::peer_key::tests::peer_key::permanent::should_be_displayed_when_it_is_permanent ... ok +test authentication::key::tests::the_expiring_peer_key::should_be_generated_with_a_expiration_time ... ok +test authentication::key::tests::the_expiring_peer_key::expiration_verification_should_fail_when_the_key_has_expired ... ok +test authentication::key::tests::the_key_verification_error::could_be_a_database_error ... ok +test authentication::key::tests::the_key_verification_error::should_render_the_database_error_text_and_no_source_path ... ok +test authentication::key::tests::the_permanent_peer_key::expiration_verification_should_always_succeed ... ok +test authentication::key::tests::the_permanent_peer_key::should_be_displayed ... ok +test authentication::key::tests::the_permanent_peer_key::should_be_generated_without_expiration_time ... ok +test authentication::key::repository::in_memory::tests::the_in_memory_key_repository_should::reset_the_peer_keys_with_a_new_list_of_keys ... ok +test authentication::key::repository::in_memory::tests::the_in_memory_key_repository_should::insert_a_new_peer_key ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_not_authenticate_an_unregistered_key ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_reject_an_expired_key_with_a_message_that_holds_no_source_path ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_reject_an_unregistered_key_with_a_message_that_holds_no_source_path ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_public::it_should_always_authenticate_when_the_tracker_is_public ... ok +test authentication::key::repository::in_memory::tests::the_in_memory_key_repository_should::remove_a_new_peer_key ... ok +test authentication::key::repository::in_memory::tests::the_in_memory_key_repository_should::clear_all_peer_keys ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::but_the_key_expiration_check_is_disabled_by_configuration::it_should_authenticate_an_expired_registered_key ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_not_authenticate_a_registered_but_expired_key_by_default ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_authenticate_a_registered_key ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_not_authenticate_a_registered_but_expired_key_when_the_tracker_is_explicitly_configured_to_check_keys_expiration ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_permanent_peer_keys::pre_generated_keys::it_should_fail_adding_a_pre_generated_key_when_there_is_a_database_error ... ok +test authentication::key::repository::in_memory::tests::the_in_memory_key_repository_should::get_a_new_peer_key_by_its_internal_key ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::randomly_generated::it_should_fail_adding_a_randomly_generated_key_when_there_is_a_database_error ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_permanent_peer_keys::randomly_generated::it_should_fail_adding_a_randomly_generated_key_when_there_is_a_database_error ... ok +test container::tests::it_should_return_a_typed_error_when_persistent_statistics_lack_persistence ... ok +test container::tests::it_should_construct_a_tracker_core_container_without_persistence ... ok +test databases::driver::sqlite::schema_migrator::tests::bootstrap_legacy_schema_should_be_a_noop_on_a_fresh_database ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::it_should_update_the_swarm_stats_for_the_torrent::when_the_peer_is_a_leecher ... ok +test databases::driver::sqlite::schema_migrator::tests::bootstrap_legacy_schema_should_reject_partial_legacy_state ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::it_should_return_the_announce_data_with_an_empty_peer_list_when_it_is_the_first_announced_peer ... ok +test databases::error::tests::it_should_build_a_database_error_from_a_sqlx_io_error ... ok +test databases::error::tests::it_should_build_a_database_error_from_a_sqlx_row_not_found_error ... ok +test databases::error::tests::it_should_render_a_failed_delete_naming_the_driver_and_the_rows_removed ... ok +test databases::error::tests::it_should_render_a_failed_insert_naming_the_driver ... ok +test databases::error::tests::it_should_render_a_failed_update_naming_the_driver ... ok +test databases::error::tests::it_should_render_a_sqlx_error_with_its_own_text_and_no_source_path ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::it_should_return_the_announce_data_with_the_previously_announced_peers ... ok +test error::tests::peer_key_error::duration_overflow ... ok +test error::tests::peer_key_error::parsing_from_string ... ok +test error::tests::peer_key_error::persisting_into_database ... ok +test error::tests::whitelist_error::torrent_not_whitelisted ... ok +test peer_tests::it_should_be_serializable ... ok +test scrape_handler::tests::it_should_allow_scraping_for_multiple_torrents ... ok +test scrape_handler::tests::it_should_fail_when_loading_the_persisted_downloads_fails ... ok +test scrape_handler::tests::it_should_load_the_persisted_downloads_of_all_torrents_absent_from_memory_in_one_query ... ok +test scrape_handler::tests::it_should_look_up_a_repeated_info_hash_absent_from_memory_only_once ... ok +test scrape_handler::tests::it_should_report_an_in_memory_swarm_without_reading_the_persisted_downloads ... ok +test scrape_handler::tests::it_should_report_every_requested_torrent_without_a_limit_on_the_number_of_info_hashes ... ok +test scrape_handler::tests::it_should_return_a_zeroed_swarm_metadata_for_the_requested_file_if_the_tracker_does_not_have_that_torrent ... ok +test statistics::event::handler::tests::it_should_increment_in_memory_completion_metrics_when_a_peer_download_is_completed ... ok +test statistics::event::handler::tests::it_should_not_increment_in_memory_completion_metrics_when_an_event_is_not_a_completion ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::it_should_allow_peers_to_get_only_a_subset_of_the_peers_in_the_swarm ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::it_should_update_the_swarm_stats_for_the_torrent::when_the_peer_is_a_seeder ... ok +test statistics::event::handler::tests::it_should_persist_global_completion_statistics_when_torrent_persistence_fails ... ok +test statistics::event::listener::tests::it_should_continue_after_lag_then_handle_an_event_then_stop_when_the_in_memory_receiver_is_closed ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::pre_generated::it_should_fail_adding_a_pre_generated_key_when_the_key_duration_exceeds_the_maximum_duration ... ok +test statistics::event::listener::tests::it_should_handle_a_queued_event_then_return_cancelled_when_cancellation_is_already_pending ... ok +test statistics::event::listener::tests::it_should_handle_an_event_then_stop_when_the_in_memory_receiver_is_closed ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::it_should_generate_the_key ... ok +test statistics::event::listener::tests::it_should_leave_the_queued_event_unprocessed_and_return_cancelled_when_the_drain_timeout_has_expired ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::it_should_update_the_swarm_stats_for_the_torrent::when_a_previously_announced_started_peer_has_completed_downloading ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::pre_generated::it_should_fail_adding_a_pre_generated_key_when_the_key_is_invalid ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_permanent_peer_keys::pre_generated_keys::it_should_fail_adding_a_pre_generated_key_when_the_key_is_invalid ... ok +test statistics::event::listener::tests::it_should_stop_when_the_in_memory_receiver_is_closed ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::pre_generated::it_should_add_a_pre_generated_key ... ok +test authentication::tests::the_tracker_configured_as_private::it_should_load_authentication_keys_from_the_database ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::peer_key_errors::it_should_fail_without_a_source_path_when_the_key_is_invalid ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::randomly_generated::it_should_add_a_randomly_generated_key ... ok +test statistics::repository::tests::it_should_export_persisted_metric_with_zero_value_when_persisted_completed_statistics_are_enabled ... ok +test statistics::repository::tests::it_should_omit_persisted_metric_when_persisted_completed_statistics_are_disabled ... ok +test authentication::key::repository::persisted::tests::the_persisted_key_repository_should::persist_a_new_peer_key ... ok +test authentication::tests::the_tracker_configured_as_private::it_should_remove_an_authentication_key ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_permanent_peer_keys::randomly_generated::it_should_generate_the_key ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_permanent_peer_keys::pre_generated_keys::it_should_add_a_pre_generated_key ... ok +test authentication::tests::the_tracker_configured_as_private::with_expiring_and::pre_generated_keys::it_should_authenticate_a_peer_with_the_key ... ok +test authentication::tests::the_tracker_configured_as_private::with_expiring_and::randomly_generated_keys::it_should_authenticate_a_peer_with_the_key ... ok +test authentication::tests::the_tracker_configured_as_private::with_permanent_and::randomly_generated_keys::it_should_authenticate_a_peer_with_the_key ... ok +test authentication::tests::the_tracker_configured_as_private::with_expiring_and::randomly_generated_keys::it_should_accept_an_expired_key_when_checking_expiration_is_disabled_in_configuration ... ok +test authentication::tests::the_tracker_configured_as_private::with_permanent_and::pre_generated_keys::it_should_authenticate_a_peer_with_the_key ... ok +test torrent::services::tests::getting_a_torrent_info::it_should_return_none_if_the_tracker_does_not_have_the_torrent ... ok +test torrent::services::tests::getting_a_torrent_info::it_should_return_the_torrent_info_if_the_tracker_has_the_torrent ... ok +test torrent::services::tests::getting_basic_torrent_info_for_multiple_torrents_at_once::it_should_return_an_empty_list_if_none_of_the_requested_torrents_is_found ... ok +test torrent::services::tests::getting_basic_torrent_info_for_multiple_torrents_at_once::it_should_return_a_list_with_basic_info_about_the_requested_torrents ... ok +test torrent::services::tests::searching_for_torrents::it_should_allow_limiting_the_number_of_torrents_in_the_result ... ok +test torrent::services::tests::searching_for_torrents::it_should_allow_using_pagination_in_the_result ... ok +test torrent::services::tests::searching_for_torrents::it_should_return_a_summarized_info_for_all_torrents ... ok +test torrent::services::tests::searching_for_torrents::it_should_return_an_empty_result_if_the_tracker_does_not_have_any_torrent ... ok +test torrent::services::tests::searching_for_torrents::it_should_return_torrents_ordered_by_info_hash ... ok +test whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_configured_as_listed::should_not_authorize_a_non_whitelisted_infohash ... ok +test whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_configured_as_listed::should_authorize_a_whitelisted_infohash ... ok +test whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_configured_as_listed::should_reject_a_non_whitelisted_infohash_with_a_message_that_names_it_and_holds_no_source_path ... ok +test whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_not_configured_as_listed::should_also_authorize_a_non_whitelisted_infohash ... ok +test whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_not_configured_as_listed::should_authorize_a_whitelisted_infohash ... ok +test whitelist::repository::in_memory::tests::should_allow_adding_a_new_torrent_to_the_whitelist ... ok +test whitelist::repository::in_memory::tests::should_allow_checking_if_an_infohash_is_whitelisted ... ok +test whitelist::repository::in_memory::tests::should_allow_clearing_the_whitelist ... ok +test whitelist::repository::in_memory::tests::should_allow_removing_a_new_torrent_to_the_whitelist ... ok +test authentication::tests::the_tracker_configured_as_private::with_expiring_and::pre_generated_keys::it_should_accept_an_expired_key_when_checking_expiration_is_disabled_in_configuration ... ok +test authentication::key::repository::persisted::tests::the_persisted_key_repository_should::remove_a_persisted_peer_key ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_permanent_peer_keys::randomly_generated::it_should_add_a_randomly_generated_key ... ok +test authentication::key::repository::persisted::tests::the_persisted_key_repository_should::load_all_persisted_peer_keys ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::peer_key_errors::it_should_fail_without_a_source_path_when_the_database_rejects_a_duplicate_key ... ok +test container::tests::it_should_construct_a_tracker_core_container_with_supplied_persistence ... ok +test container::tests::it_should_load_persistent_completed_statistics_when_a_torrent_is_first_announced ... ok +test databases::setup::tests::it_should_initialize_the_sqlite_database ... ok +test statistics::event::handler::tests::it_should_not_persist_completion_statistics_when_an_event_is_not_a_completion ... ok +test statistics::event::listener::tests::it_should_continue_after_lag_then_handle_an_event_then_stop_when_the_persistent_receiver_is_closed ... ok +test databases::driver::sqlite::schema_migrator::tests::bootstrap_legacy_schema_should_seed_history_when_all_legacy_tables_exist ... ok +test statistics::event::handler::tests::it_should_persist_completion_statistics_when_a_peer_download_is_completed ... ok +test databases::driver::sqlite::tests::create_database_tables_should_be_idempotent_on_a_fresh_database ... ok +test torrent::manager::tests::cleaning_torrents::it_should_retain_peerless_torrents_when_it_is_configured_to_do_so ... ok +test statistics::event::listener::tests::it_should_leave_the_queued_events_unprocessed_and_return_cancelled_when_the_drain_timeout_has_expired ... ok +test statistics::event::listener::tests::it_should_stop_when_the_persistent_receiver_is_closed ... ok +test torrent::manager::tests::cleaning_torrents::it_should_remove_torrents_that_have_no_peers_when_it_is_configured_to_do_so ... ok +test torrent::manager::tests::cleaning_torrents::it_should_remove_peers_that_have_not_been_updated_after_a_cutoff_time ... ok +test tests::the_tracker::for_all_config_modes::handling_a_scrape_request::it_should_return_the_swarm_metadata_for_the_requested_file_if_the_tracker_has_that_torrent ... ok +test statistics::event::listener::tests::it_should_persist_every_queued_event_then_return_cancelled_when_cancellation_is_already_pending ... ok +test statistics::event::listener::tests::it_should_handle_an_event_then_stop_when_the_persistent_receiver_is_closed ... ok +test tests::the_tracker::configured_as_whitelisted::handling_a_scrape_request::it_should_return_the_zeroed_swarm_metadata_for_the_requested_file_if_it_is_not_whitelisted ... ok +test statistics::persisted::downloads::tests::it_loads_the_numbers_of_downloads_for_all_torrents_from_the_database ... ok +test statistics::event::listener::tests::it_should_persist_a_queued_completed_download_when_cancellation_is_already_pending ... ok +test statistics::persisted::downloads::tests::it_saves_the_numbers_of_downloads_for_a_torrent_into_the_database ... ok +test statistics::persisted::downloads::tests::it_increases_the_numbers_of_downloads_for_a_torrent_into_the_database ... ok +test whitelist::tests::configured_as_whitelisted::handling_authorization::it_should_not_authorize_the_announce_and_scrape_actions_on_not_whitelisted_torrents ... ok +test whitelist::manager::tests::configured_as_whitelisted::handling_the_torrent_whitelist::it_should_remove_a_torrent_from_the_whitelist ... ok +test whitelist::manager::tests::configured_as_whitelisted::handling_the_torrent_whitelist::it_should_add_a_torrent_to_the_whitelist ... ok +test whitelist::repository::persisted::tests::the_persisted_whitelist_repository::should_add_a_new_infohash_to_the_list ... ok +test whitelist::repository::persisted::tests::the_persisted_whitelist_repository::should_load_all_infohashes_from_the_database ... ok +test whitelist::repository::persisted::tests::the_persisted_whitelist_repository::should_remove_a_infohash_from_the_list ... ok +test whitelist::manager::tests::configured_as_whitelisted::handling_the_torrent_whitelist::persistence::it_should_load_the_whitelist_from_the_database ... ok +test torrent::manager::tests::it_should_load_the_numbers_of_downloads_for_all_torrents_from_the_database ... ok +test whitelist::tests::configured_as_whitelisted::handling_authorization::it_should_authorize_the_announce_and_scrape_actions_on_whitelisted_torrents ... ok +test whitelist::repository::persisted::tests::the_persisted_whitelist_repository::should_not_fail_removing_an_infohash_that_is_not_in_the_list ... ok +test whitelist::repository::persisted::tests::the_persisted_whitelist_repository::should_not_add_the_same_infohash_to_the_list_twice ... ok +test databases::driver::sqlite::tests::run_sqlite_driver_tests ... ok + +test result: ok. 165 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s + + Finished `test` profile [optimized + debuginfo] target(s) in 0.14s + Running unittests src/lib.rs (target/debug/build/torrust-tracker-udp-server/5b1150e2043e54ce/out/torrust_tracker_udp_server-5b1150e2043e54ce) + +running 45 tests +test banning::event::listener::tests::it_should_ignore_non_connection_cookie_errors ... ok +test banning::event::listener::tests::it_should_process_connection_cookie_errors_after_lagging ... ok +test banning::event::handler::tests::it_should_hold_the_publication_order_until_it_has_published_the_banned_ip_total ... ok +test banning::event::handler::tests::it_should_record_the_connection_cookie_error_for_its_client_ip ... ok +test banning::event::handler::tests::it_should_not_hold_the_ban_service_lock_while_waiting_to_publish_the_banned_ip_total ... ok +test banning::event::handler::tests::it_should_publish_the_banned_ip_total_after_a_connection_cookie_error ... ok +test banning::event::listener::tests::it_should_handle_a_queued_event_then_return_cancelled_when_cancellation_is_already_pending ... ok +test banning::event::listener::tests::it_should_leave_the_queued_event_unprocessed_and_return_cancelled_when_the_drain_timeout_has_expired ... ok +test event::tests::it_should_classify_a_negative_number_of_bytes_in_an_announce_as_a_bad_request ... ok +test banning::event::listener::tests::it_should_stop_when_the_receiver_is_closed ... ok +test event::tests::it_should_classify_a_nested_announce_whitelist_error ... ok +test event::tests::it_should_classify_a_direct_scrape_whitelist_error ... ok +test event::tests::it_should_classify_a_database_error ... ok +test event::tests::it_should_classify_a_scrape_connection_cookie_error ... ok +test event::tests::it_should_classify_a_connection_cookie_error ... ok +test event::tests::it_should_classify_a_nested_scrape_whitelist_error ... ok +test event::tests::it_should_classify_a_whitelist_error ... ok +test event::tests::it_should_classify_a_scrape_database_error ... ok +test event::tests::it_should_classify_an_authentication_error ... ok +test event::tests::it_should_classify_an_internal_error ... ok +test event::tests::it_should_classify_an_invalid_request_as_a_request_parse_error ... ok +test event::tests::it_should_convert_request_kinds_to_metric_labels ... ok +test event::tests::it_should_render_request_kinds ... ok +test statistics::event::handler::error::tests::it_should_increase_the_udp4_errors_counter_when_it_receives_a_udp4_error_event ... ok +test statistics::event::handler::error::tests::it_should_label_a_general_error_metric_with_connect_request_kind ... ok +test statistics::event::handler::request_aborted::tests::it_should_increase_the_number_of_aborted_requests_when_it_receives_a_udp_request_aborted_event ... ok +test statistics::event::handler::request_accepted::tests::it_should_increase_the_udp4_connect_requests_counter_when_it_receives_a_udp4_request_event_of_connect_kind ... ok +test statistics::event::handler::request_accepted::tests::it_should_increase_the_udp4_scrape_requests_counter_when_it_receives_a_udp4_request_event_of_scrape_kind ... ok +test statistics::event::handler::request_accepted::tests::it_should_increase_the_udp6_connect_requests_counter_when_it_receives_a_udp6_request_event_of_connect_kind ... ok +test statistics::event::handler::request_accepted::tests::it_should_increase_the_udp6_announce_requests_counter_when_it_receives_a_udp6_request_event_of_announce_kind ... ok +test statistics::event::handler::request_accepted::tests::it_should_increase_the_udp6_scrape_requests_counter_when_it_receives_a_udp6_request_event_of_scrape_kind ... ok +test statistics::event::handler::request_banned::tests::it_should_increase_the_number_of_banned_requests_when_it_receives_a_udp_request_banned_event ... ok +test statistics::event::handler::request_discarded::tests::it_should_increase_the_number_of_discarded_requests_when_it_receives_a_udp_request_discarded_event ... ok +test statistics::event::handler::request_received::tests::it_should_increase_the_number_of_incoming_requests_when_it_receives_a_udp4_incoming_request_event ... ok +test statistics::event::handler::response_sent::tests::it_should_increase_the_udp4_responses_counter_when_it_receives_a_udp4_response_event ... ok +test statistics::event::handler::response_sent::tests::it_should_increase_the_udp6_response_counter_when_it_receives_a_udp6_response_event ... ok +test statistics::event::handler::error::tests::it_should_label_a_connection_id_error_metric_with_qbittorrent_client_software ... ok +test statistics::event::handler::response_sent::tests::it_should_update_the_connect_processing_time_average_for_a_successful_connect_response ... ok +test statistics::event::listener::tests::it_should_apply_the_metrics_policy_to_a_drained_event ... ok +test statistics::event::listener::tests::it_should_leave_the_queued_event_unprocessed_and_return_cancelled_when_the_drain_timeout_has_expired ... ok +test statistics::event::listener::tests::it_should_handle_a_queued_event_then_return_cancelled_when_cancellation_is_already_pending ... ok +test statistics::event::handler::request_accepted::tests::it_should_increase_the_udp4_announce_requests_counter_when_it_receives_a_udp4_request_event_of_announce_kind ... ok +test statistics::event::listener::tests::it_should_process_enabled_events_after_lagging ... ok +test statistics::event::listener::tests::it_should_stop_when_the_receiver_is_closed ... ok +test statistics::event::listener::tests::it_should_update_metrics_only_for_an_enabled_configuration_instance ... ok + +test result: ok. 45 passed; 0 failed; 0 ignored; 0 measured; 179 filtered out; finished in 0.00s + + Finished `test` profile [optimized + debuginfo] target(s) in 0.14s + Running tests/integration.rs (target/debug/build/torrust-tracker-udp-server/bd8a94e9b983c121/out/integration-bd8a94e9b983c121) + +running 17 tests +2026-11-21T13:42:28.229079Z WARN UDP TRACKER: UDP connection ID validation is DISABLED for this listener. Anti-spoofing and replay protection are reduced. Ensure this listener is isolated through external network controls. bind_to=127.0.0.1:53434 +2026-11-21T13:42:28.233043Z WARN UDP TRACKER: UDP connection ID validation is DISABLED for this listener. Anti-spoofing and replay protection are reduced. Ensure this listener is isolated through external network controls. bind_to=127.0.0.1:53521 +2026-11-21T13:42:28.234281Z WARN UDP TRACKER: UDP connection ID validation is DISABLED for this listener. Anti-spoofing and replay protection are reduced. Ensure this listener is isolated through external network controls. bind_to=127.0.0.1:44597 +2026-11-21T13:42:28.234426Z WARN UDP TRACKER: UDP connection ID validation is DISABLED for this listener. Anti-spoofing and replay protection are reduced. Ensure this listener is isolated through external network controls. bind_to=127.0.0.1:45113 +2026-11-21T13:42:28.234955Z WARN UDP TRACKER: UDP connection ID validation is DISABLED for this listener. Anti-spoofing and replay protection are reduced. Ensure this listener is isolated through external network controls. bind_to=127.0.0.1:47840 +2026-11-21T13:42:28.235998Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -3884683641874992000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795268427.2359886 client_socket_addr=127.0.0.1:40306 server_socket_addr=127.0.0.1:46147 service_binding=udp://127.0.0.1:46147 request_id=28837d98-fede-47c6-8412-c00accb74940 transaction_id=0 +2026-11-21T13:42:28.236016Z ERROR UDP TRACKER: response error error=error parsing request: SendableRequestParseError { message: "Protocol identifier missing", opt_connection_id: None, opt_transaction_id: None } client_socket_addr=127.0.0.1:51528 server_socket_addr=127.0.0.1:38342 service_binding=udp://127.0.0.1:38342 request_id=cbada432-e788-4520-9e47-bdb43358b5e5 +2026-11-21T13:42:28.237138Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -2715048903937551000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795268427.2371294 client_socket_addr=127.0.0.1:35172 server_socket_addr=127.0.0.1:38822 service_binding=udp://127.0.0.1:38822 request_id=1e14acef-c362-449f-a4f4-db5145f698fe transaction_id=0 +test server::contract::receiving_an_scrape_request::should_return_a_scrape_response ... ok +test server::contract::receiving_a_connection_request::should_return_a_connect_response ... ok +2026-11-21T13:42:28.245509Z ERROR torrust_tracker_core::whitelist::authorization: error=The torrent: a5164e55859ef48a4ccd5ac92352402f78c081ed, is not whitelisted +2026-11-21T13:42:28.245515Z ERROR UDP TRACKER: response error error=tracker announce error: Tracker core whitelist error: The torrent: a5164e55859ef48a4ccd5ac92352402f78c081ed, is not whitelisted client_socket_addr=127.0.0.1:46352 server_socket_addr=127.0.0.1:41099 service_binding=udp://127.0.0.1:41099 request_id=636dea15-51f3-42b3-81b5-acd946da243f transaction_id=123 +test server::contract::publishing_the_banned_ips_total::with_disabled_connection_id_validation::should_not_publish_a_client_as_banned_before_it_exceeds_the_connection_id_error_limit ... ok +2026-11-21T13:42:28.247921Z WARN UDP TRACKER: UDP connection ID validation is DISABLED for this listener. Anti-spoofing and replay protection are reduced. Ensure this listener is isolated through external network controls. bind_to=127.0.0.1:37144 +2026-11-21T13:42:28.248657Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -3884683641874992000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795268427.2486534 client_socket_addr=127.0.0.1:40306 server_socket_addr=127.0.0.1:46147 service_binding=udp://127.0.0.1:46147 request_id=13288e17-008e-45ef-8362-463f1e7f2f22 transaction_id=1 +2026-11-21T13:42:28.248672Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -2715048903937551000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795268427.248666 client_socket_addr=127.0.0.1:35172 server_socket_addr=127.0.0.1:38822 service_binding=udp://127.0.0.1:38822 request_id=d6db1760-539c-4fd3-96a5-e99e0bf6d8cb transaction_id=1 +2026-11-21T13:42:28.248737Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -3884683641874992000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795268427.2487354 client_socket_addr=127.0.0.1:40306 server_socket_addr=127.0.0.1:46147 service_binding=udp://127.0.0.1:46147 request_id=671ba0f2-aace-4ac1-94e0-53a24bc16877 transaction_id=2 +2026-11-21T13:42:28.263355Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007370314121822049, expected > 1795268427.263348 client_socket_addr=127.0.0.1:59261 server_socket_addr=127.0.0.1:34871 service_binding=udp://127.0.0.1:34871 request_id=50c1d213-ea6b-4c87-b8ee-ce50a4ac34bc transaction_id=-1072220902 +test server::contract::using_ipv6_v6only::should_accept_ipv6_connections_with_ipv6_v6only_enabled ... ok +test server::contract::should_return_a_bad_request_response_when_the_client_sends_an_empty_request ... ok +test server::contract::using_disabled_connection_id_validation::connect_still_issues_a_valid_connection_id ... ok +test server::contract::using_disabled_connection_id_validation::scrape_succeeds_with_an_arbitrary_connection_id ... ok +2026-11-21T13:42:28.280019Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007370314121822049, expected > 1795268427.280014 client_socket_addr=127.0.0.1:59261 server_socket_addr=127.0.0.1:34871 service_binding=udp://127.0.0.1:34871 request_id=a4236dca-1104-44cf-b85f-01d4bece9354 transaction_id=714273134 +2026-11-21T13:42:28.280100Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007370314121822049, expected > 1795268427.2800977 client_socket_addr=127.0.0.1:59261 server_socket_addr=127.0.0.1:34871 service_binding=udp://127.0.0.1:34871 request_id=1f632dfd-9fa6-4b95-909c-7ffd18a5ddd7 transaction_id=-304773688 +2026-11-21T13:42:28.280148Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007370314121822049, expected > 1795268427.2801473 client_socket_addr=127.0.0.1:59261 server_socket_addr=127.0.0.1:34871 service_binding=udp://127.0.0.1:34871 request_id=e5a80418-a1ca-4826-b8b5-54005677dbb0 transaction_id=-1328187140 +2026-11-21T13:42:28.280198Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007370314121822049, expected > 1795268427.280197 client_socket_addr=127.0.0.1:59261 server_socket_addr=127.0.0.1:34871 service_binding=udp://127.0.0.1:34871 request_id=72e3168d-080f-47ae-897d-3e217fbef424 transaction_id=-768014602 +2026-11-21T13:42:28.280239Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007370314121822049, expected > 1795268427.2802384 client_socket_addr=127.0.0.1:59261 server_socket_addr=127.0.0.1:34871 service_binding=udp://127.0.0.1:34871 request_id=92526fa4-a3c2-4603-8a29-a361b9f16910 transaction_id=357071643 +2026-11-21T13:42:28.280280Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007370314121822049, expected > 1795268427.2802792 client_socket_addr=127.0.0.1:59261 server_socket_addr=127.0.0.1:34871 service_binding=udp://127.0.0.1:34871 request_id=6cd12b75-5835-43b8-b452-97fb086449a4 transaction_id=683899386 +2026-11-21T13:42:28.280321Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007370314121822049, expected > 1795268427.28032 client_socket_addr=127.0.0.1:59261 server_socket_addr=127.0.0.1:34871 service_binding=udp://127.0.0.1:34871 request_id=0b14a8e2-7e2f-4269-a8ee-730e08a50968 transaction_id=1185375477 +2026-11-21T13:42:28.280362Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007370314121822049, expected > 1795268427.2803614 client_socket_addr=127.0.0.1:59261 server_socket_addr=127.0.0.1:34871 service_binding=udp://127.0.0.1:34871 request_id=8a4acf43-7487-492d-b071-ecd083dd6bb5 transaction_id=699017026 +2026-11-21T13:42:28.280407Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007370314121822049, expected > 1795268427.2804065 client_socket_addr=127.0.0.1:59261 server_socket_addr=127.0.0.1:34871 service_binding=udp://127.0.0.1:34871 request_id=d957579e-7f14-4883-bd52-8311920d072c transaction_id=1203721691 +2026-11-21T13:42:28.280452Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007370314121822049, expected > 1795268427.280451 client_socket_addr=127.0.0.1:59261 server_socket_addr=127.0.0.1:34871 service_binding=udp://127.0.0.1:34871 request_id=559251ad-30af-4052-bc79-3e8a58910f05 transaction_id=-1922578197 +test server::contract::receiving_an_announce_request::should_return_an_announce_response ... ok +test server::contract::receiving_an_scrape_request::should_return_only_the_first_74_torrent_stats_when_the_request_has_75_info_hashes ... ok +test server::contract::receiving_an_announce_request::should_reject_a_torrent_that_is_not_whitelisted_with_a_message_that_holds_no_source_path ... ok +test server::contract::publishing_the_banned_ips_total::with_strict_connection_id_validation::should_not_publish_a_client_as_banned_before_it_exceeds_the_connection_id_error_limit ... ok +test server::contract::publishing_the_banned_ips_total::with_strict_connection_id_validation::should_publish_a_client_as_banned_once_it_exceeds_the_connection_id_error_limit ... ok +test server::contract::publishing_the_banned_ips_total::with_disabled_connection_id_validation::should_publish_a_client_that_exceeds_the_connection_id_error_limit_as_would_be_banned ... ok +test server::contract::using_disabled_connection_id_validation::many_invalid_connection_ids_do_not_cause_ban_in_disabled_mode ... ok +test server::contract::using_disabled_connection_id_validation::announce_succeeds_with_an_arbitrary_connection_id ... ok +test server::contract::receiving_an_announce_request::should_return_many_announce_response ... ok +test server::contract::receiving_an_announce_request::should_ban_the_client_ip_if_it_sends_more_than_10_requests_with_a_cookie_value_not_normal ... ok + +test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 5.11s + + Compiling torrust-tracker-axum-http-server v0.1.0 (/packages/axum-http-server) + Finished `test` profile [optimized + debuginfo] target(s) in 0.81s + Running tests/integration.rs (target/debug/build/torrust-tracker-axum-http-server/8be83a73e2eb672f/out/integration-8be83a73e2eb672f) + +running 14 tests +2026-11-21T13:42:34.190901Z ERROR torrust_tracker_core::whitelist::authorization: error=The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_private_tracker_without_a_key ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_with_a_short_peer_id ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_private_tracker_with_a_malformed_key ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_without_the_info_hash_param ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_listed_tracker_for_a_torrent_that_is_not_whitelisted ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_with_a_short_info_hash ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_tracker_behind_a_reverse_proxy_without_the_x_forwarded_for_header ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::a_scrape_with_a_short_info_hash ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_private_tracker_with_an_unregistered_key ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::a_scrape_without_query_params ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::a_scrape_without_the_info_hash_param ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_without_query_params ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_with_an_invalid_numwant_param ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_with_an_unparsable_query ... ok + +test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 63 filtered out; finished in 1.09s + + Finished `test` profile [optimized + debuginfo] target(s) in 0.14s + Running tests/integration.rs (target/debug/build/torrust-tracker-axum-rest-api-server/19e3c26806ff5d31/out/integration-19e3c26806ff5d31) + +running 60 tests +2026-11-21T13:42:35.592276Z WARN torrust_tracker_core::databases::driver::sqlite::auth_key_store: the delete did not remove exactly one row driver=Sqlite3 table="keys" rows_deleted=0 +2026-11-21T13:42:35.592298Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:39415 service_binding=http://127.0.0.1:39415/ request_id=fb3861e3-b1d4-4303-8dbc-57f22beef0a0 +2026-11-21T13:42:35.592306Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:39415 service_binding=http://127.0.0.1:39415/ +2026-11-21T13:42:35.598414Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:41127 service_binding=http://127.0.0.1:41127/ request_id=a18f9287-d216-4dee-88c9-801a6d8cc0d2 +2026-11-21T13:42:35.598425Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:41127 service_binding=http://127.0.0.1:41127/ +2026-11-21T13:42:35.600986Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:41127 service_binding=http://127.0.0.1:41127/ request_id=2f880168-de2b-4190-acd9-ed9d271cf753 +2026-11-21T13:42:35.600996Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:41127 service_binding=http://127.0.0.1:41127/ +2026-11-21T13:42:35.611568Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:43599 service_binding=http://127.0.0.1:43599/ request_id=8add51b1-a10b-4d90-9f59-71ea3da7be63 +2026-11-21T13:42:35.611579Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:43599 service_binding=http://127.0.0.1:43599/ +2026-11-21T13:42:35.619227Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:34285 service_binding=http://127.0.0.1:34285/ request_id=546548ff-26b4-49dc-a1a5-a14203d06885 +2026-11-21T13:42:35.619238Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:34285 service_binding=http://127.0.0.1:34285/ +2026-11-21T13:42:35.621858Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:34285 service_binding=http://127.0.0.1:34285/ request_id=334924b1-c755-4523-ab59-442c2ca2d9d7 +2026-11-21T13:42:35.621867Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:34285 service_binding=http://127.0.0.1:34285/ +2026-11-21T13:42:35.622036Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:41987 service_binding=http://127.0.0.1:41987/ request_id=75cdbb87-ce51-4b6d-b89e-02e11753cdf7 +2026-11-21T13:42:35.622046Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:41987 service_binding=http://127.0.0.1:41987/ +2026-11-21T13:42:35.623752Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:35671 service_binding=http://127.0.0.1:35671/ request_id=78df89d3-050e-47d8-aa3e-229b0e640ad9 +2026-11-21T13:42:35.623761Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:35671 service_binding=http://127.0.0.1:35671/ +2026-11-21T13:42:35.624017Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:35621 service_binding=http://127.0.0.1:35621/ request_id=bd87849d-602b-4de1-98eb-06100fb284ec +2026-11-21T13:42:35.624027Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:45617 service_binding=http://127.0.0.1:45617/ request_id=60f52f24-8b6a-4ab8-9926-b8f3eeb813aa +2026-11-21T13:42:35.624031Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:35621 service_binding=http://127.0.0.1:35621/ +2026-11-21T13:42:35.624038Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:45617 service_binding=http://127.0.0.1:45617/ +2026-11-21T13:42:35.625100Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:41987 service_binding=http://127.0.0.1:41987/ request_id=40ee1040-99f7-49ba-829a-3980ee2ec7ee +2026-11-21T13:42:35.625109Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:41987 service_binding=http://127.0.0.1:41987/ +2026-11-21T13:42:35.625325Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:42119 service_binding=http://127.0.0.1:42119/ request_id=753db5ea-5486-4963-a8c9-4ff02be6fe6a +2026-11-21T13:42:35.625338Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:42119 service_binding=http://127.0.0.1:42119/ +2026-11-21T13:42:35.625356Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:42541 service_binding=http://127.0.0.1:42541/ request_id=69d953be-243b-4b4d-983d-ea440b0d6422 +2026-11-21T13:42:35.625369Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:42541 service_binding=http://127.0.0.1:42541/ +2026-11-21T13:42:35.626543Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:39017 service_binding=http://127.0.0.1:39017/ request_id=eec179c8-098d-4cc9-a6a5-f63516866847 +2026-11-21T13:42:35.626554Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:39017 service_binding=http://127.0.0.1:39017/ +2026-11-21T13:42:35.643746Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:40271 service_binding=http://127.0.0.1:40271/ request_id=6903df7f-77a0-4e50-90d4-c931050974a0 +2026-11-21T13:42:35.643756Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:40271 service_binding=http://127.0.0.1:40271/ +2026-11-21T13:42:35.646618Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:39025 service_binding=http://127.0.0.1:39025/ request_id=a15ee6d9-3928-482e-9391-020a5521bc06 +2026-11-21T13:42:35.646628Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:39025 service_binding=http://127.0.0.1:39025/ +2026-11-21T13:42:35.647081Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:33255 service_binding=http://127.0.0.1:33255/ request_id=5ce872c7-f148-44e8-a037-1f18b4f4e56a +2026-11-21T13:42:35.647091Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:33255 service_binding=http://127.0.0.1:33255/ +2026-11-21T13:42:35.648135Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:36363 service_binding=http://127.0.0.1:36363/ request_id=b953a334-848f-4cef-94e3-22c79f4c4518 +2026-11-21T13:42:35.648149Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:36363 service_binding=http://127.0.0.1:36363/ +2026-11-21T13:42:35.651552Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:33255 service_binding=http://127.0.0.1:33255/ request_id=7eaa1fde-b5fa-405a-b9ab-398793c13453 +2026-11-21T13:42:35.651562Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:33255 service_binding=http://127.0.0.1:33255/ +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_query_param::it_should_authenticate_requests_when_the_token_is_provided_as_a_query_param ... ok +test server::v1::contract::context::auth_key::should_fail_without_a_source_path_when_the_auth_key_to_delete_does_not_exist ... ok +test server::v1::contract::context::auth_key::should_fail_generating_a_new_auth_key_when_the_provided_key_is_invalid ... ok +test server::v1::contract::context::auth_key::should_not_allow_generating_a_new_auth_key_for_unauthenticated_users ... ok +test server::v1::contract::context::auth_key::should_fail_deleting_an_auth_key_when_the_key_id_is_invalid ... ok +test server::v1::contract::authentication::given_that_not_token_is_provided::it_should_not_authenticate_requests_when_the_token_is_missing ... ok +test server::v1::contract::context::stats::should_allow_getting_tracker_statistics ... ok +2026-11-21T13:42:36.626636Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:33987 service_binding=http://127.0.0.1:33987/ request_id=8b4b387f-3fe2-4b1d-8c7a-84f4a2fcfc24 +2026-11-21T13:42:36.626653Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:33987 service_binding=http://127.0.0.1:33987/ +test server::v1::contract::context::auth_key::should_not_allow_deleting_an_auth_key_for_unauthenticated_users ... ok +2026-11-21T13:42:36.630814Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:33987 service_binding=http://127.0.0.1:33987/ request_id=0b608d06-b2c0-4782-a000-df794d26ce1d +2026-11-21T13:42:36.630824Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:33987 service_binding=http://127.0.0.1:33987/ +test server::v1::contract::context::auth_key::should_allow_generating_a_new_random_auth_key ... ok +test server::v1::contract::context::auth_key::should_allow_reloading_keys ... ok +test server::v1::contract::context::auth_key::should_allow_uploading_a_preexisting_auth_key ... ok +test server::v1::contract::context::auth_key::deprecated_generate_key_endpoint::should_fail_when_the_auth_key_cannot_be_generated ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_authentication_header::it_should_not_authenticate_requests_when_the_token_is_empty ... ok +test server::v1::contract::context::auth_key::should_fail_when_the_auth_key_cannot_be_generated ... ok +test server::v1::contract::context::auth_key::deprecated_generate_key_endpoint::should_not_allow_generating_a_new_auth_key_for_unauthenticated_users ... ok +test server::v1::contract::authentication::given_that_token_is_provided_via_get_param_and_authentication_header::it_should_authenticate_requests_using_the_token_provided_in_the_authentication_header ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_authentication_header::it_should_authenticate_requests_when_the_token_is_provided_in_the_authentication_header ... ok +test server::v1::contract::context::auth_key::should_reject_auth_key_requests_when_private_mode_is_disabled_without_database_access ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_query_param::it_should_not_authenticate_requests_when_the_token_is_empty ... ok +test server::v1::contract::context::auth_key::should_fail_when_the_auth_key_cannot_be_deleted ... ok +test server::v1::contract::context::auth_key::should_fail_when_keys_cannot_be_reloaded ... ok +test server::v1::contract::context::stats::should_expose_an_enabled_zero_value_persisted_metric ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_query_param::it_should_allow_the_token_query_param_to_be_at_any_position_in_the_url_query ... ok +test server::v1::contract::context::auth_key::should_fail_without_a_source_path_when_the_same_auth_key_is_uploaded_twice ... ok +test server::v1::contract::context::auth_key::should_allow_deleting_an_auth_key ... ok +test server::v1::contract::context::auth_key::deprecated_generate_key_endpoint::should_allow_generating_a_new_auth_key ... ok +test server::v1::contract::context::health_check::health_check_endpoint_should_return_status_ok_if_api_is_running ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_authentication_header::it_should_not_authenticate_requests_when_the_token_is_invalid ... ok +test server::v1::contract::context::auth_key::deprecated_generate_key_endpoint::should_fail_generating_a_new_auth_key_when_the_key_duration_is_invalid ... ok +test server::v1::contract::context::auth_key::should_fail_generating_a_new_auth_key_when_the_key_duration_is_invalid ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_query_param::it_should_not_authenticate_requests_when_the_token_is_invalid ... ok +test server::v1::contract::context::auth_key::should_not_allow_reloading_keys_for_unauthenticated_users ... ok +2026-11-21T13:42:36.725069Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:39589 service_binding=http://127.0.0.1:39589/ request_id=ca953f54-7a46-4f3b-b82a-67b966dc6202 +2026-11-21T13:42:36.725092Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:39589 service_binding=http://127.0.0.1:39589/ +2026-11-21T13:42:36.728142Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:39589 service_binding=http://127.0.0.1:39589/ request_id=65159290-30ec-4c40-9edc-05c6e6b5c268 +2026-11-21T13:42:36.728160Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:39589 service_binding=http://127.0.0.1:39589/ +2026-11-21T13:42:36.732938Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:45459 service_binding=http://127.0.0.1:45459/ request_id=96c0d6a6-f060-4316-afc4-7d3a0dfc7295 +2026-11-21T13:42:36.732953Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:45459 service_binding=http://127.0.0.1:45459/ +2026-11-21T13:42:36.734358Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:33927 service_binding=http://127.0.0.1:33927/ request_id=3b65cdfb-7743-4cf3-9eac-f900daded0ac +2026-11-21T13:42:36.734374Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:33927 service_binding=http://127.0.0.1:33927/ +2026-11-21T13:42:36.734747Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:34379 service_binding=http://127.0.0.1:34379/ request_id=25785e60-bc60-4cb8-8d1a-c21aebf60ec3 +2026-11-21T13:42:36.734759Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:34379 service_binding=http://127.0.0.1:34379/ +2026-11-21T13:42:36.736567Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:43259 service_binding=http://127.0.0.1:43259/ request_id=f13839d7-2d05-4a32-961e-120a90601c6d +2026-11-21T13:42:36.736580Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:43259 service_binding=http://127.0.0.1:43259/ +2026-11-21T13:42:36.736750Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:39929 service_binding=http://127.0.0.1:39929/ request_id=a24ee927-8fd0-4a09-a0c6-e88f783efd0a +2026-11-21T13:42:36.736762Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:39929 service_binding=http://127.0.0.1:39929/ +2026-11-21T13:42:36.738819Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:39233 service_binding=http://127.0.0.1:39233/ request_id=aa3c8ea3-5658-4c2e-84e8-0228f71ffa8e +2026-11-21T13:42:36.738829Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:39233 service_binding=http://127.0.0.1:39233/ +2026-11-21T13:42:36.739672Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:33927 service_binding=http://127.0.0.1:33927/ request_id=041fc5f9-b701-43a3-aa94-946826e63353 +2026-11-21T13:42:36.739681Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:33927 service_binding=http://127.0.0.1:33927/ +2026-11-21T13:42:36.740327Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:39929 service_binding=http://127.0.0.1:39929/ request_id=c27d0b0b-38f3-4be9-861a-09408eff5790 +2026-11-21T13:42:36.740341Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:39929 service_binding=http://127.0.0.1:39929/ +2026-11-21T13:42:36.743397Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:39233 service_binding=http://127.0.0.1:39233/ request_id=084c398f-c176-4fed-b078-b2fa39c2d581 +2026-11-21T13:42:36.743407Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:39233 service_binding=http://127.0.0.1:39233/ +test server::v1::contract::context::stats::should_expose_completed_download_availability_and_omit_the_persisted_metric_when_disabled ... ok +test server::v1::contract::context::torrent::should_allow_getting_a_list_of_torrents_providing_infohashes ... ok +test server::v1::contract::context::stats::should_not_allow_getting_tracker_statistics_for_unauthenticated_users ... ok +test server::v1::contract::context::torrent::should_allow_getting_a_torrent_info ... ok +test server::v1::contract::context::torrent::should_allow_getting_all_torrents ... ok +test server::v1::contract::context::torrent::should_allow_limiting_the_torrents_in_the_result ... ok +test server::v1::contract::context::torrent::should_allow_the_torrents_result_pagination ... ok +test server::v1::contract::context::torrent::should_fail_getting_a_torrent_info_when_the_provided_infohash_is_invalid ... ok +test server::v1::contract::context::torrent::should_fail_while_getting_a_torrent_info_when_the_torrent_does_not_exist ... ok +test server::v1::contract::context::whitelist::should_allow_whitelisting_a_torrent_that_has_been_already_whitelisted ... ok +test server::v1::contract::context::whitelist::should_allow_removing_a_torrent_from_the_whitelist ... ok +test server::v1::contract::context::whitelist::should_not_allow_whitelisting_a_torrent_for_unauthenticated_users ... ok +test server::v1::contract::context::torrent::should_include_equal_v1_peer_timestamp_fields_in_the_raw_torrent_json_response ... ok +test server::v1::contract::context::whitelist::should_fail_when_the_torrent_cannot_be_whitelisted ... ok +test server::v1::contract::context::whitelist::should_reject_whitelist_requests_when_listed_mode_is_disabled_without_database_access ... ok +test server::v1::contract::context::whitelist::should_fail_when_the_whitelist_cannot_be_reloaded_from_the_database ... ok +test server::v1::contract::context::whitelist::should_allow_reload_the_whitelist_from_the_database ... ok +test server::v1::contract::context::whitelist::should_allow_whitelisting_a_torrent ... ok +test server::v1::contract::context::whitelist::should_not_fail_trying_to_remove_a_non_whitelisted_torrent_from_the_whitelist ... ok +test server::v1::contract::context::torrent::should_fail_getting_torrents_when_the_offset_query_parameter_cannot_be_parsed ... ok +test server::v1::contract::context::whitelist::should_fail_when_the_torrent_cannot_be_removed_from_the_whitelist ... ok +test server::v1::contract::context::torrent::should_fail_getting_torrents_when_the_limit_query_parameter_cannot_be_parsed ... ok +test server::v1::contract::context::torrent::should_not_allow_getting_a_torrent_info_for_unauthenticated_users ... ok +test server::v1::contract::context::whitelist::should_not_allow_removing_a_torrent_from_the_whitelist_for_unauthenticated_users ... ok +test server::v1::contract::context::torrent::should_not_allow_getting_torrents_for_unauthenticated_users ... ok +test server::v1::contract::context::whitelist::should_fail_whitelisting_a_torrent_when_the_provided_infohash_is_invalid ... ok +test server::v1::contract::context::torrent::should_fail_getting_torrents_when_the_info_hash_parameter_is_invalid ... ok +test server::v1::contract::context::whitelist::should_fail_removing_a_torrent_from_the_whitelist_when_the_provided_infohash_is_invalid ... ok + +test result: ok. 60 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.37s + diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-axum-http-server.txt b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-axum-http-server.txt new file mode 100644 index 0000000000..90abed7365 --- /dev/null +++ b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-axum-http-server.txt @@ -0,0 +1,56 @@ + Compiling torrust-tracker-primitives v3.1.0 (/packages/primitives) + Compiling torrust-tracker-client-lib v0.1.0 (/packages/tracker-client) + Compiling torrust-tracker-configuration v3.0.0 (/packages/configuration) + Compiling torrust-tracker-swarm-coordination-registry v0.1.0 (/packages/swarm-coordination-registry) + Compiling torrust-tracker-core v0.1.0 (/packages/tracker-core) + Compiling torrust-tracker-axum-server v0.1.0 (/packages/axum-server) + Compiling torrust-tracker-test-helpers v3.0.0 (/packages/test-helpers) + Compiling torrust-tracker-http-core v0.1.0 (/packages/http-core) + Compiling torrust-tracker-axum-http-server v0.1.0 (/packages/axum-http-server) + Finished `test` profile [optimized + debuginfo] target(s) in 2.69s + Running tests/integration.rs (target/debug/build/torrust-tracker-axum-http-server/2147d666273a05bb/out/integration-2147d666273a05bb) + +running 14 tests +2026-11-21T13:32:37.933468Z ERROR torrust_tracker_core::whitelist::authorization: error=The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted, packages/tracker-core/src/whitelist/authorization.rs:61:23 +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_with_a_short_peer_id ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_without_the_info_hash_param ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_without_query_params ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_with_an_unparsable_query ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::a_scrape_without_query_params ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_with_an_invalid_numwant_param ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_private_tracker_with_a_malformed_key ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_tracker_behind_a_reverse_proxy_without_the_x_forwarded_for_header ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_listed_tracker_for_a_torrent_that_is_not_whitelisted ... FAILED +test server::v1::contract::failure_reasons_hold_no_source_path::a_scrape_with_a_short_info_hash ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::a_scrape_without_the_info_hash_param ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_with_a_short_info_hash ... ok +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_private_tracker_with_an_unregistered_key ... FAILED +test server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_private_tracker_without_a_key ... FAILED + +failures: + +---- server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_listed_tracker_for_a_torrent_that_is_not_whitelisted stdout ---- + +thread 'server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_listed_tracker_for_a_torrent_that_is_not_whitelisted' panicked at packages/axum-http-server/tests/server/v1/contract/failure_reasons_hold_no_source_path.rs:190:5: +the failure reason must not hold a source path, but it contains ".rs:": "Tracker whitelist error: The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted, packages/tracker-core/src/whitelist/authorization.rs:61:23" +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + +---- server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_private_tracker_with_an_unregistered_key stdout ---- + +thread 'server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_private_tracker_with_an_unregistered_key' panicked at packages/axum-http-server/tests/server/v1/contract/failure_reasons_hold_no_source_path.rs:217:5: +the failure reason must not hold a source path, but it contains ".rs:": "Tracker authentication error: Failed to read key: YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ, packages/tracker-core/src/authentication/service.rs:98:27" + +---- server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_private_tracker_without_a_key stdout ---- + +thread 'server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_private_tracker_without_a_key' panicked at packages/axum-http-server/tests/server/v1/contract/failure_reasons_hold_no_source_path.rs:205:5: +the failure reason must not hold a source path, but it contains ".rs:": "Tracker authentication error: Missing authentication key, packages/http-core/src/services/announce.rs:308:27" + + +failures: + server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_listed_tracker_for_a_torrent_that_is_not_whitelisted + server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_private_tracker_with_an_unregistered_key + server::v1::contract::failure_reasons_hold_no_source_path::an_announce_to_a_private_tracker_without_a_key + +test result: FAILED. 11 passed; 3 failed; 0 ignored; 0 measured; 63 filtered out; finished in 1.08s + +error: test failed, to rerun pass `-p torrust-tracker-axum-http-server --test integration` diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-axum-rest-api-server.txt b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-axum-rest-api-server.txt new file mode 100644 index 0000000000..29153d1c4d --- /dev/null +++ b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-axum-rest-api-server.txt @@ -0,0 +1,218 @@ + Compiling tokio-rustls v0.26.6 + Compiling sqlx-core v0.8.6 + Compiling tower-http v0.6.11 + Compiling torrust-tracker-primitives v3.1.0 (/packages/primitives) + Compiling axum-extra v0.12.6 + Compiling torrust-server-lib v0.6.0 + Compiling hyper-rustls v0.27.10 + Compiling axum-server v0.9.2 + Compiling reqwest v0.13.5 + Compiling torrust-tracker-configuration v3.0.0 (/packages/configuration) + Compiling torrust-tracker-swarm-coordination-registry v0.1.0 (/packages/swarm-coordination-registry) + Compiling torrust-tracker-rest-api-application v0.1.0 (/packages/rest-api-application) + Compiling torrust-tracker-client-lib v0.1.0 (/packages/tracker-client) + Compiling torrust-tracker-rest-api-client v0.1.0 (/packages/rest-api-client) + Compiling sqlx-sqlite v0.8.6 + Compiling sqlx-mysql v0.8.6 + Compiling sqlx-postgres v0.8.6 + Compiling torrust-tracker-axum-server v0.1.0 (/packages/axum-server) + Compiling torrust-tracker-test-helpers v3.0.0 (/packages/test-helpers) + Compiling sqlx v0.8.6 + Compiling torrust-tracker-core v0.1.0 (/packages/tracker-core) + Compiling torrust-tracker-udp-core v0.1.0 (/packages/udp-core) + Compiling torrust-tracker-http-core v0.1.0 (/packages/http-core) + Compiling torrust-tracker-udp-server v0.1.0 (/packages/udp-server) + Compiling torrust-tracker-rest-api-runtime-adapter v0.1.0 (/packages/rest-api-runtime-adapter) + Compiling torrust-tracker-axum-rest-api-server v0.1.0 (/packages/axum-rest-api-server) + Finished `test` profile [optimized + debuginfo] target(s) in 11.06s + Running tests/integration.rs (target/debug/build/torrust-tracker-axum-rest-api-server/7bee9a1d877ebe10/out/integration-7bee9a1d877ebe10) + +running 60 tests +2026-11-21T13:32:50.346153Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:34819 service_binding=http://127.0.0.1:34819/ request_id=caac26d9-9ae9-46a3-a816-690b396b1b68 +2026-11-21T13:32:50.346171Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:34819 service_binding=http://127.0.0.1:34819/ +2026-11-21T13:32:50.361044Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:45759 service_binding=http://127.0.0.1:45759/ request_id=81344616-900c-4c86-bc70-47eb6ec8abba +2026-11-21T13:32:50.361056Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:45759 service_binding=http://127.0.0.1:45759/ +2026-11-21T13:32:50.362985Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:42579 service_binding=http://127.0.0.1:42579/ request_id=68e0752c-7ee5-43d2-bd56-5d5a3223fa93 +2026-11-21T13:32:50.362999Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:42579 service_binding=http://127.0.0.1:42579/ +test server::v1::contract::context::auth_key::should_fail_without_a_source_path_when_the_same_auth_key_is_uploaded_twice ... FAILED +2026-11-21T13:32:50.366472Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:34699 service_binding=http://127.0.0.1:34699/ request_id=328c127e-6640-4402-bc77-fec8822153cf +2026-11-21T13:32:50.366484Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:34699 service_binding=http://127.0.0.1:34699/ +test server::v1::contract::context::auth_key::deprecated_generate_key_endpoint::should_fail_when_the_auth_key_cannot_be_generated ... FAILED +2026-11-21T13:32:50.369930Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:38107 service_binding=http://127.0.0.1:38107/ request_id=cf1af031-4fb1-49c6-98cb-1607e359f4e4 +2026-11-21T13:32:50.369945Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:38107 service_binding=http://127.0.0.1:38107/ +2026-11-21T13:32:50.374599Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:38107 service_binding=http://127.0.0.1:38107/ request_id=ed0a5b48-e419-4c76-8598-ca11c81874b7 +2026-11-21T13:32:50.374611Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:38107 service_binding=http://127.0.0.1:38107/ +2026-11-21T13:32:50.383800Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:45759 service_binding=http://127.0.0.1:45759/ request_id=45b961e2-bb20-4413-9636-10ed0def7baa +2026-11-21T13:32:50.383817Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:45759 service_binding=http://127.0.0.1:45759/ +2026-11-21T13:32:50.385378Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:46195 service_binding=http://127.0.0.1:46195/ request_id=2187f69a-29f4-4a89-84dc-de04fa828f05 +2026-11-21T13:32:50.385391Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:46195 service_binding=http://127.0.0.1:46195/ +2026-11-21T13:32:50.385562Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:41279 service_binding=http://127.0.0.1:41279/ request_id=f76ed38f-fcb9-482a-b034-9570c1a1fa17 +2026-11-21T13:32:50.385577Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:41279 service_binding=http://127.0.0.1:41279/ +2026-11-21T13:32:50.386194Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:39121 service_binding=http://127.0.0.1:39121/ request_id=5456a353-0e67-4c39-abaf-0bca2ec4ad54 +2026-11-21T13:32:50.386204Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:39121 service_binding=http://127.0.0.1:39121/ +test server::v1::contract::context::auth_key::should_fail_without_a_source_path_when_the_auth_key_to_delete_does_not_exist ... FAILED +2026-11-21T13:32:50.389005Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:33407 service_binding=http://127.0.0.1:33407/ request_id=72c1314e-9a44-4a7a-aa00-ad39bb5360cc +2026-11-21T13:32:50.389017Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:33407 service_binding=http://127.0.0.1:33407/ +2026-11-21T13:32:50.389501Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:41279 service_binding=http://127.0.0.1:41279/ request_id=bf68cb1d-2e5c-43a9-98b4-bae1085e262a +2026-11-21T13:32:50.389509Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:41279 service_binding=http://127.0.0.1:41279/ +2026-11-21T13:32:50.389725Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:36681 service_binding=http://127.0.0.1:36681/ request_id=d7bc5ef3-882d-4f2b-96ae-676b7d7b9ea2 +2026-11-21T13:32:50.389734Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:36681 service_binding=http://127.0.0.1:36681/ +test server::v1::contract::context::auth_key::should_fail_when_the_auth_key_cannot_be_generated ... FAILED +2026-11-21T13:32:50.390955Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:38579 service_binding=http://127.0.0.1:38579/ request_id=738ecda9-822e-4175-8a0a-209e1915b41b +2026-11-21T13:32:50.390971Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:38579 service_binding=http://127.0.0.1:38579/ +test server::v1::contract::context::auth_key::should_fail_when_keys_cannot_be_reloaded ... FAILED +2026-11-21T13:32:50.392950Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:46201 service_binding=http://127.0.0.1:46201/ request_id=4fd6c266-a284-4cd6-9e50-df4570ce7952 +2026-11-21T13:32:50.392964Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:46201 service_binding=http://127.0.0.1:46201/ +2026-11-21T13:32:50.393105Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:35981 service_binding=http://127.0.0.1:35981/ request_id=9efee100-25d0-4de1-adb4-15542f211bd4 +2026-11-21T13:32:50.393117Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:35981 service_binding=http://127.0.0.1:35981/ +2026-11-21T13:32:50.393201Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:44467 service_binding=http://127.0.0.1:44467/ request_id=4e97c713-7056-44ac-8f3e-b9afb696b214 +2026-11-21T13:32:50.393215Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:44467 service_binding=http://127.0.0.1:44467/ +2026-11-21T13:32:50.393300Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:46195 service_binding=http://127.0.0.1:46195/ request_id=f0d27054-58e4-4d9f-af6f-3d7caf62f1ac +2026-11-21T13:32:50.393312Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:46195 service_binding=http://127.0.0.1:46195/ +2026-11-21T13:32:50.393838Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:41501 service_binding=http://127.0.0.1:41501/ request_id=74ce0f0b-9487-43d1-a76c-9785e41849ca +2026-11-21T13:32:50.393848Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:41501 service_binding=http://127.0.0.1:41501/ +test server::v1::contract::context::auth_key::should_fail_when_the_auth_key_cannot_be_deleted ... FAILED +2026-11-21T13:32:50.401561Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:39749 service_binding=http://127.0.0.1:39749/ request_id=a1bcbaeb-0704-46f4-87c5-68610a7438bf +2026-11-21T13:32:50.401586Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:39749 service_binding=http://127.0.0.1:39749/ +2026-11-21T13:32:50.406326Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:39749 service_binding=http://127.0.0.1:39749/ request_id=4e8d9f5e-eb14-469a-a9bf-1dccd8c4ce03 +2026-11-21T13:32:50.406344Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:39749 service_binding=http://127.0.0.1:39749/ +test server::v1::contract::authentication::given_that_not_token_is_provided::it_should_not_authenticate_requests_when_the_token_is_missing ... ok +test server::v1::contract::context::auth_key::should_allow_uploading_a_preexisting_auth_key ... ok +test server::v1::contract::context::auth_key::deprecated_generate_key_endpoint::should_allow_generating_a_new_auth_key ... ok +test server::v1::contract::context::auth_key::should_not_allow_reloading_keys_for_unauthenticated_users ... ok +test server::v1::contract::context::auth_key::deprecated_generate_key_endpoint::should_not_allow_generating_a_new_auth_key_for_unauthenticated_users ... ok +test server::v1::contract::context::auth_key::should_allow_deleting_an_auth_key ... ok +test server::v1::contract::context::health_check::health_check_endpoint_should_return_status_ok_if_api_is_running ... ok +test server::v1::contract::context::auth_key::should_allow_generating_a_new_random_auth_key ... ok +test server::v1::contract::context::auth_key::should_not_allow_deleting_an_auth_key_for_unauthenticated_users ... ok +test server::v1::contract::context::auth_key::deprecated_generate_key_endpoint::should_fail_generating_a_new_auth_key_when_the_key_duration_is_invalid ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_authentication_header::it_should_not_authenticate_requests_when_the_token_is_invalid ... ok +test server::v1::contract::context::stats::should_expose_completed_download_availability_and_omit_the_persisted_metric_when_disabled ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_query_param::it_should_authenticate_requests_when_the_token_is_provided_as_a_query_param ... ok +test server::v1::contract::context::auth_key::should_fail_generating_a_new_auth_key_when_the_key_duration_is_invalid ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_authentication_header::it_should_authenticate_requests_when_the_token_is_provided_in_the_authentication_header ... ok +test server::v1::contract::context::stats::should_allow_getting_tracker_statistics ... ok +test server::v1::contract::context::auth_key::should_allow_reloading_keys ... ok +test server::v1::contract::authentication::given_that_token_is_provided_via_get_param_and_authentication_header::it_should_authenticate_requests_using_the_token_provided_in_the_authentication_header ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_query_param::it_should_not_authenticate_requests_when_the_token_is_invalid ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_query_param::it_should_not_authenticate_requests_when_the_token_is_empty ... ok +test server::v1::contract::context::stats::should_not_allow_getting_tracker_statistics_for_unauthenticated_users ... ok +test server::v1::contract::context::auth_key::should_not_allow_generating_a_new_auth_key_for_unauthenticated_users ... ok +test server::v1::contract::context::auth_key::should_reject_auth_key_requests_when_private_mode_is_disabled_without_database_access ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_authentication_header::it_should_not_authenticate_requests_when_the_token_is_empty ... ok +test server::v1::contract::context::auth_key::should_fail_generating_a_new_auth_key_when_the_provided_key_is_invalid ... ok +test server::v1::contract::context::stats::should_expose_an_enabled_zero_value_persisted_metric ... ok +test server::v1::contract::authentication::given_that_the_token_is_only_provided_in_the_query_param::it_should_allow_the_token_query_param_to_be_at_any_position_in_the_url_query ... ok +test server::v1::contract::context::auth_key::should_fail_deleting_an_auth_key_when_the_key_id_is_invalid ... ok +test server::v1::contract::context::torrent::should_allow_getting_a_list_of_torrents_providing_infohashes ... ok +test server::v1::contract::context::torrent::should_allow_getting_a_torrent_info ... ok +test server::v1::contract::context::torrent::should_allow_getting_all_torrents ... ok +test server::v1::contract::context::torrent::should_allow_limiting_the_torrents_in_the_result ... ok +2026-11-21T13:32:51.481974Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:35385 service_binding=http://127.0.0.1:35385/ request_id=110b8b66-ed6c-4864-ba43-2e689a0ec2fe +2026-11-21T13:32:51.482010Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:35385 service_binding=http://127.0.0.1:35385/ +2026-11-21T13:32:51.482519Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:44221 service_binding=http://127.0.0.1:44221/ request_id=470b56ca-37da-4882-b6f1-269a1750c2ac +2026-11-21T13:32:51.482530Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:44221 service_binding=http://127.0.0.1:44221/ +2026-11-21T13:32:51.488155Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:35385 service_binding=http://127.0.0.1:35385/ request_id=0d7ed52e-942f-412a-9916-a2ec38bf6303 +2026-11-21T13:32:51.488183Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:35385 service_binding=http://127.0.0.1:35385/ +2026-11-21T13:32:51.488155Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:44221 service_binding=http://127.0.0.1:44221/ request_id=92b5f27d-82f7-4aa2-a568-269c65725c24 +2026-11-21T13:32:51.488196Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:44221 service_binding=http://127.0.0.1:44221/ +2026-11-21T13:32:51.492676Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:43187 service_binding=http://127.0.0.1:43187/ request_id=3ff265b7-febb-477c-ac8f-a24f980cd157 +2026-11-21T13:32:51.492694Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:43187 service_binding=http://127.0.0.1:43187/ +2026-11-21T13:32:51.493439Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:34031 service_binding=http://127.0.0.1:34031/ request_id=94c49fa7-b4a5-4090-8a5c-6a7a7f04ee49 +2026-11-21T13:32:51.493449Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:34031 service_binding=http://127.0.0.1:34031/ +test server::v1::contract::context::whitelist::should_fail_when_the_torrent_cannot_be_removed_from_the_whitelist ... FAILED +2026-11-21T13:32:51.495003Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:36209 service_binding=http://127.0.0.1:36209/ request_id=941803b4-6c34-4c5d-9700-58764680718e +2026-11-21T13:32:51.495015Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:36209 service_binding=http://127.0.0.1:36209/ +2026-11-21T13:32:51.495213Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:43187 service_binding=http://127.0.0.1:43187/ request_id=8805e430-0b81-4684-9b2d-2fe3931440cb +2026-11-21T13:32:51.495222Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:43187 service_binding=http://127.0.0.1:43187/ +2026-11-21T13:32:51.498375Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:36209 service_binding=http://127.0.0.1:36209/ request_id=36e256c2-be2b-46f8-ba4d-83697aff30ee +2026-11-21T13:32:51.498385Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:36209 service_binding=http://127.0.0.1:36209/ +2026-11-21T13:32:51.499267Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:41209 service_binding=http://127.0.0.1:41209/ request_id=0fdfd869-4616-4bf7-9e77-8f2c71969072 +2026-11-21T13:32:51.499282Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:41209 service_binding=http://127.0.0.1:41209/ +2026-11-21T13:32:51.500281Z ERROR API: response latency_ms=0 status_code=500 Internal Server Error server_socket_addr=127.0.0.1:38057 service_binding=http://127.0.0.1:38057/ request_id=9c87fbfe-55d3-4170-9b54-7d87c409a2fa +2026-11-21T13:32:51.500294Z ERROR API: response failed failure_classification=Status code: 500 Internal Server Error latency=0 ms server_socket_addr=127.0.0.1:38057 service_binding=http://127.0.0.1:38057/ +test server::v1::contract::context::whitelist::should_fail_when_the_torrent_cannot_be_whitelisted ... FAILED +test server::v1::contract::context::whitelist::should_fail_when_the_whitelist_cannot_be_reloaded_from_the_database ... FAILED +test server::v1::contract::context::torrent::should_allow_the_torrents_result_pagination ... ok +test server::v1::contract::context::torrent::should_fail_getting_torrents_when_the_info_hash_parameter_is_invalid ... ok +test server::v1::contract::context::torrent::should_fail_getting_torrents_when_the_limit_query_parameter_cannot_be_parsed ... ok +test server::v1::contract::context::torrent::should_fail_getting_a_torrent_info_when_the_provided_infohash_is_invalid ... ok +test server::v1::contract::context::torrent::should_fail_getting_torrents_when_the_offset_query_parameter_cannot_be_parsed ... ok +test server::v1::contract::context::whitelist::should_allow_reload_the_whitelist_from_the_database ... ok +test server::v1::contract::context::torrent::should_fail_while_getting_a_torrent_info_when_the_torrent_does_not_exist ... ok +test server::v1::contract::context::torrent::should_not_allow_getting_torrents_for_unauthenticated_users ... ok +test server::v1::contract::context::torrent::should_include_equal_v1_peer_timestamp_fields_in_the_raw_torrent_json_response ... ok +test server::v1::contract::context::torrent::should_not_allow_getting_a_torrent_info_for_unauthenticated_users ... ok +test server::v1::contract::context::whitelist::should_reject_whitelist_requests_when_listed_mode_is_disabled_without_database_access ... ok +test server::v1::contract::context::whitelist::should_allow_whitelisting_a_torrent_that_has_been_already_whitelisted ... ok +test server::v1::contract::context::whitelist::should_not_allow_whitelisting_a_torrent_for_unauthenticated_users ... ok +test server::v1::contract::context::whitelist::should_allow_removing_a_torrent_from_the_whitelist ... ok +test server::v1::contract::context::whitelist::should_allow_whitelisting_a_torrent ... ok +test server::v1::contract::context::whitelist::should_not_fail_trying_to_remove_a_non_whitelisted_torrent_from_the_whitelist ... ok +test server::v1::contract::context::whitelist::should_not_allow_removing_a_torrent_from_the_whitelist_for_unauthenticated_users ... ok +test server::v1::contract::context::whitelist::should_fail_removing_a_torrent_from_the_whitelist_when_the_provided_infohash_is_invalid ... ok +test server::v1::contract::context::whitelist::should_fail_whitelisting_a_torrent_when_the_provided_infohash_is_invalid ... ok + +failures: + +---- server::v1::contract::context::auth_key::should_fail_without_a_source_path_when_the_same_auth_key_is_uploaded_twice stdout ---- + +thread 'server::v1::contract::context::auth_key::should_fail_without_a_source_path_when_the_same_auth_key_is_uploaded_twice' panicked at packages/axum-rest-api-server/tests/server/v1/asserts.rs:180:5: +the error message must not hold a source path, but it contains ".rs:": "Unhandled rejection: Err { reason: \"failed to add key: The Sqlite3 query was malformed: error returned from database: (code: 2067) UNIQUE constraint failed: keys.key, packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs:74:22, packages/tracker-core/src/authentication/handler.rs:103:50\" }" +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + +---- server::v1::contract::context::auth_key::deprecated_generate_key_endpoint::should_fail_when_the_auth_key_cannot_be_generated stdout ---- + +thread 'server::v1::contract::context::auth_key::deprecated_generate_key_endpoint::should_fail_when_the_auth_key_cannot_be_generated' panicked at packages/axum-rest-api-server/tests/server/v1/asserts.rs:180:5: +the error message must not hold a source path, but it contains ".rs:": "Unhandled rejection: Err { reason: \"failed to generate key: The Sqlite3 query was malformed: error returned from database: (code: 1) no such table: keys, packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs:74:22\" }" + +---- server::v1::contract::context::auth_key::should_fail_without_a_source_path_when_the_auth_key_to_delete_does_not_exist stdout ---- + +thread 'server::v1::contract::context::auth_key::should_fail_without_a_source_path_when_the_auth_key_to_delete_does_not_exist' panicked at packages/axum-rest-api-server/tests/server/v1/asserts.rs:180:5: +the error message must not hold a source path, but it contains ".rs:": "Unhandled rejection: Err { reason: \"failed to delete key: Failed to remove record from Sqlite3 database, error-code: 0, packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs:108:27\" }" + +---- server::v1::contract::context::auth_key::should_fail_when_the_auth_key_cannot_be_generated stdout ---- + +thread 'server::v1::contract::context::auth_key::should_fail_when_the_auth_key_cannot_be_generated' panicked at packages/axum-rest-api-server/tests/server/v1/asserts.rs:180:5: +the error message must not hold a source path, but it contains ".rs:": "Unhandled rejection: Err { reason: \"failed to add key: The Sqlite3 query was malformed: error returned from database: (code: 1) no such table: keys, packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs:74:22, packages/tracker-core/src/authentication/handler.rs:141:46\" }" + +---- server::v1::contract::context::auth_key::should_fail_when_keys_cannot_be_reloaded stdout ---- + +thread 'server::v1::contract::context::auth_key::should_fail_when_keys_cannot_be_reloaded' panicked at packages/axum-rest-api-server/tests/server/v1/asserts.rs:180:5: +the error message must not hold a source path, but it contains ".rs:": "Unhandled rejection: Err { reason: \"failed to reload keys: The Sqlite3 query was malformed: error returned from database: (code: 1) no such table: keys, packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs:15:20\" }" + +---- server::v1::contract::context::auth_key::should_fail_when_the_auth_key_cannot_be_deleted stdout ---- + +thread 'server::v1::contract::context::auth_key::should_fail_when_the_auth_key_cannot_be_deleted' panicked at packages/axum-rest-api-server/tests/server/v1/asserts.rs:180:5: +the error message must not hold a source path, but it contains ".rs:": "Unhandled rejection: Err { reason: \"failed to delete key: The Sqlite3 query was malformed: error returned from database: (code: 1) no such table: keys, packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs:96:23\" }" + +---- server::v1::contract::context::whitelist::should_fail_when_the_torrent_cannot_be_removed_from_the_whitelist stdout ---- + +thread 'server::v1::contract::context::whitelist::should_fail_when_the_torrent_cannot_be_removed_from_the_whitelist' panicked at packages/axum-rest-api-server/tests/server/v1/asserts.rs:180:5: +the error message must not hold a source path, but it contains ".rs:": "Unhandled rejection: Err { reason: \"failed to remove torrent from whitelist: The Sqlite3 query was malformed: error returned from database: (code: 1) no such table: whitelist, packages/tracker-core/src/databases/driver/sqlite/whitelist_store.rs:32:25\" }" + +---- server::v1::contract::context::whitelist::should_fail_when_the_torrent_cannot_be_whitelisted stdout ---- + +thread 'server::v1::contract::context::whitelist::should_fail_when_the_torrent_cannot_be_whitelisted' panicked at packages/axum-rest-api-server/tests/server/v1/asserts.rs:180:5: +the error message must not hold a source path, but it contains ".rs:": "Unhandled rejection: Err { reason: \"failed to whitelist torrent: The Sqlite3 query was malformed: error returned from database: (code: 1) no such table: whitelist, packages/tracker-core/src/databases/driver/sqlite/whitelist_store.rs:32:25\" }" + +---- server::v1::contract::context::whitelist::should_fail_when_the_whitelist_cannot_be_reloaded_from_the_database stdout ---- + +thread 'server::v1::contract::context::whitelist::should_fail_when_the_whitelist_cannot_be_reloaded_from_the_database' panicked at packages/axum-rest-api-server/tests/server/v1/asserts.rs:180:5: +the error message must not hold a source path, but it contains ".rs:": "Unhandled rejection: Err { reason: \"failed to reload whitelist: The Sqlite3 query was malformed: error returned from database: (code: 1) no such table: whitelist, packages/tracker-core/src/databases/driver/sqlite/whitelist_store.rs:15:20\" }" + + +failures: + server::v1::contract::context::auth_key::deprecated_generate_key_endpoint::should_fail_when_the_auth_key_cannot_be_generated + server::v1::contract::context::auth_key::should_fail_when_keys_cannot_be_reloaded + server::v1::contract::context::auth_key::should_fail_when_the_auth_key_cannot_be_deleted + server::v1::contract::context::auth_key::should_fail_when_the_auth_key_cannot_be_generated + server::v1::contract::context::auth_key::should_fail_without_a_source_path_when_the_auth_key_to_delete_does_not_exist + server::v1::contract::context::auth_key::should_fail_without_a_source_path_when_the_same_auth_key_is_uploaded_twice + server::v1::contract::context::whitelist::should_fail_when_the_torrent_cannot_be_removed_from_the_whitelist + server::v1::contract::context::whitelist::should_fail_when_the_torrent_cannot_be_whitelisted + server::v1::contract::context::whitelist::should_fail_when_the_whitelist_cannot_be_reloaded_from_the_database + +test result: FAILED. 51 passed; 9 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.45s + +error: test failed, to rerun pass `-p torrust-tracker-axum-rest-api-server --test integration` diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-tracker-core.txt b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-tracker-core.txt new file mode 100644 index 0000000000..549ad4415b --- /dev/null +++ b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-tracker-core.txt @@ -0,0 +1,216 @@ + Finished `test` profile [optimized + debuginfo] target(s) in 0.18s + Running unittests src/lib.rs (target/debug/build/torrust-tracker-core/d6b78cd3a90cd77f/out/torrust_tracker_core-d6b78cd3a90cd77f) + +running 160 tests +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_client_ip_is_a_ipv6_loopback_ip::it_should_use_the_loopback_ip_if_the_tracker_does_not_have_the_external_ip_configuration ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_client_ip_is_a_ipv6_loopback_ip::it_should_use_the_external_ip_in_tracker_configuration_if_it_is_defined ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_client_ip_is_a_ipv4_loopback_ip::it_should_use_the_external_ip_in_the_tracker_configuration_if_it_is_defined_even_if_the_external_ip_is_an_ipv6_ip ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_client_ip_is_a_ipv6_loopback_ip::it_should_use_the_external_ip_in_the_tracker_configuration_if_it_is_defined_even_if_the_external_ip_is_an_ipv4_ip ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_client_ip_is_a_ipv4_loopback_ip::it_should_use_the_external_tracker_ip_in_tracker_configuration_if_it_is_defined ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_client_ip_is_a_ipv4_loopback_ip::it_should_use_the_loopback_ip_if_the_tracker_does_not_have_the_external_ip_configuration ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_external_ip_is_unspecified::it_should_keep_the_ipv4_loopback_ip_when_the_external_ip_is_the_unspecified_ipv4_address ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_external_ip_is_unspecified::it_should_keep_the_ipv6_loopback_ip_when_the_external_ip_is_the_unspecified_ipv4_address ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_external_ip_is_unspecified::it_should_keep_the_ipv4_loopback_ip_when_the_external_ip_is_the_unspecified_ipv6_address ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_external_ip_is_unspecified::it_should_keep_the_ipv6_loopback_ip_when_the_external_ip_is_the_unspecified_ipv6_address ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_external_ip_is_unspecified::it_should_keep_the_non_loopback_ip_when_the_external_ip_is_unspecified_ipv4 ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::and_when_the_external_ip_is_unspecified::it_should_keep_the_non_loopback_ip_when_the_external_ip_is_unspecified_ipv6 ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_allow_limiting_the_peer_list ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_cap_only_peers_wanted_at_limit_time ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::should_assign_the_ip_to_the_peer::using_the_source_ip_instead_of_the_ip_in_the_announce_request ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_convert_the_peers_wanted_number_from_i32_via_from_client_request ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_return_74_at_the_most_if_the_client_wants_them_all ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_return_the_maximin_number_of_peers_by_default ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_return_the_maximum_when_wanting_more_than_the_maximum ... ok +test announce_handler::tests::the_announce_handler::should_allow_the_client_peers_to_specified_the_number_of_peers_wanted::it_should_return_zero_when_wanting_only_zero ... ok +test authentication::key::peer_key::tests::key::length_should_be_32 ... ok +test authentication::key::peer_key::tests::key::should_only_include_alphanumeric_chars ... ok +test authentication::key::peer_key::tests::key::should_be_parsed_from_an_string ... ok +test authentication::key::peer_key::tests::key::should_return_a_reference_to_the_inner_string ... ok +test authentication::key::peer_key::tests::key::should_be_generated_randomly ... ok +test authentication::key::peer_key::tests::peer_key::could_be_permanent ... ok +test authentication::key::peer_key::tests::peer_key::could_have_an_expiration_time ... ok +test authentication::key::peer_key::tests::peer_key::expiring::should_be_displayed_when_it_is_expiring ... ok +test authentication::key::peer_key::tests::peer_key::permanent::should_be_displayed_when_it_is_permanent ... ok +test authentication::key::tests::the_expiring_peer_key::expiration_verification_should_fail_when_the_key_has_expired ... ok +test authentication::key::tests::the_expiring_peer_key::should_be_displayed ... ok +test authentication::key::tests::the_expiring_peer_key::should_be_generated_with_a_expiration_time ... ok +test authentication::key::tests::the_key_verification_error::could_be_a_database_error ... ok +test authentication::key::tests::the_permanent_peer_key::expiration_verification_should_always_succeed ... ok +test authentication::key::tests::the_permanent_peer_key::should_be_displayed ... ok +test authentication::key::tests::the_permanent_peer_key::should_be_generated_without_expiration_time ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::randomly_generated::it_should_fail_adding_a_randomly_generated_key_when_there_is_a_database_error ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::pre_generated::it_should_fail_adding_a_pre_generated_key_when_there_is_a_database_error ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_not_authenticate_a_registered_but_expired_key_by_default ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_authenticate_a_registered_key ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_reject_an_unregistered_key_with_a_message_that_holds_no_source_path ... FAILED +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_reject_an_expired_key_with_a_message_that_holds_no_source_path ... FAILED +test authentication::service::tests::the_authentication_service::when_the_tracker_is_public::it_should_always_authenticate_when_the_tracker_is_public ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_not_authenticate_an_unregistered_key ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_not_authenticate_a_registered_but_expired_key_when_the_tracker_is_explicitly_configured_to_check_keys_expiration ... ok +test authentication::key::repository::in_memory::tests::the_in_memory_key_repository_should::remove_a_new_peer_key ... ok +test authentication::key::repository::in_memory::tests::the_in_memory_key_repository_should::reset_the_peer_keys_with_a_new_list_of_keys ... ok +test authentication::key::repository::in_memory::tests::the_in_memory_key_repository_should::clear_all_peer_keys ... ok +test authentication::key::repository::in_memory::tests::the_in_memory_key_repository_should::insert_a_new_peer_key ... ok +test authentication::service::tests::the_authentication_service::when_the_tracker_is_private::but_the_key_expiration_check_is_disabled_by_configuration::it_should_authenticate_an_expired_registered_key ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_permanent_peer_keys::pre_generated_keys::it_should_fail_adding_a_pre_generated_key_when_there_is_a_database_error ... ok +test authentication::key::repository::in_memory::tests::the_in_memory_key_repository_should::get_a_new_peer_key_by_its_internal_key ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_permanent_peer_keys::randomly_generated::it_should_fail_adding_a_randomly_generated_key_when_there_is_a_database_error ... ok +test container::tests::it_should_return_a_typed_error_when_persistent_statistics_lack_persistence ... ok +test container::tests::it_should_construct_a_tracker_core_container_without_persistence ... ok +test databases::driver::sqlite::schema_migrator::tests::bootstrap_legacy_schema_should_be_a_noop_on_a_fresh_database ... ok +test databases::driver::sqlite::schema_migrator::tests::bootstrap_legacy_schema_should_reject_partial_legacy_state ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::it_should_allow_peers_to_get_only_a_subset_of_the_peers_in_the_swarm ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_permanent_peer_keys::pre_generated_keys::it_should_fail_adding_a_pre_generated_key_when_the_key_is_invalid ... ok +test databases::error::tests::it_should_build_a_database_error_from_a_sqlx_io_error ... ok +test databases::error::tests::it_should_build_a_database_error_from_a_sqlx_row_not_found_error ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::it_should_update_the_swarm_stats_for_the_torrent::when_the_peer_is_a_leecher ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::it_should_return_the_announce_data_with_an_empty_peer_list_when_it_is_the_first_announced_peer ... ok +test error::tests::peer_key_error::duration_overflow ... ok +test error::tests::peer_key_error::parsing_from_string ... ok +test error::tests::peer_key_error::persisting_into_database ... ok +test error::tests::whitelist_error::torrent_not_whitelisted ... ok +test peer_tests::it_should_be_serializable ... ok +test scrape_handler::tests::it_should_allow_scraping_for_multiple_torrents ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::pre_generated::it_should_fail_adding_a_pre_generated_key_when_the_key_duration_exceeds_the_maximum_duration ... ok +test scrape_handler::tests::it_should_fail_when_loading_the_persisted_downloads_fails ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::peer_key_errors::it_should_fail_without_a_source_path_when_the_key_is_invalid ... FAILED +test scrape_handler::tests::it_should_report_an_in_memory_swarm_without_reading_the_persisted_downloads ... ok +test scrape_handler::tests::it_should_load_the_persisted_downloads_of_all_torrents_absent_from_memory_in_one_query ... ok +test scrape_handler::tests::it_should_look_up_a_repeated_info_hash_absent_from_memory_only_once ... ok +test scrape_handler::tests::it_should_report_every_requested_torrent_without_a_limit_on_the_number_of_info_hashes ... ok +test statistics::event::handler::tests::it_should_increment_in_memory_completion_metrics_when_a_peer_download_is_completed ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::it_should_update_the_swarm_stats_for_the_torrent::when_a_previously_announced_started_peer_has_completed_downloading ... ok +test scrape_handler::tests::it_should_return_a_zeroed_swarm_metadata_for_the_requested_file_if_the_tracker_does_not_have_that_torrent ... ok +test statistics::event::handler::tests::it_should_persist_global_completion_statistics_when_torrent_persistence_fails ... ok +test statistics::event::listener::tests::it_should_continue_after_lag_then_handle_an_event_then_stop_when_the_in_memory_receiver_is_closed ... ok +test statistics::event::handler::tests::it_should_not_increment_in_memory_completion_metrics_when_an_event_is_not_a_completion ... ok +test statistics::event::listener::tests::it_should_handle_a_queued_event_then_return_cancelled_when_cancellation_is_already_pending ... ok +test statistics::event::listener::tests::it_should_handle_an_event_then_stop_when_the_in_memory_receiver_is_closed ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::it_should_update_the_swarm_stats_for_the_torrent::when_the_peer_is_a_seeder ... ok +test statistics::event::listener::tests::it_should_leave_the_queued_event_unprocessed_and_return_cancelled_when_the_drain_timeout_has_expired ... ok +test announce_handler::tests::the_announce_handler::for_all_tracker_config_modes::handling_an_announce_request::it_should_return_the_announce_data_with_the_previously_announced_peers ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::it_should_generate_the_key ... ok +test statistics::event::listener::tests::it_should_stop_when_the_in_memory_receiver_is_closed ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_permanent_peer_keys::randomly_generated::it_should_generate_the_key ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_permanent_peer_keys::pre_generated_keys::it_should_add_a_pre_generated_key ... ok +test authentication::key::repository::persisted::tests::the_persisted_key_repository_should::load_all_persisted_peer_keys ... ok +test authentication::key::repository::persisted::tests::the_persisted_key_repository_should::remove_a_persisted_peer_key ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::pre_generated::it_should_fail_adding_a_pre_generated_key_when_the_key_is_invalid ... ok +test statistics::repository::tests::it_should_export_persisted_metric_with_zero_value_when_persisted_completed_statistics_are_enabled ... ok +test statistics::repository::tests::it_should_omit_persisted_metric_when_persisted_completed_statistics_are_disabled ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::pre_generated::it_should_add_a_pre_generated_key ... ok +test authentication::tests::the_tracker_configured_as_private::with_expiring_and::randomly_generated_keys::it_should_authenticate_a_peer_with_the_key ... ok +test authentication::tests::the_tracker_configured_as_private::with_permanent_and::pre_generated_keys::it_should_authenticate_a_peer_with_the_key ... ok +test authentication::tests::the_tracker_configured_as_private::it_should_remove_an_authentication_key ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::peer_key_errors::it_should_fail_without_a_source_path_when_the_database_rejects_a_duplicate_key ... FAILED +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_expiring_peer_keys::randomly_generated::it_should_add_a_randomly_generated_key ... ok +test torrent::services::tests::getting_a_torrent_info::it_should_return_none_if_the_tracker_does_not_have_the_torrent ... ok +test authentication::tests::the_tracker_configured_as_private::with_expiring_and::randomly_generated_keys::it_should_accept_an_expired_key_when_checking_expiration_is_disabled_in_configuration ... ok +test torrent::services::tests::getting_a_torrent_info::it_should_return_the_torrent_info_if_the_tracker_has_the_torrent ... ok +test torrent::services::tests::getting_basic_torrent_info_for_multiple_torrents_at_once::it_should_return_a_list_with_basic_info_about_the_requested_torrents ... ok +test torrent::services::tests::getting_basic_torrent_info_for_multiple_torrents_at_once::it_should_return_an_empty_list_if_none_of_the_requested_torrents_is_found ... ok +test torrent::services::tests::searching_for_torrents::it_should_allow_limiting_the_number_of_torrents_in_the_result ... ok +test torrent::services::tests::searching_for_torrents::it_should_allow_using_pagination_in_the_result ... ok +test torrent::services::tests::searching_for_torrents::it_should_return_a_summarized_info_for_all_torrents ... ok +test torrent::services::tests::searching_for_torrents::it_should_return_an_empty_result_if_the_tracker_does_not_have_any_torrent ... ok +test torrent::services::tests::searching_for_torrents::it_should_return_torrents_ordered_by_info_hash ... ok +test whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_configured_as_listed::should_authorize_a_whitelisted_infohash ... ok +test whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_configured_as_listed::should_not_authorize_a_non_whitelisted_infohash ... ok +test whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_not_configured_as_listed::should_also_authorize_a_non_whitelisted_infohash ... ok +test whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_not_configured_as_listed::should_authorize_a_whitelisted_infohash ... ok +test authentication::tests::the_tracker_configured_as_private::with_expiring_and::pre_generated_keys::it_should_authenticate_a_peer_with_the_key ... ok +test authentication::tests::the_tracker_configured_as_private::it_should_load_authentication_keys_from_the_database ... ok +test whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_configured_as_listed::should_reject_a_non_whitelisted_infohash_with_a_message_that_names_it_and_holds_no_source_path ... FAILED +test whitelist::repository::in_memory::tests::should_allow_adding_a_new_torrent_to_the_whitelist ... ok +test whitelist::repository::in_memory::tests::should_allow_checking_if_an_infohash_is_whitelisted ... ok +test whitelist::repository::in_memory::tests::should_allow_clearing_the_whitelist ... ok +test whitelist::repository::in_memory::tests::should_allow_removing_a_new_torrent_to_the_whitelist ... ok +test authentication::tests::the_tracker_configured_as_private::with_expiring_and::pre_generated_keys::it_should_accept_an_expired_key_when_checking_expiration_is_disabled_in_configuration ... ok +test authentication::tests::the_tracker_configured_as_private::with_permanent_and::randomly_generated_keys::it_should_authenticate_a_peer_with_the_key ... ok +test authentication::key::repository::persisted::tests::the_persisted_key_repository_should::persist_a_new_peer_key ... ok +test authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::handling_permanent_peer_keys::randomly_generated::it_should_add_a_randomly_generated_key ... ok +test container::tests::it_should_construct_a_tracker_core_container_with_supplied_persistence ... ok +test container::tests::it_should_load_persistent_completed_statistics_when_a_torrent_is_first_announced ... ok +test databases::setup::tests::it_should_initialize_the_sqlite_database ... ok +test databases::driver::sqlite::schema_migrator::tests::bootstrap_legacy_schema_should_seed_history_when_all_legacy_tables_exist ... ok +test statistics::event::handler::tests::it_should_not_persist_completion_statistics_when_an_event_is_not_a_completion ... ok +test torrent::manager::tests::cleaning_torrents::it_should_retain_peerless_torrents_when_it_is_configured_to_do_so ... ok +test tests::the_tracker::for_all_config_modes::handling_a_scrape_request::it_should_return_the_swarm_metadata_for_the_requested_file_if_the_tracker_has_that_torrent ... ok +test statistics::event::listener::tests::it_should_handle_an_event_then_stop_when_the_persistent_receiver_is_closed ... ok +test torrent::manager::tests::cleaning_torrents::it_should_remove_peers_that_have_not_been_updated_after_a_cutoff_time ... ok +test tests::the_tracker::configured_as_whitelisted::handling_a_scrape_request::it_should_return_the_zeroed_swarm_metadata_for_the_requested_file_if_it_is_not_whitelisted ... ok +test statistics::event::listener::tests::it_should_stop_when_the_persistent_receiver_is_closed ... ok +test torrent::manager::tests::cleaning_torrents::it_should_remove_torrents_that_have_no_peers_when_it_is_configured_to_do_so ... ok +test statistics::event::listener::tests::it_should_leave_the_queued_events_unprocessed_and_return_cancelled_when_the_drain_timeout_has_expired ... ok +test databases::driver::sqlite::tests::create_database_tables_should_be_idempotent_on_a_fresh_database ... ok +test statistics::event::listener::tests::it_should_continue_after_lag_then_handle_an_event_then_stop_when_the_persistent_receiver_is_closed ... ok +test statistics::persisted::downloads::tests::it_increases_the_numbers_of_downloads_for_a_torrent_into_the_database ... ok +test statistics::persisted::downloads::tests::it_loads_the_numbers_of_downloads_for_all_torrents_from_the_database ... ok +test statistics::event::listener::tests::it_should_persist_a_queued_completed_download_when_cancellation_is_already_pending ... ok +test statistics::persisted::downloads::tests::it_saves_the_numbers_of_downloads_for_a_torrent_into_the_database ... ok +test statistics::event::handler::tests::it_should_persist_completion_statistics_when_a_peer_download_is_completed ... ok +test whitelist::repository::persisted::tests::the_persisted_whitelist_repository::should_load_all_infohashes_from_the_database ... ok +test statistics::event::listener::tests::it_should_persist_every_queued_event_then_return_cancelled_when_cancellation_is_already_pending ... ok +test whitelist::repository::persisted::tests::the_persisted_whitelist_repository::should_not_fail_removing_an_infohash_that_is_not_in_the_list ... ok +test whitelist::repository::persisted::tests::the_persisted_whitelist_repository::should_not_add_the_same_infohash_to_the_list_twice ... ok +test whitelist::repository::persisted::tests::the_persisted_whitelist_repository::should_add_a_new_infohash_to_the_list ... ok +test torrent::manager::tests::it_should_load_the_numbers_of_downloads_for_all_torrents_from_the_database ... ok +test whitelist::repository::persisted::tests::the_persisted_whitelist_repository::should_remove_a_infohash_from_the_list ... ok +test whitelist::tests::configured_as_whitelisted::handling_authorization::it_should_not_authorize_the_announce_and_scrape_actions_on_not_whitelisted_torrents ... ok +test whitelist::manager::tests::configured_as_whitelisted::handling_the_torrent_whitelist::persistence::it_should_load_the_whitelist_from_the_database ... ok +test whitelist::manager::tests::configured_as_whitelisted::handling_the_torrent_whitelist::it_should_add_a_torrent_to_the_whitelist ... ok +test whitelist::tests::configured_as_whitelisted::handling_authorization::it_should_authorize_the_announce_and_scrape_actions_on_whitelisted_torrents ... ok +test whitelist::manager::tests::configured_as_whitelisted::handling_the_torrent_whitelist::it_should_remove_a_torrent_from_the_whitelist ... ok +test databases::driver::sqlite::tests::run_sqlite_driver_tests ... FAILED + +failures: + +---- authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_reject_an_unregistered_key_with_a_message_that_holds_no_source_path stdout ---- + +thread 'authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_reject_an_unregistered_key_with_a_message_that_holds_no_source_path' panicked at packages/tracker-core/src/authentication/service.rs:221:17: +assertion `left == right` failed + left: "Failed to read key: YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ, packages/tracker-core/src/authentication/service.rs:98:27" + right: "Failed to read key: YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ" + +---- authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_reject_an_expired_key_with_a_message_that_holds_no_source_path stdout ---- + +thread 'authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_reject_an_expired_key_with_a_message_that_holds_no_source_path' panicked at packages/tracker-core/src/authentication/service.rs:244:17: +assertion `left == right` failed + left: "Key has expired, packages/tracker-core/src/authentication/key/mod.rs:158:31" + right: "Key has expired" +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + +---- authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::peer_key_errors::it_should_fail_without_a_source_path_when_the_key_is_invalid stdout ---- + +thread 'authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::peer_key_errors::it_should_fail_without_a_source_path_when_the_key_is_invalid' panicked at packages/tracker-core/src/authentication/handler.rs:748:17: +the error message must not hold a source path, but it contains ".rs:": "Invalid key length. Key must be have 32 chars, packages/tracker-core/src/authentication/handler.rs:125:46" + +---- authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::peer_key_errors::it_should_fail_without_a_source_path_when_the_database_rejects_a_duplicate_key stdout ---- + +thread 'authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::peer_key_errors::it_should_fail_without_a_source_path_when_the_database_rejects_a_duplicate_key' panicked at packages/tracker-core/src/authentication/handler.rs:735:17: +the error message must not hold a source path, but it contains ".rs:": "Can't persist key: The Sqlite3 query was malformed: error returned from database: (code: 2067) UNIQUE constraint failed: keys.key, packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs:74:22, packages/tracker-core/src/authentication/handler.rs:120:50" + +---- whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_configured_as_listed::should_reject_a_non_whitelisted_infohash_with_a_message_that_names_it_and_holds_no_source_path stdout ---- + +thread 'whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_configured_as_listed::should_reject_a_non_whitelisted_infohash_with_a_message_that_names_it_and_holds_no_source_path' panicked at packages/tracker-core/src/whitelist/authorization.rs:148:17: +assertion `left == right` failed + left: "The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted, packages/tracker-core/src/whitelist/authorization.rs:61:23" + right: "The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted" + +---- databases::driver::sqlite::tests::run_sqlite_driver_tests stdout ---- + +thread 'databases::driver::sqlite::tests::run_sqlite_driver_tests' panicked at packages/tracker-core/src/databases/driver/mod.rs:280:13: +the error message must not hold a source path, but it contains ".rs:": "The Sqlite3 query was malformed: error returned from database: (code: 2067) UNIQUE constraint failed: keys.key, packages/tracker-core/src/databases/driver/sqlite/auth_key_store.rs:74:22" + + +failures: + authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::peer_key_errors::it_should_fail_without_a_source_path_when_the_database_rejects_a_duplicate_key + authentication::handler::tests::the_keys_handler_when_the_tracker_is_configured_as_private::peer_key_errors::it_should_fail_without_a_source_path_when_the_key_is_invalid + authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_reject_an_expired_key_with_a_message_that_holds_no_source_path + authentication::service::tests::the_authentication_service::when_the_tracker_is_private::it_should_reject_an_unregistered_key_with_a_message_that_holds_no_source_path + databases::driver::sqlite::tests::run_sqlite_driver_tests + whitelist::authorization::tests::the_whitelist_authorization_for_announce_and_scrape_actions::when_the_tacker_is_configured_as_listed::should_reject_a_non_whitelisted_infohash_with_a_message_that_names_it_and_holds_no_source_path + +test result: FAILED. 154 passed; 6 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.13s + +error: test failed, to rerun pass `-p torrust-tracker-core --lib` diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-udp-server-integration.txt b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-udp-server-integration.txt new file mode 100644 index 0000000000..37364bb354 --- /dev/null +++ b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-udp-server-integration.txt @@ -0,0 +1,62 @@ + Finished `test` profile [optimized + debuginfo] target(s) in 0.17s + Running tests/integration.rs (target/debug/build/torrust-tracker-udp-server/39c10e4ee6f5be3c/out/integration-39c10e4ee6f5be3c) + +running 17 tests +2026-11-21T13:32:58.505404Z WARN UDP TRACKER: UDP connection ID validation is DISABLED for this listener. Anti-spoofing and replay protection are reduced. Ensure this listener is isolated through external network controls. bind_to=127.0.0.1:35900 +2026-11-21T13:32:58.506311Z WARN UDP TRACKER: UDP connection ID validation is DISABLED for this listener. Anti-spoofing and replay protection are reduced. Ensure this listener is isolated through external network controls. bind_to=127.0.0.1:46229 +2026-11-21T13:32:58.506976Z ERROR torrust_tracker_core::whitelist::authorization: error=The torrent: af0935008ed1f224d482116262d1d52eb8bfb999, is not whitelisted, packages/tracker-core/src/whitelist/authorization.rs:61:23 +2026-11-21T13:32:58.506988Z ERROR UDP TRACKER: response error error=tracker announce error: Tracker core whitelist error: The torrent: af0935008ed1f224d482116262d1d52eb8bfb999, is not whitelisted, packages/tracker-core/src/whitelist/authorization.rs:61:23 client_socket_addr=127.0.0.1:52438 server_socket_addr=127.0.0.1:40703 service_binding=udp://127.0.0.1:40703 request_id=e26363aa-f162-4994-9afb-59470afc11c2 transaction_id=123 +2026-11-21T13:32:58.507044Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is from future: 1627530203481512300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected < 1795267979.5070276 client_socket_addr=127.0.0.1:52323 server_socket_addr=127.0.0.1:36331 service_binding=udp://127.0.0.1:36331 request_id=2b5f2888-0b0f-4b20-b0c9-b335e4d4592f transaction_id=0 +2026-11-21T13:32:58.507993Z WARN UDP TRACKER: UDP connection ID validation is DISABLED for this listener. Anti-spoofing and replay protection are reduced. Ensure this listener is isolated through external network controls. bind_to=127.0.0.1:38110 +2026-11-21T13:32:58.509081Z WARN UDP TRACKER: UDP connection ID validation is DISABLED for this listener. Anti-spoofing and replay protection are reduced. Ensure this listener is isolated through external network controls. bind_to=127.0.0.1:55708 +2026-11-21T13:32:58.510393Z WARN UDP TRACKER: UDP connection ID validation is DISABLED for this listener. Anti-spoofing and replay protection are reduced. Ensure this listener is isolated through external network controls. bind_to=127.0.0.1:41327 +2026-11-21T13:32:58.513739Z ERROR UDP TRACKER: response error error=error parsing request: SendableRequestParseError { message: "Protocol identifier missing", opt_connection_id: None, opt_transaction_id: None } client_socket_addr=127.0.0.1:46419 server_socket_addr=127.0.0.1:57333 service_binding=udp://127.0.0.1:57333 request_id=1644da82-7981-4d5a-bab0-0621fb140cfc +2026-11-21T13:32:58.513751Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000001626869489059323, expected > 1795267857.513744 client_socket_addr=127.0.0.1:58652 server_socket_addr=127.0.0.1:43790 service_binding=udp://127.0.0.1:43790 request_id=67ddee8e-0a86-4626-b4fe-636a3e85582b transaction_id=0 +2026-11-21T13:32:58.515632Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -137241603156102090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795267857.5156248 client_socket_addr=127.0.0.1:44807 server_socket_addr=127.0.0.1:52052 service_binding=udp://127.0.0.1:52052 request_id=b3b017da-8a76-4371-8c88-5921ec2cebd4 transaction_id=1182011394 +2026-11-21T13:32:58.516833Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is from future: 1627530203481512300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected < 1795267979.5168245 client_socket_addr=127.0.0.1:52323 server_socket_addr=127.0.0.1:36331 service_binding=udp://127.0.0.1:36331 request_id=cbf32523-c862-4d3e-969b-c0bd70388066 transaction_id=1 +test server::contract::receiving_an_scrape_request::should_return_a_scrape_response ... ok +test server::contract::receiving_a_connection_request::should_return_a_connect_response ... ok +test server::contract::receiving_an_announce_request::should_reject_a_torrent_that_is_not_whitelisted_with_a_message_that_holds_no_source_path ... FAILED +2026-11-21T13:32:58.520537Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000001626869489059323, expected > 1795267857.520531 client_socket_addr=127.0.0.1:58652 server_socket_addr=127.0.0.1:43790 service_binding=udp://127.0.0.1:43790 request_id=e1f8fbda-1317-453f-a808-8ff921e907f9 transaction_id=1 +2026-11-21T13:32:58.525676Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: 0.000000000000000000000000000000000000000000000000000000000000000000000000000001626869489059323, expected > 1795267857.5256708 client_socket_addr=127.0.0.1:58652 server_socket_addr=127.0.0.1:43790 service_binding=udp://127.0.0.1:43790 request_id=9a4c0277-bbd0-400e-aa01-3ba83661a067 transaction_id=2 +2026-11-21T13:32:58.529924Z WARN UDP TRACKER: UDP connection ID validation is DISABLED for this listener. Anti-spoofing and replay protection are reduced. Ensure this listener is isolated through external network controls. bind_to=127.0.0.1:35501 +2026-11-21T13:32:58.530116Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -137241603156102090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795267857.5301106 client_socket_addr=127.0.0.1:44807 server_socket_addr=127.0.0.1:52052 service_binding=udp://127.0.0.1:52052 request_id=bf637770-98e2-439d-89aa-092dbeef2a03 transaction_id=937891778 +2026-11-21T13:32:58.530206Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -137241603156102090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795267857.5302038 client_socket_addr=127.0.0.1:44807 server_socket_addr=127.0.0.1:52052 service_binding=udp://127.0.0.1:52052 request_id=c0d7ff75-6e6a-46b5-b846-991c14967c34 transaction_id=-586502872 +2026-11-21T13:32:58.530260Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -137241603156102090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795267857.5302591 client_socket_addr=127.0.0.1:44807 server_socket_addr=127.0.0.1:52052 service_binding=udp://127.0.0.1:52052 request_id=7ff8ddeb-91a6-4353-b962-e5ae06356a6e transaction_id=-2058342829 +2026-11-21T13:32:58.530310Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -137241603156102090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795267857.5303087 client_socket_addr=127.0.0.1:44807 server_socket_addr=127.0.0.1:52052 service_binding=udp://127.0.0.1:52052 request_id=b983f145-4237-454e-a051-651d415969f3 transaction_id=1248991869 +2026-11-21T13:32:58.530355Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -137241603156102090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795267857.5303538 client_socket_addr=127.0.0.1:44807 server_socket_addr=127.0.0.1:52052 service_binding=udp://127.0.0.1:52052 request_id=3e3861b6-3466-422e-a26c-3d4b9109b870 transaction_id=-1869336161 +2026-11-21T13:32:58.530399Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -137241603156102090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795267857.5303977 client_socket_addr=127.0.0.1:44807 server_socket_addr=127.0.0.1:52052 service_binding=udp://127.0.0.1:52052 request_id=7078f17d-2de5-4ca2-8b63-fe7a32ef8697 transaction_id=890167046 +2026-11-21T13:32:58.530443Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -137241603156102090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795267857.5304418 client_socket_addr=127.0.0.1:44807 server_socket_addr=127.0.0.1:52052 service_binding=udp://127.0.0.1:52052 request_id=9040d88c-8cd8-46b2-ba35-6995e00f76f2 transaction_id=-1191909471 +2026-11-21T13:32:58.530487Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -137241603156102090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795267857.5304863 client_socket_addr=127.0.0.1:44807 server_socket_addr=127.0.0.1:52052 service_binding=udp://127.0.0.1:52052 request_id=48a2bc2b-e7e3-4daf-854b-aaf3b0081639 transaction_id=-1983331901 +2026-11-21T13:32:58.530535Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -137241603156102090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795267857.5305336 client_socket_addr=127.0.0.1:44807 server_socket_addr=127.0.0.1:52052 service_binding=udp://127.0.0.1:52052 request_id=4dcc015d-590b-46bb-8a06-05831c0279eb transaction_id=27484249 +2026-11-21T13:32:58.530583Z WARN UDP TRACKER: response error error=tracker announce error: Connection cookie error: cookie value is expired: -137241603156102090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, expected > 1795267857.5305822 client_socket_addr=127.0.0.1:44807 server_socket_addr=127.0.0.1:52052 service_binding=udp://127.0.0.1:52052 request_id=3fc62010-3919-4f37-8434-5d81c4a824c8 transaction_id=-1639937652 +test server::contract::should_return_a_bad_request_response_when_the_client_sends_an_empty_request ... ok +test server::contract::receiving_an_announce_request::should_return_an_announce_response ... ok +test server::contract::using_disabled_connection_id_validation::announce_succeeds_with_an_arbitrary_connection_id ... ok +test server::contract::publishing_the_banned_ips_total::with_disabled_connection_id_validation::should_not_publish_a_client_as_banned_before_it_exceeds_the_connection_id_error_limit ... ok +test server::contract::publishing_the_banned_ips_total::with_strict_connection_id_validation::should_not_publish_a_client_as_banned_before_it_exceeds_the_connection_id_error_limit ... ok +test server::contract::using_disabled_connection_id_validation::scrape_succeeds_with_an_arbitrary_connection_id ... ok +test server::contract::publishing_the_banned_ips_total::with_disabled_connection_id_validation::should_publish_a_client_that_exceeds_the_connection_id_error_limit_as_would_be_banned ... ok +test server::contract::publishing_the_banned_ips_total::with_strict_connection_id_validation::should_publish_a_client_as_banned_once_it_exceeds_the_connection_id_error_limit ... ok +test server::contract::using_disabled_connection_id_validation::many_invalid_connection_ids_do_not_cause_ban_in_disabled_mode ... ok +test server::contract::receiving_an_announce_request::should_return_many_announce_response ... ok +test server::contract::using_disabled_connection_id_validation::connect_still_issues_a_valid_connection_id ... ok +test server::contract::using_ipv6_v6only::should_accept_ipv6_connections_with_ipv6_v6only_enabled ... ok +test server::contract::receiving_an_scrape_request::should_return_only_the_first_74_torrent_stats_when_the_request_has_75_info_hashes ... ok +test server::contract::receiving_an_announce_request::should_ban_the_client_ip_if_it_sends_more_than_10_requests_with_a_cookie_value_not_normal ... ok + +failures: + +---- server::contract::receiving_an_announce_request::should_reject_a_torrent_that_is_not_whitelisted_with_a_message_that_holds_no_source_path stdout ---- + +thread 'server::contract::receiving_an_announce_request::should_reject_a_torrent_that_is_not_whitelisted_with_a_message_that_holds_no_source_path' panicked at packages/udp-server/tests/server/contract.rs:240:9: +the error message must not hold a source path, but it contains ".rs:": "tracker announce error: Tracker core whitelist error: The torrent: af0935008ed1f224d482116262d1d52eb8bfb999, is not whitelisted, packages/tracker-core/src/whitelist/authorization.rs:61:23" +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + + +failures: + server::contract::receiving_an_announce_request::should_reject_a_torrent_that_is_not_whitelisted_with_a_message_that_holds_no_source_path + +test result: FAILED. 16 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 5.09s + +error: test failed, to rerun pass `-p torrust-tracker-udp-server --test integration` diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-udp-server-lib.txt b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-udp-server-lib.txt new file mode 100644 index 0000000000..f79f96a062 --- /dev/null +++ b/docs/issues/open/2916-2912-si-4-tracker-core/evidence/tests-red-udp-server-lib.txt @@ -0,0 +1,340 @@ + Compiling tokio v1.54.1 + Compiling digest v0.10.7 + Compiling smallvec v1.16.6 + Compiling torrust-peer-id v0.1.0 + Compiling openssl v0.10.82 + Compiling rustls v0.23.46 + Compiling torrust-metrics v0.2.0 + Compiling sha2 v0.10.9 + Compiling hmac v0.12.1 + Compiling signature v2.2.0 + Compiling md-5 v0.10.6 + Compiling sha1 v0.10.7 + Compiling icu_normalizer v2.4.0 + Compiling parking_lot_core v0.9.12 + Compiling num-bigint-dig v0.8.6 + Compiling tracing-subscriber v0.3.23 + Compiling torrust-tracker-udp-protocol v0.1.0 (/packages/udp-protocol) + Compiling torrust-tracker-http-protocol v0.1.0 (/packages/http-protocol) + Compiling hkdf v0.12.4 + Compiling parking_lot v0.12.5 + Compiling futures-intrusive v0.5.0 + Compiling figment v0.10.19 + Compiling idna_adapter v1.2.2 + Compiling idna v1.1.0 + Compiling url v2.5.8 + Compiling rsa v0.9.10 + Compiling torrust-net-primitives v0.1.0 + Compiling torrust-tracker-primitives v3.1.0 (/packages/primitives) + Compiling torrust-tracker-configuration v3.0.0 (/packages/configuration) + Compiling native-tls v0.2.18 + Compiling rustls-platform-verifier v0.7.1 + Compiling torrust-tracker-test-helpers v3.0.0 (/packages/test-helpers) + Compiling tokio-util v0.7.20 + Compiling tokio-stream v0.1.19 + Compiling torrust-tracker-events v0.1.0 (/packages/events) + Compiling tokio-rustls v0.26.6 + Compiling tower v0.5.3 + Compiling async-compression v0.4.52 + Compiling criterion v0.5.1 + Compiling sqlx-core v0.8.6 + Compiling tower-http v0.6.11 + Compiling h2 v0.4.20 + Compiling torrust-tracker-swarm-coordination-registry v0.1.0 (/packages/swarm-coordination-registry) + Compiling tower-http v0.7.1 + Compiling torrust-server-lib v0.6.0 + Compiling sqlx-mysql v0.8.6 + Compiling sqlx-postgres v0.8.6 + Compiling sqlx-sqlite v0.8.6 + Compiling hyper v1.12.0 + Compiling hyper-util v0.1.21 + Compiling sqlx v0.8.6 + Compiling torrust-tracker-core v0.1.0 (/packages/tracker-core) + Compiling hyper-rustls v0.27.10 + Compiling reqwest v0.13.5 + Compiling torrust-tracker-client-lib v0.1.0 (/packages/tracker-client) + Compiling torrust-tracker-udp-core v0.1.0 (/packages/udp-core) + Compiling torrust-tracker-udp-server v0.1.0 (/packages/udp-server) + Finished `test` profile [optimized + debuginfo] target(s) in 15.85s + Running unittests src/lib.rs (target/debug/build/torrust-tracker-udp-server/4684096654e40990/out/torrust_tracker_udp_server-4684096654e40990) + +running 224 tests +test banning::event::listener::tests::it_should_ignore_non_connection_cookie_errors ... ok +test banning::event::listener::tests::it_should_leave_the_queued_event_unprocessed_and_return_cancelled_when_the_drain_timeout_has_expired ... ok +test banning::event::handler::tests::it_should_publish_the_banned_ip_total_after_a_connection_cookie_error ... ok +test banning::event::handler::tests::it_should_record_the_connection_cookie_error_for_its_client_ip ... ok +test banning::event::handler::tests::it_should_not_hold_the_ban_service_lock_while_waiting_to_publish_the_banned_ip_total ... ok +test banning::event::listener::tests::it_should_handle_a_queued_event_then_return_cancelled_when_cancellation_is_already_pending ... ok +test banning::event::handler::tests::it_should_hold_the_publication_order_until_it_has_published_the_banned_ip_total ... ok +test banning::event::listener::tests::it_should_process_connection_cookie_errors_after_lagging ... ok +test banning::tests::it_should_not_hold_the_ban_service_lock_while_waiting_to_publish_the_reset_total ... ok +test banning::event::listener::tests::it_should_stop_when_the_receiver_is_closed ... ok +test error::tests::it_should_preserve_response_routing_identifiers_for_a_sendable_parse_error ... ok +test error::tests::it_should_clear_response_routing_identifiers_for_an_unsendable_parse_error ... ok +test banning::tests::it_should_publish_the_new_banned_ips_total_after_resetting_the_bans ... ok +test error::tests::it_should_wrap_a_sendable_parse_error_as_an_invalid_request ... ok +test error::tests::it_should_wrap_a_scrape_service_error_as_a_scrape_failure ... ok +test banning::tests::it_should_hold_the_publication_order_until_it_has_published_the_reset_total ... ok +test error::tests::it_should_wrap_an_announce_service_error_as_an_announce_failure ... ok +test event::tests::it_should_classify_a_connection_cookie_error ... ok +test event::tests::it_should_classify_a_database_error ... ok +test event::tests::it_should_classify_a_negative_number_of_bytes_in_an_announce_as_a_bad_request ... ok +test event::tests::it_should_classify_a_nested_scrape_whitelist_error ... FAILED +test event::tests::it_should_classify_a_direct_scrape_whitelist_error ... FAILED +test event::tests::it_should_classify_a_nested_announce_whitelist_error ... FAILED +test event::tests::it_should_classify_a_scrape_connection_cookie_error ... ok +test event::tests::it_should_classify_a_scrape_database_error ... ok +test event::tests::it_should_classify_a_whitelist_error ... FAILED +test event::tests::it_should_classify_an_authentication_error ... ok +test event::tests::it_should_classify_an_internal_error ... ok +test event::tests::it_should_classify_an_invalid_request_as_a_request_parse_error ... ok +test event::tests::it_should_convert_request_kinds_to_metric_labels ... ok +test event::tests::it_should_render_request_kinds ... ok +test handlers::announce::tests::announce_request::it_should_convey_the_largest_interval_and_clamp_out_of_range_peer_counts_for_both_address_families ... ok +test handlers::connect::tests::connect_request::it_should_send_the_udp6_connect_event_when_a_client_tries_to_connect_using_an_ipv6_socket_address ... ok +test handlers::error::tests::it_should_not_classify_an_internal_failure_as_a_connection_cookie_error ... ok +test handlers::error::tests::it_should_classify_announce_and_scrape_cookie_failures_as_connection_cookie_errors ... ok +test handlers::scrape::tests::scrape_request::it_should_return_zeroed_statistics_when_scrape_data_does_not_contain_a_requested_hash ... ok +test container::tests::it_should_publish_events_through_the_enabled_server_event_bus ... ok +test handlers::error::tests::it_should_answer_with_the_error_message_and_the_request_transaction_id ... ok +test handlers::connect::tests::connect_request::it_should_send_the_udp4_connect_event_when_a_client_tries_to_connect_using_an_ipv4_socket_address ... ok +test handlers::announce::tests::announce_request::using_ipv6::from_a_loopback_ip::the_peer_ip_should_be_changed_to_the_external_ip_in_the_tracker_configuration ... ok +test handlers::tests::it_should_build_a_cookie_validation_range_around_the_issue_time ... ok +test handlers::error::tests::it_should_publish_an_error_event_naming_the_connection_request_kind_and_error ... ok +test handlers::tests::wire_i32_conversion::it_should_clamp_instead_of_wrapping_a_value_beyond_the_signed_wire_field ... ok +test handlers::tests::wire_i32_conversion::it_should_keep_a_value_that_fits_in_the_signed_wire_field ... ok +test handlers::tests::wire_i32_conversion::it_should_keep_the_largest_value_that_fits_in_the_signed_wire_field ... ok +test handlers::connect::tests::connect_request::a_connect_response_should_contain_the_same_transaction_id_as_the_connect_request ... ok +test server::bound_socket::tests::it_should_report_consistent_udp_endpoint_metadata ... ok +test handlers::error::tests::it_should_answer_with_a_zero_transaction_id_when_the_request_has_no_transaction_id ... ok +test server::bound_socket::tests::it_should_bind_to_a_non_zero_port_when_port_zero_is_requested ... ok +test server::bound_socket::tests::it_should_restrict_an_ipv6_socket_to_ipv6_when_ipv6_v6only_is_requested ... ok +test server::bound_socket::tests::it_should_return_an_error_when_the_address_is_already_in_use ... ok +test handlers::connect::tests::connect_request::a_connect_response_should_contain_a_new_connection_id_ipv6 ... ok +test handlers::announce::tests::announce_request::using_ipv6::should_send_the_udp6_announce_event ... ok +test server::launcher::tests::it_should_admit_a_request_from_a_client_that_is_not_banned ... ok +test handlers::announce::tests::announce_request::using_ipv4::should_send_the_udp4_announce_event ... ok +test handlers::announce::tests::announce_request::using_ipv4::an_announced_peer_should_be_added_to_the_tracker ... ok +test server::launcher::tests::receive_loop_admission::it_should_admit_a_received_datagram ... ok +test server::launcher::tests::it_should_discard_a_request_from_a_banned_client_in_strict_mode ... ok +test server::launcher::tests::receive_loop_admission::it_should_stop_with_the_receive_error_when_receiving_fails ... ok +test server::launcher::tests::receive_loop_admission::it_should_stop_with_an_unexpected_end_error_when_the_receive_stream_ends ... ok +test server::launcher::tests::receive_loop_admission::it_should_stop_with_the_receive_error_when_receiving_is_interrupted ... ok +test handlers::scrape::tests::scrape_request::it_should_publish_a_cookie_error_and_answer_when_cookie_validation_is_disabled ... ok +test handlers::announce::tests::announce_request::using_ipv4::the_announced_peer_should_not_be_included_in_the_response ... ok +test handlers::announce::tests::announce_request::it_should_encode_only_peer_addresses_matching_the_request_family ... ok +test server::launcher::tests::request_drain::it_should_abort_and_join_processors_still_running_at_the_deadline ... ok +test handlers::announce::tests::announce_request::using_ipv4::the_tracker_should_always_use_the_remote_client_ip_but_not_the_port_in_the_udp_request_header_instead_of_the_peer_address_in_the_announce_request ... ok +test server::launcher::tests::request_drain::it_should_count_a_processor_aborted_before_the_drain_as_evicted ... ok +test handlers::tests::it_should_preserve_the_transaction_id_for_a_sendable_parse_error_without_a_request_kind ... ok +test server::launcher::tests::it_should_admit_a_request_from_a_banned_client_when_connection_id_validation_is_disabled ... ok +2026-11-21T13:32:34.896711Z WARN UDP TRACKER: UDP request drain deadline reached: aborting remaining request processors service_binding="udp://192.0.2.15:2382" remaining=1 deadline=5s +test server::launcher::tests::request_drain::it_should_count_failed_processors_and_keep_draining_the_rest ... ok +test server::launcher::tests::request_drain::it_should_count_processors_that_finish_before_the_deadline_as_completed ... ok +test server::launcher::tests::request_drain::it_should_name_the_listener_in_the_deadline_warning ... ok +test server::launcher::tests::request_drain::it_should_join_every_processor_before_returning_the_receive_error ... ok +test server::launcher::tests::request_drain::it_should_return_immediately_when_there_are_no_processors ... ok +test handlers::scrape::tests::scrape_request::it_should_publish_an_accepted_scrape_event_for_an_ipv4_client ... ok +test server::request_buffer::tests::it_should_abort_a_pending_task_when_the_request_buffer_is_dropped ... ok +2026-11-21T13:32:34.897470Z WARN UDP TRACKER: Udp::run_udp_server::loop aborting request: (no finished tasks) local_addr="127.0.0.1:6969" +test server::request_buffer::tests::it_should_evict_the_oldest_pending_task_when_the_buffer_is_full ... ok +test server::request_buffer::tests::it_should_not_evict_a_pending_task_when_the_buffer_has_available_capacity ... ok +test handlers::tests::it_should_scrape_only_the_first_74_info_hashes_of_a_payload_with_75 ... ok +test handlers::announce::tests::announce_request::using_ipv6::an_announced_peer_should_be_added_to_the_tracker ... ok +test handlers::tests::it_should_dispatch_a_connect_request ... ok +test server::receiver::tests::it_should_yield_a_raw_request_with_the_received_datagram_and_sender_address ... ok +test handlers::announce::tests::announce_request::using_ipv6::the_announced_peer_should_not_be_included_in_the_response ... ok +test handlers::announce::tests::announce_request::using_ipv4::it_should_reject_an_announce_with_a_negative_number_of_bytes_left ... ok +test handlers::scrape::tests::scrape_request::it_should_preserve_a_scrape_service_failure_for_packet_error_routing ... ok +test server::launcher::tests::it_should_discard_a_request_whose_source_port_is_zero ... ok +2026-11-21T13:32:34.916805Z ERROR torrust_tracker_core::whitelist::authorization: error=The torrent: 0000000000000000000000000000000000000000, is not whitelisted, packages/tracker-core/src/whitelist/authorization.rs:61:23 +test handlers::announce::tests::announce_request::using_ipv6::the_tracker_should_always_use_the_remote_client_ip_but_not_the_port_in_the_udp_request_header_instead_of_the_peer_address_in_the_announce_request ... ok +test statistics::event::handler::error::tests::it_should_label_a_general_error_metric_with_connect_request_kind ... ok +test handlers::scrape::tests::scrape_request::it_should_return_zeroed_statistics_when_the_tracker_does_not_have_the_requested_torrent ... ok +test statistics::event::handler::error::tests::it_should_label_a_connection_id_error_metric_with_qbittorrent_client_software ... ok +test statistics::event::handler::request_aborted::tests::it_should_increase_the_number_of_aborted_requests_when_it_receives_a_udp_request_aborted_event ... ok +test statistics::event::handler::request_accepted::tests::it_should_increase_the_udp4_announce_requests_counter_when_it_receives_a_udp4_request_event_of_announce_kind ... ok +test statistics::event::handler::request_accepted::tests::it_should_increase_the_udp4_connect_requests_counter_when_it_receives_a_udp4_request_event_of_connect_kind ... ok +test handlers::scrape::tests::scrape_request::with_a_public_tracker::it_should_return_statistics_when_the_public_tracker_has_the_requested_torrent ... ok +test statistics::event::handler::error::tests::it_should_increase_the_udp4_errors_counter_when_it_receives_a_udp4_error_event ... ok +test handlers::announce::tests::announce_request::using_ipv4::when_the_announce_request_comes_from_a_client_using_ipv4_the_response_should_not_include_peers_using_ipv6 ... ok +test handlers::announce::tests::announce_request::using_ipv6::when_the_announce_request_comes_from_a_client_using_ipv6_the_response_should_not_include_peers_using_ipv4 ... ok +test handlers::scrape::tests::scrape_request::it_should_return_an_entry_for_each_duplicate_requested_info_hash ... ok +2026-11-21T13:32:34.920750Z WARN UDP TRACKER: Ignoring UDP server event from an unknown or metrics-disabled listener configuration_instance_id=ConfigurationInstanceId { service_role: UdpTracker, instance_index: 1 } +test handlers::announce::tests::announce_request::using_ipv4::it_should_preserve_an_announce_service_failure_for_packet_error_routing ... ok +test handlers::scrape::tests::scrape_request::with_a_whitelisted_tracker::it_should_return_zeroed_statistics_when_the_listed_tracker_has_not_whitelisted_the_torrent ... ok +test statistics::event::handler::request_accepted::tests::it_should_increase_the_udp4_scrape_requests_counter_when_it_receives_a_udp4_request_event_of_scrape_kind ... ok +test statistics::event::handler::request_accepted::tests::it_should_increase_the_udp6_announce_requests_counter_when_it_receives_a_udp6_request_event_of_announce_kind ... ok +2026-11-21T13:32:34.920892Z WARN UDP TRACKER: Udp tracker server statistics receiver lagged by 2 events. +test statistics::event::handler::request_accepted::tests::it_should_increase_the_udp6_connect_requests_counter_when_it_receives_a_udp6_request_event_of_connect_kind ... ok +test statistics::event::handler::request_accepted::tests::it_should_increase_the_udp6_scrape_requests_counter_when_it_receives_a_udp6_request_event_of_scrape_kind ... ok +test statistics::event::handler::request_banned::tests::it_should_increase_the_number_of_banned_requests_when_it_receives_a_udp_request_banned_event ... ok +test statistics::event::handler::request_discarded::tests::it_should_increase_the_number_of_discarded_requests_when_it_receives_a_udp_request_discarded_event ... ok +2026-11-21T13:32:34.920996Z WARN UDP TRACKER: Ignoring UDP server event from an unknown or metrics-disabled listener configuration_instance_id=ConfigurationInstanceId { service_role: UdpTracker, instance_index: 1 } +2026-11-21T13:32:34.921005Z WARN UDP TRACKER: Ignoring UDP server event from an unknown or metrics-disabled listener configuration_instance_id=ConfigurationInstanceId { service_role: UdpTracker, instance_index: 2 } +test statistics::event::handler::response_sent::tests::it_should_update_the_connect_processing_time_average_for_a_successful_connect_response ... ok +test statistics::event::handler::request_received::tests::it_should_increase_the_number_of_incoming_requests_when_it_receives_a_udp4_incoming_request_event ... ok +test statistics::event::handler::response_sent::tests::it_should_increase_the_udp4_responses_counter_when_it_receives_a_udp4_response_event ... ok +test statistics::event::handler::response_sent::tests::it_should_increase_the_udp6_response_counter_when_it_receives_a_udp6_response_event ... ok +2026-11-21T13:32:34.921116Z WARN UDP TRACKER: Event listener drain lost events after cancellation listener="udp_tracker_server_statistics" outcome="timed_out" processed=0 lost_to_lag=0 unread_when_timed_out=1 +test handlers::scrape::tests::scrape_request::it_should_publish_an_accepted_scrape_event_for_an_ipv6_client ... ok +test handlers::scrape::tests::scrape_request::it_should_preserve_the_order_of_eight_requested_info_hashes ... ok +test statistics::event::listener::tests::it_should_apply_the_metrics_policy_to_a_drained_event ... ok +test statistics::event::listener::tests::it_should_handle_a_queued_event_then_return_cancelled_when_cancellation_is_already_pending ... ok +test statistics::event::listener::tests::it_should_process_enabled_events_after_lagging ... ok +test statistics::event::listener::tests::it_should_stop_when_the_receiver_is_closed ... ok +test statistics::metrics::tests::averaged_processing_time_metrics::it_should_handle_fractional_averages_with_truncation ... ok +test statistics::event::listener::tests::it_should_update_metrics_only_for_an_enabled_configuration_instance ... ok +test statistics::metrics::tests::averaged_processing_time_metrics::it_should_handle_single_server_averaged_metrics ... ok +test statistics::metrics::tests::averaged_processing_time_metrics::it_should_only_average_matching_request_kinds ... ok +test statistics::metrics::tests::averaged_processing_time_metrics::it_should_return_averaged_value_for_udp_avg_announce_processing_time_ns_averaged ... ok +test handlers::announce::tests::announce_request::using_ipv4::from_a_loopback_ip::each_listener_should_use_its_own_configured_external_ip ... ok +test statistics::metrics::tests::averaged_processing_time_metrics::it_should_return_zero_for_udp_avg_announce_processing_time_ns_averaged_when_no_data ... ok +test statistics::event::listener::tests::it_should_leave_the_queued_event_unprocessed_and_return_cancelled_when_the_drain_timeout_has_expired ... ok +test statistics::metrics::tests::combined_metrics::it_should_distinguish_between_different_request_kinds ... ok +test statistics::metrics::tests::combined_metrics::it_should_handle_mixed_ipv4_and_ipv6_for_different_request_kinds ... ok +test statistics::metrics::tests::combined_metrics::it_should_distinguish_between_ipv4_and_ipv6_metrics ... ok +test statistics::metrics::tests::averaged_processing_time_metrics::it_should_return_averaged_value_for_udp_avg_connect_processing_time_ns_averaged ... ok +test statistics::metrics::tests::averaged_processing_time_metrics::it_should_return_averaged_value_for_udp_avg_scrape_processing_time_ns_averaged ... ok +test statistics::metrics::tests::edge_cases::it_should_handle_large_counter_values ... ok +test statistics::metrics::tests::averaged_processing_time_metrics::it_should_return_zero_for_udp_avg_connect_processing_time_ns_averaged_when_no_data ... ok +test statistics::metrics::tests::error_handling::it_should_return_ok_result_for_valid_counter_operations ... ok +test statistics::metrics::tests::it_should_implement_default ... ok +test statistics::metrics::tests::edge_cases::it_should_handle_large_gauge_values ... ok +test statistics::metrics::tests::edge_cases::it_should_handle_zero_gauge_values ... ok +test statistics::metrics::tests::edge_cases::it_should_handle_multiple_labels_on_same_metric ... ok +test statistics::metrics::tests::edge_cases::it_should_handle_empty_label_sets ... ok +test statistics::metrics::tests::it_should_implement_debug ... ok +test server::launcher::tests::it_should_publish_a_request_discarded_event_when_its_source_port_is_zero ... ok +test statistics::metrics::tests::edge_cases::it_should_overwrite_gauge_values_when_set_multiple_times ... ok +test statistics::metrics::tests::error_handling::it_should_handle_unknown_metric_names_gracefully ... ok +test statistics::metrics::tests::it_should_increase_counter_metric_with_labels ... ok +test statistics::metrics::tests::it_should_increment_processed_requests_total ... ok +test statistics::metrics::tests::error_handling::it_should_return_ok_result_for_valid_gauge_operations ... ok +test statistics::metrics::tests::it_should_set_gauge_metric ... ok +test statistics::metrics::tests::averaged_processing_time_metrics::it_should_return_zero_for_udp_avg_scrape_processing_time_ns_averaged_when_no_data ... ok +test handlers::scrape::tests::scrape_request::with_a_whitelisted_tracker::it_should_return_statistics_when_the_listed_tracker_has_a_whitelisted_torrent ... ok +test statistics::metrics::tests::it_should_set_gauge_metric_with_labels ... ok +test statistics::metrics::tests::it_should_implement_partial_eq ... ok +test statistics::metrics::tests::udp_general_metrics::it_should_return_gauge_value_for_udp_banned_ips_total ... ok +test statistics::metrics::tests::udp_general_metrics::it_should_return_sum_of_udp_requests_aborted ... ok +test statistics::metrics::tests::udp_general_metrics::it_should_return_sum_of_udp_requests_banned ... ok +test statistics::metrics::tests::udp_general_metrics::it_should_return_zero_for_udp_banned_ips_total_when_no_data ... ok +test statistics::metrics::tests::it_should_increase_counter_metric ... ok +test statistics::metrics::tests::udp_general_metrics::it_should_return_zero_for_udp_requests_aborted_when_no_data ... ok +test statistics::metrics::tests::udpv4_metrics::it_should_return_sum_of_udp4_announces_handled ... ok +test statistics::metrics::tests::udp_general_metrics::it_should_return_zero_for_udp_requests_banned_when_no_data ... ok +test statistics::metrics::tests::udpv4_metrics::it_should_return_sum_of_udp4_connections_handled ... ok +test statistics::metrics::tests::processing_time_moving_average::it_should_keep_the_fractional_part_of_the_previous_average ... ok +test statistics::metrics::tests::udp_general_metrics::it_should_return_exactly_a_udp_requests_aborted_total_that_an_f64_cannot_represent ... ok +test statistics::metrics::tests::it_should_return_zero_for_udp_processed_requests_total_when_no_data ... ok +test statistics::metrics::tests::udpv4_metrics::it_should_return_sum_of_udp4_errors_handled ... ok +test statistics::metrics::tests::udpv4_metrics::it_should_return_sum_of_udp4_responses ... ok +test statistics::metrics::tests::udpv4_metrics::it_should_return_zero_for_udp4_connections_handled_when_no_data ... ok +test statistics::metrics::tests::udpv4_metrics::it_should_return_zero_for_udp4_responses_when_no_data ... ok +test statistics::metrics::tests::udpv4_metrics::it_should_return_sum_of_udp4_scrapes_handled ... ok +test statistics::metrics::tests::udpv4_metrics::it_should_return_sum_of_udp4_requests ... ok +test statistics::metrics::tests::udpv4_metrics::it_should_return_zero_for_udp4_requests_when_no_data ... ok +test statistics::metrics::tests::udpv4_metrics::it_should_return_zero_for_udp4_scrapes_handled_when_no_data ... ok +test statistics::metrics::tests::udpv6_metrics::it_should_return_sum_of_udp6_connections_handled ... ok +test statistics::metrics::tests::udpv6_metrics::it_should_return_sum_of_udp6_errors_handled ... ok +test statistics::metrics::tests::udpv4_metrics::it_should_return_zero_for_udp4_errors_handled_when_no_data ... ok +test statistics::metrics::tests::udpv6_metrics::it_should_return_zero_for_udp6_connections_handled_when_no_data ... ok +test statistics::metrics::tests::udpv6_metrics::it_should_return_zero_for_udp6_errors_handled_when_no_data ... ok +test statistics::metrics::tests::udpv6_metrics::it_should_return_zero_for_udp6_requests_when_no_data ... ok +test statistics::metrics::tests::udpv6_metrics::it_should_return_zero_for_udp6_responses_when_no_data ... ok +test statistics::metrics::tests::udpv6_metrics::it_should_return_zero_for_udp6_scrapes_handled_when_no_data ... ok +test statistics::metrics::tests::udpv6_metrics::it_should_return_sum_of_udp6_scrapes_handled ... ok +test statistics::repository::tests::it_should_allow_increasing_a_counter_metric_successfully ... ok +test statistics::metrics::tests::udpv6_metrics::it_should_return_sum_of_udp6_announces_handled ... ok +test statistics::metrics::tests::udpv6_metrics::it_should_return_zero_for_udp6_announces_handled_when_no_data ... ok +test statistics::metrics::tests::udpv6_metrics::it_should_return_sum_of_udp6_responses ... ok +test statistics::metrics::tests::udpv6_metrics::it_should_return_sum_of_udp6_requests ... ok +test statistics::metrics::tests::udpv4_metrics::it_should_return_zero_for_udp4_announces_handled_when_no_data ... ok +test statistics::repository::tests::it_should_allow_setting_a_gauge_with_different_labels ... ok +test statistics::repository::tests::it_should_be_initialized_with_described_metrics ... ok +test statistics::repository::tests::it_should_allow_increasing_a_counter_multiple_times ... ok +test statistics::repository::tests::it_should_allow_increasing_a_counter_with_different_labels ... ok +test statistics::repository::tests::it_should_handle_error_cases_gracefully ... ok +test statistics::repository::tests::it_should_handle_concurrent_access ... ok +test statistics::repository::tests::it_should_handle_large_processing_times ... ok +test statistics::repository::tests::it_should_initialize_metrics_when_constructed_with_default ... ok +test statistics::repository::tests::it_should_overwrite_previous_value_when_setting_a_gauge_with_a_previous_value ... ok +test statistics::repository::tests::it_should_maintain_consistency_across_operations ... ok +test statistics::repository::tests::it_should_run_the_closure_on_the_metrics_and_return_its_result ... ok +test statistics::repository::tests::it_should_recalculate_separate_moving_averages_for_each_request_kind ... ok +test statistics::repository::tests::it_should_set_a_gauge_metric_successfully ... ok +test statistics::repository::tests::recalculate_average_methods_should_handle_zero_connections_gracefully ... ok +test testing::environment::tests::it_should_cancel_the_event_listeners_only_after_the_receive_loop_has_finished ... ok +test testing::environment::tests::it_should_map_disabled_connection_id_validation_policy ... ok +test testing::environment::tests::it_should_join_every_event_listener_before_reporting_a_receive_loop_failure ... ok +test testing::environment::tests::it_should_map_strict_connection_id_validation_policy ... ok +test statistics::repository::tests::race_conditions::it_should_handle_race_conditions_when_updating_udp_performance_metrics_in_parallel ... ok +test handlers::scrape::tests::scrape_request::it_should_return_the_persisted_downloads_of_torrents_absent_from_memory_in_request_order ... ok +test statistics::metrics::tests::processing_time_moving_average::it_should_not_drift_toward_the_fastest_requests_over_many_requests ... ok +test server::launcher::tests::receive_loop_shutdown::it_should_let_an_accepted_request_finish_and_answer_before_returning_on_cancellation ... ok +test testing::environment::tests::it_should_cancel_the_event_listeners_when_the_join_is_abandoned_while_the_receive_loop_runs ... ok +test server::processor::tests::it_should_publish_a_discard_event_when_a_client_uses_port_zero ... ok +test server::processor::tests::it_should_publish_a_response_sent_event_when_it_answers_a_connect_request ... ok +2026-11-21T13:32:34.952694Z ERROR torrust_tracker_udp_server::server::states: error=could not register UDP tracker service: a service is already registered for binding udp://127.136.185.221:56532 +test server::tests::token_aware_start::it_should_release_the_socket_when_registration_fails ... ok +test server::launcher::tests::it_should_publish_a_request_banned_event_when_its_client_ip_is_banned_in_strict_mode ... ok +test testing::environment::tests::it_should_count_the_statistics_events_of_a_request_answered_just_before_stop ... ok +2026-11-21T13:32:34.956787Z WARN torrust_tracker_udp_server::server::processor: failed to send bytes_count=16 error=Address family not supported by protocol (os error 97) payload=[0, 0, 0, 0, 0, 0, 0, 0, 16, 159, 105, 29, 5, 250, 145, 11] +2026-11-21T13:32:34.960742Z WARN UDP TRACKER: response error error=tracker scrape error: Connection cookie error: cookie value is expired: 0.0000000000000000000000000000000000000000000005714696852536039, expected > 1795267833.7769034 client_socket_addr=127.0.0.1:50068 server_socket_addr=0.0.0.0:47993 service_binding=udp://0.0.0.0:47993 request_id=68d6cdfc-cf23-4bb8-af16-aac23449da5d transaction_id=0 +2026-11-21T13:32:34.963689Z ERROR torrust_tracker_udp_server::server::states: error=could not bind UDP tracker listener: Address already in use (os error 98) +2026-11-21T13:32:34.963683Z ERROR UDP TRACKER: response error error=error parsing request: SendableRequestParseError { message: "Couldn't parse action", opt_connection_id: None, opt_transaction_id: None } client_socket_addr=127.0.0.1:39738 server_socket_addr=0.0.0.0:58196 service_binding=udp://0.0.0.0:58196 request_id=2ae50a68-3345-4c74-9be4-8659c576ddd3 +test server::processor::tests::it_should_keep_the_request_kind_in_the_error_response_event_when_a_parsed_request_fails ... ok +test server::processor::tests::it_should_return_a_send_error_when_the_response_cannot_be_sent ... ok +test server::tests::token_aware_start::it_should_register_the_service_with_a_health_check_that_reaches_the_running_server ... ok +test testing::environment::tests::it_should_stop_the_event_listeners_when_dropped_without_being_stopped ... ok +test testing::environment::tests::it_should_not_leave_event_listeners_running_when_the_udp_server_fails_to_start ... ok +test server::tests::token_aware_start::it_should_stop_the_receive_loop_and_release_the_socket_when_its_cancellation_token_is_cancelled ... ok +test testing::environment::tests::it_should_stop_without_a_join_failure_when_every_owned_task_finishes_through_cancellation ... ok +test testing::environment::tests::it_should_count_the_statistics_event_of_a_request_that_is_published_while_stop_drains_the_receive_loop ... ok +test testing::environment::tests::it_should_serve_requests_after_being_stopped_and_started_again ... ok +test server::processor::tests::it_should_publish_an_error_response_event_without_a_request_kind_when_the_payload_is_unparsable ... ok +2026-11-21T13:32:35.055149Z WARN UDP TRACKER: UDP request drain deadline reached: aborting remaining request processors service_binding="udp://127.0.0.1:37539" remaining=50 deadline=100ms +2026-11-21T13:32:35.055223Z WARN UDP TRACKER: UDP request processors drained service_binding="udp://127.0.0.1:37539" completed=0 failed=0 aborted=50 evicted=0 elapsed=100.244298ms +test server::launcher::tests::receive_loop_shutdown::it_should_not_return_while_processors_orphaned_by_the_request_ring_are_still_running ... ok +2026-11-21T13:32:35.064343Z WARN UDP TRACKER: UDP request drain deadline reached: aborting remaining request processors service_binding="udp://127.161.141.253:43664" remaining=50 deadline=100ms +2026-11-21T13:32:35.064396Z WARN UDP TRACKER: UDP request processors drained service_binding="udp://127.161.141.253:43664" completed=0 failed=0 aborted=50 evicted=0 elapsed=101.204115ms +test server::launcher::tests::receive_loop_shutdown::it_should_release_the_socket_once_the_processors_orphaned_by_the_request_ring_are_joined ... ok + +failures: + +---- event::tests::it_should_classify_a_nested_scrape_whitelist_error stdout ---- + +thread 'event::tests::it_should_classify_a_nested_scrape_whitelist_error' panicked at packages/udp-server/src/event.rs:348:9: +assertion failed: matches!(actual, ErrorKind::Whitelist(message) if message == + "The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted") + +---- event::tests::it_should_classify_a_direct_scrape_whitelist_error stdout ---- + +thread 'event::tests::it_should_classify_a_direct_scrape_whitelist_error' panicked at packages/udp-server/src/event.rs:366:9: +assertion failed: matches!(actual, ErrorKind::Whitelist(message) if message == + "The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted") +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + +---- event::tests::it_should_classify_a_nested_announce_whitelist_error stdout ---- + +thread 'event::tests::it_should_classify_a_nested_announce_whitelist_error' panicked at packages/udp-server/src/event.rs:308:9: +assertion failed: matches!(actual, ErrorKind::Whitelist(message) if message == + "The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted") + +---- event::tests::it_should_classify_a_whitelist_error stdout ---- + +thread 'event::tests::it_should_classify_a_whitelist_error' panicked at packages/udp-server/src/event.rs:290:9: +assertion failed: matches!(actual, ErrorKind::Whitelist(message) if message == + "The torrent: 3b245504cf5f11bbdbe1201cea6a6bf45aee1bc0, is not whitelisted") + + +failures: + event::tests::it_should_classify_a_direct_scrape_whitelist_error + event::tests::it_should_classify_a_nested_announce_whitelist_error + event::tests::it_should_classify_a_nested_scrape_whitelist_error + event::tests::it_should_classify_a_whitelist_error + +test result: FAILED. 220 passed; 4 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.29s + +error: test failed, to rerun pass `-p torrust-tracker-udp-server --lib` diff --git a/docs/issues/open/2916-2912-si-4-tracker-core/manual-verification-evidence.md b/docs/issues/open/2916-2912-si-4-tracker-core/manual-verification-evidence.md new file mode 100644 index 0000000000..d8834063dc --- /dev/null +++ b/docs/issues/open/2916-2912-si-4-tracker-core/manual-verification-evidence.md @@ -0,0 +1,362 @@ +--- +doc-type: manual-verification-evidence +issue-spec: docs/issues/open/2916-2912-si-4-tracker-core/ISSUE.md +last-updated-utc: "2026-11-21 13:43" +--- + + + +# Manual Verification Evidence + +## Purpose + +Record real, human-oriented verification of the completed behavior. This is +evidence from commands or interactions actually performed against the artifact; +do not invent commands, output, logs, or results. + +## Preserving Verification Artifacts + +The two tracker configurations, the request script and the UDP client lived in an agent scratchpad +outside the repository (`` below); they are embedded verbatim in this document. The +captured replies and the test runs are stored in the [`evidence/`](evidence/) folder of this issue: + +- [`evidence/responses-before.txt`](evidence/responses-before.txt) and + [`evidence/responses-after.txt`](evidence/responses-after.txt): the eleven requests and their + replies, before and after the fix. +- Red runs, at the commit `test(tracker-core): [#2916] add red tests that tracker-core error texts name no source path`: + [`evidence/tests-red-tracker-core.txt`](evidence/tests-red-tracker-core.txt), + [`evidence/tests-red-udp-server-lib.txt`](evidence/tests-red-udp-server-lib.txt), + [`evidence/tests-red-udp-server-integration.txt`](evidence/tests-red-udp-server-integration.txt), + [`evidence/tests-red-axum-http-server.txt`](evidence/tests-red-axum-http-server.txt) and + [`evidence/tests-red-axum-rest-api-server.txt`](evidence/tests-red-axum-rest-api-server.txt). +- Green run, at the commit `docs(axum-http-server): [#2916] show the tracker-core authentication failure reasons without source paths`: + [`evidence/tests-green.txt`](evidence/tests-green.txt). + +In the stored output the worktree path is replaced with ``, the Cargo home directory with +``, the REST API token with ``, and thread ids are removed; the rest of each line +is verbatim. + +## Environment and Prerequisites + +- Date and time (UTC): 2026-11-21 13:26 to 13:42. +- Artifact under test: the `torrust-tracker` binary (`cargo build --bin torrust-tracker`, debug + profile). "Before": built at 13:26 from the unchanged tree of `develop` at `4be22ee66`, before any + edit on the branch. "After": built at 13:41 from the commit + `fix(tracker-core): [#2916] replace LocatedError sources of peer key errors and drop torrust-located-error` + (`git diff --quiet HEAD` exited 0 before the build). The only later commit, + `docs(axum-http-server): ...`, changes module documentation only. +- Toolchain: stable Rust, `rustc 1.100.0 (0ef1bc386 2026-11-09)`; formatting with the nightly Rust + toolchain, `cargo 1.102.0-nightly (f93c676e3 2026-11-15)`. Clients: `curl 8.18.0` and + `Python 3.14.4` (the UDP client below). +- Operating system / environment: Linux 7.0.0-43-generic. +- Prerequisites and setup performed: two tracker instances started from the binary under test, one + listed (UDP, HTTP and REST API) and one private (HTTP and REST API), each with a fresh SQLite + database. The REST API token is the default development token of + `share/default/config/tracker.development.sqlite3.toml`. + +`listed.toml`: + +```toml +[metadata] +app = "torrust-tracker" +purpose = "configuration" +schema_version = "3.0.0" + +[logging] +trace_filter = "info" + +[core] +listed = true +private = false + +[core.database] +driver = "sqlite3" +path = "/listed.db" + +[[udp_trackers]] +bind_address = "127.0.0.1:17069" + +[[http_trackers]] +bind_address = "127.0.0.1:17070" + +[http_api] +bind_address = "127.0.0.1:17212" + +[http_api.access_tokens] +admin = "MyAccessToken" + +[health_check_api] +bind_address = "127.0.0.1:17313" +``` + +`private.toml`: + +```toml +[metadata] +app = "torrust-tracker" +purpose = "configuration" +schema_version = "3.0.0" + +[logging] +trace_filter = "info" + +[core] +listed = false +private = true + +[core.database] +driver = "sqlite3" +path = "/private.db" + +[[http_trackers]] +bind_address = "127.0.0.1:17080" + +[http_api] +bind_address = "127.0.0.1:17213" + +[http_api.access_tokens] +admin = "MyAccessToken" + +[health_check_api] +bind_address = "127.0.0.1:17314" +``` + +`udp_announce.py`, a minimal BEP 15 client (connect, then announce). No UDP client binary ships with +the workspace; the maintained check of the same reply is the UDP contract test listed under V1. + +```python +# Usage: python3 -I udp_announce.py +# Sends a BEP 15 connect and announce; prints the announce reply (error message if action 3). +import random, socket, struct, sys +port, ih = int(sys.argv[1]), bytes.fromhex(sys.argv[2]) +s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM); s.settimeout(5) +addr = ("127.0.0.1", port) +tx = random.getrandbits(32) +s.sendto(struct.pack(">QII", 0x41727101980, 0, tx), addr) +action, rtx, conn = struct.unpack(">IIQ", s.recv(2048)[:16]) +tx = random.getrandbits(32) +s.sendto(struct.pack(">QII20s20sQQQIIIiH", conn, 1, tx, ih, b"-qB00000000000000001", 0, 0, 0, 0, 0, 0, -1, 17548), addr) +data = s.recv(2048) +action, rtx = struct.unpack(">II", data[:8]) +print(f"action={action} message={data[8:].decode(errors='replace')!r}" if action == 3 else f"action={action} len={len(data)}") +``` + +`run.sh`, run as `run.sh before` and `run.sh after`. It starts +both trackers, waits for the four HTTP ports, sends the requests one after the other (each command +waits for its reply before the next starts, so W1 precedes W2, K1 precedes K2 and K4 precedes H4), +and stops the trackers with `SIGINT`: + +```bash +#!/usr/bin/env bash +# Usage: run.sh