Skip to content

Keep the request kind in the UDP error-response event #2345

Closed

Description

@josecelano

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 receive None.

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

  1. added
    Bug
    on Sep 26, 2026
  2. self-assigned this
    on Sep 26, 2026
  3. 9 remaining items

  4. added 6 commits that reference this issue on Sep 27, 2026
  5. added a commit that references this issue on Sep 28, 2026
  6. added a commit that references this issue on Sep 28, 2026
  7. added 6 commits that reference this issue on Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions