Repository navigation
Description
Summary
When the UDP tracker answers a request it could parse with an error response, the internal Event::UdpResponseSent it publishes drops the request kind. Processor::send_response receives Some(req_kind) from handlers::handle_packet but hard-codes None for every error response:
Response::Error(_e) => event::UdpResponseKind::Error { opt_req_kind: None },The event contract in packages/udp-server/src/event.rs documents that UdpResponseKind::Error contains the request kind when the request was parsed successfully, so None should mean only "the payload could not be parsed". Commit 27e2db4b (refactor: [#1382] include req kin in UDP error response if it's known) threaded the value into send_response for this purpose but left this match arm hard-coded, so this looks like an incomplete change rather than a design decision.
Reproduction
Reproduced on develop. A temporary test on the processor's event bus sent a parsed scrape with an invalid connection ID (ConnectionId::new(0), strict validation) from a real loopback client socket and observed:
UdpRequestAccepted { kind: Scrape }
UdpError { kind: Some(Scrape), error: ConnectionCookie(..) }
UdpResponseSent { kind: Error { opt_req_kind: None } }
The other events for the same request carry Scrape; UdpResponseSent reports None. The field is not visible to clients, metrics, or logs, so the event bus is the only place to observe it. Full steps, code, and output are in the issue-local manual-verification-evidence.md of the spec.
Impact
- The published event contradicts its documented contract and the "events are objective facts" ADR.
- No current metric is wrong: the only consumer (
statistics/event/handler/response_sent.rs) ignores the field for errors. A future consumer that trusts the contract would receiveNone.
Proposed Fix
Pass the received value through: Response::Error(_e) => event::UdpResponseKind::Error { opt_req_kind }, with processor unit regression tests proving a parsed-request failure publishes Some(Scrape) (red before the fix) and an unparsable payload still publishes None.
Specification
The issue specification is added in a spec-only PR under docs/issues/open/.
Related to #2283 (UDP server package coverage work on processor.rs tests is paused until this fix merges to avoid conflicts).
Activity
docs(issues): add issue specification for torrust#2345
docs(skills): require classified reproduction and self-check in bug s…
docs(issues): [torrust#2345] correct the V1 announce count in the rep…
docs(issues): [torrust#2345] label V1 and V2 with the fix-bug reprodu…
docs(issues): [torrust#2345] split manual scenarios into pre-fix and …
docs(issues): [torrust#2345] use the v1 planned status in the spec fr…
docs(issues): [torrust#2345] restore the agent review report checkpoint
docs(issues): [torrust#2345] bound the regression event loop with one…
docs(skills): link the fix-bug internal-outcome worked example
docs(pr-reviews): record PR torrust#2346 review audit
docs(issues): add issue specification for torrust#2345
docs(skills): require classified reproduction and self-check in bug s…
docs(issues): [torrust#2345] correct the V1 announce count in the rep…
9 remaining items
docs(issues): start implementation of torrust#2345
test(udp-server): [torrust#2345] cover the request kind in the UDP er…
fix(udp-server): [torrust#2345] keep the request kind in the UDP erro…
test(udp-server): [torrust#2345] use expect for the client address in…
docs(issues): record the torrust#2345 task review and completion review
docs(issues): link torrust#2345 spec to implementation PR torrust#2354
chore(issues): archive closed issue torrust#2345 spec to docs/issues/…
Merge torrust#2354: fix(udp-server): [torrust#2345] keep the request …
chore(issues): archive closed issue torrust#2345 spec to docs/issues/…
docs(issues): link the torrust#2345 archival review report
Merge #2356: chore(issues): archive closed issue #2345 spec to docs/i…
chore(issues): archive closed issue specs torrust#2323, torrust#2342, t…
Merge #2358: chore(issues): archive closed issue specs #2323, #2342, #…
Merge #2381: test(udp-server): [#2283] increase udp server package co…