Skip to content

docs(issues): [#2867] add spec for the UDP health check panic on an invalid response - #2868

Merged
josecelano merged 11 commits into
torrust:developfrom
josecelano-bot:2867-udp-health-check-panics-on-invalid-response-spec
Nov 16, 2026
Merged

josecelano merged 11 commits into
torrust:developfrom
josecelano-bot:2867-udp-health-check-panics-on-invalid-response-spec

Conversation

@josecelano-bot

@josecelano-bot josecelano-bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Related to #2867

Summary

Spec-only PR for #2867: a UDP tracker that answers the health check with a datagram that is not a valid tracker response makes GET /health_check panic, so the client gets no report. It adds the issue specification and the evidence of the reproduction. No code changes; the fix comes in a separate PR after this spec is merged.

The spec proposes that torrust_tracker_client::udp::client::check returns an error instead of calling unwrap() on a failed receive, and that the health-check handler reports a check job that panicked as a failed check instead of panicking itself. It plans three regression tests, each proven red first: a tracker-client unit test with a UDP socket that answers with junk bytes, a UDP contract test that sends GET /health_check to a junk-answering service (the reproduction test, kept), and a health-check contract test with a probe whose job panics.

Files

  • docs/issues/open/2867-udp-health-check-panics-on-invalid-response/ISSUE.md: the specification.
  • docs/issues/open/2867-udp-health-check-panics-on-invalid-response/manual-verification-evidence.md: V1 reproduction (reproduced), V2 closed-port scope check (no panic), and V3, which reruns V2 asserting the exact Err("Timed Out") value.
  • docs/issues/open/2867-udp-health-check-panics-on-invalid-response/evidence/: the temporary reproduction tests as diffs (reproduction-tests.diff for V1 and V2, closed-port-value-check.diff for V3) and the output of each run.
  • docs/pr-reviews/pr-2868-review/PR-REVIEW.md: the review audit record for this PR.

Validation

  • Reproduction run on develop at abd7a10ff with the stable Rust toolchain (rustc 1.99.1): cargo test -p torrust-tracker-axum-health-check-api-server --test integration answers_the_check_with_junk showed the three chained panics and hyper::Error(IncompleteMessage) on the client. The temporary tests are not included in this PR; they were reverted and are kept only as the diffs in evidence/.
  • V3 rerun on the same base and toolchain: the closed-port test asserting Err("Timed Out") passed in 3.01 s.
  • linter all passes, and the pre-commit hook passes on every commit of the branch.

Found during the red-then-green check of #2393 (EPIC #2392).

🤖 Generated with Claude Code

josecelano-bot and others added 2 commits November 15, 2026 12:47
… response

Reproduced on develop: a UDP peer that answers the health check with junk
bytes makes the check task, the report task and the request handler panic,
so GET /health_check drops the connection with no report.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

1 open issue
What changed in this PR

Adds a folder-style issue specification and supporting manual verification artifacts for #2867, documenting a panic in GET /health_check when a UDP tracker responds with invalid bytes.

Changes:

  • Add detailed issue spec describing the panic chain, scope, and regression test strategy.
  • Add manual verification evidence (commands + observed outputs) for reproduction and scope check.
  • Add preserved reproduction artifacts (temporary test diff + logs) under evidence/.
File Description
docs/​issues/​open/​2867-udp-health-check-panics-on-invalid-response/​ISSUE.md Defines bug scope, impact, and planned regression tests/fix approach.
docs/​issues/​open/​2867-udp-health-check-panics-on-invalid-response/​manual-verification-evidence.md Records real-world reproduction steps and outcomes with linked artifacts.
docs/​issues/​open/​2867-udp-health-check-panics-on-invalid-response/​evidence/​reproduction-tests.diff Stores the temporary reproduction tests as a diff artifact for traceability.
docs/​issues/​open/​2867-udp-health-check-panics-on-invalid-response/​evidence/​junk-reply-run.log Captures failing output showing the chained panics + IncompleteMessage.
docs/​issues/​open/​2867-udp-health-check-panics-on-invalid-response/​evidence/​closed-port-run.log Captures passing output for the closed-port “Timed Out” scope check.

Review effort: Lite

@josecelano

Copy link
Copy Markdown
Member

ACK 590d93f

da2ce7
da2ce7 previously approved these changes Nov 15, 2026

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed at 590d93f7809c4fd4e8d7b1447dcf6f4b3b5ee9fa. Recomputed from the bytes at this head, against the merge base abd7a10ff; git merge-tree against develop e0a54d558 merges cleanly with no conflict, and none of the 12 commits develop gained since the merge base touches the changed paths or the code the spec cites.

Process: a spec-only bug PR, governed by create-issue and fix-bug, with open-pull-request for the description and process-pr-review for the audit. The folder layout, the template headings (plus the plain-terms Background subsections fix-bug asks for), the v1 frontmatter, Bug-Fix Process, Regression Test Strategy, the evidence file and the Related to link are all present.

The change against its claim: the code statements recompute at both bases: process(response.unwrap()) at client.rs:275:40, the two expect calls at handlers.rs:71:26 and 79:20, the test client unwrap at client.rs:18:72, the stale # Panics doc, Timed Out and Did not Connect, the 2 s sleep against the 5 s DEFAULT_UDP_TIMEOUT, no panic-catching layer, the package names, the readiness probes and the stopped-UDP test. The evidence diff applies cleanly at the merge base and reproduces both index-line blobs.

Consistency: every relative link and backticked path resolves (the drafts path is the historical checkpoint, as in other open specs); the related artifacts exist; no dictionary change is needed. The audit row, its source review, reply thread and resolution subject agree, and the validator's logic run offline against the captured comments reports no failure.

Hygiene: Conventional subjects carrying [#2867] (the first predates the issue); author equals committer on all five; each commit carries one attribution footer, which no rule in the tree governs; the commit-id check names no PR-branch id; no closing keyword in the title, description or messages. git diff --check flags only the blank context line a unified diff needs and a trailing blank line in a captured log.

Findings: F1 and F2 (Minor), F3 to F5 (Nit); none blocks.

Checked, no finding: the last-updated-utc left unchanged by the frontmatter-only edits follows the precedent on develop; the thread state RESOLVED matches the thread.

Checks

On the loop's compute node at this head, against the merge base abd7a10ff (receipt server-gates-kranich-905): the repository's pre-commit gate and lint roster exit 0 (654 s wall, on a node shared with three other gates), and the review-audit validator reports 1 row, 1 log entry and no failure. The PR changes documentation only, so no package tests apply. F3 checked against the bytes at posting: at abd7a10ff, packages/tracker-client/src/udp/client.rs sets DEFAULT_UDP_TIMEOUT to 5 s at line 17, passes it to UdpTrackerClient::new at line 247, and races only the receive against a 2 s sleep at lines 267-270. GitHub checks at this head at posting time: "Publish (Release): completed/skipped; Publish (Development): completed/skipped; Context: completed/success; Package Coverage (${{ matrix.package }}): completed/skipped; Package Coverage Regression: completed/success; Test (Docker) (release): completed/success; Build on windows-latest (stable): completed/success; Build on ubuntu-latest (nightly): completed/success; Build on ubuntu-latest (stable): completed/success; Build on macos-latest (nightly): completed/success; Build on windows-latest (nightly): completed/success; Build on macos-latest (stable): completed/success; Generate Coverage Report: completed/success; Discover Package Coverage: completed/success; Docker E2E: completed/skipped; Workspace Packaging: completed/success; Layer Boundary Bans: completed/success; Unit (nightly): completed/success; Shipped Features: completed/success; Unit (stable): completed/success; Documented Clippy Allows: completed/success; Docs Lint: completed/success". At posting, develop is 4c8c88c0b.

@da2ce7

da2ce7 commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

ACK 590d93f — every code, line and number claim in the spec, evidence and audit recomputed at this head against abd7a10, the evidence diff reapplied, and the audit validator's logic passed offline

@josecelano-bot

Copy link
Copy Markdown
Contributor Author

F2 (review 5913009678): fixed outside the tree. I edited the PR description. Its Files list now names docs/pr-reviews/pr-2868-review/PR-REVIEW.md and the new V3 evidence files. Its Validation section now says the pre-commit hook passes on every commit of the branch, not "on both commits", and it adds the V3 rerun. The Summary now plans three regression tests (see F1). This comment is the resolution reference for F2 in the audit record.

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed at e6f6869bf28725e93955fed5b81f5adf9661a495. Recomputed from the bytes at this head, against the merge base abd7a10ff; git merge-tree against develop 4c8c88c0b merges cleanly with no conflict, and none of the 31 commits develop gained since the merge base touches the changed paths or the cited code.

Process: the same governing skills as round one; this round adds six commits on 590d93f78, five to the spec and evidence and one to the audit, each matching its subject.

The change against its claim: F1 is fixed: plan row T3 keeps the V1 test as the AC2 contract test before the check fix, the ACs name T2, T3 and T5, and the renumbered plan and commit points leave no stale task reference. F2 is fixed in the description, which now names the audit and the V3 files. F3 is fixed and matches client.rs. F4 is fixed, and I accept the stated deviation: the V2 diff stays as it ran and the corrected comment lives in the V3 diff. F5 is fixed by observation: the V3 diff differs from the V2 diff only in the index line, the comment and the assert_eq!, applies at the merge base to its stated blob, and its 13 tests fit 12 filtered out. 14d0fdb40 corrects stamps written ahead of time and keeps the correction visible.

Consistency: all eight relative links resolve; no dictionary change. The five new audit rows keep the reviewer's IDs on collision; source review, reply thread, severity bracket and resolution subject agree for each, the description fix cites the conversation comment that states it, and the log stamp follows the replies and precedes its commit. The validator's logic, run offline against the captured comments, reports six rows and no failure; every thread has a reply and is resolved.

Hygiene: six Conventional subjects with [#2867], author equals committer, one attribution footer each, which no rule in the tree governs; the commit-id check names no PR-branch id; no closing keyword. git diff --check flags only the same two log and diff artifacts in the new V3 files.

Findings: F6 (Minor) and F7 (Nit); none blocks.

Checked, no finding: last-updated-utc 21:31 follows the 21:28 to 21:29 V3 run; the round-one review now reads dismissed after the push, and the audit records its submitted state.

Checks

On the loop's compute node at this head, against the merge base abd7a10ff (receipt server-gates-kranich-911): the repository's pre-commit gate and lint roster exit 0 (227 s wall), and the review-audit validator reports 6 rows, 2 log entries and no failure. The PR changes documentation only, so no package tests apply. F6 checked against the bytes at posting: evidence/closed-port-value-check-run.log starts at Finished and differs from evidence/closed-port-run.log only in the build time (1.80 s against 2.08 s). GitHub checks at this head at posting time: "". At posting, develop is 4c8c88c0b.

@da2ce7

da2ce7 commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

ACK e6f6869 — the six round-two commits recomputed against the five round-one findings, the V3 evidence diff reapplied at abd7a10, and the audit validator's logic passed offline with six rows

@josecelano

Copy link
Copy Markdown
Member

ACK e6f6869

@josecelano
josecelano merged commit a359604 into torrust:develop Nov 16, 2026
19 checks passed
@josecelano-bot

Copy link
Copy Markdown
Contributor Author

Approval record for the two findings of the second da2ce7 review (F6 Minor, F7 Nit; review submitted 2026-11-16 06:01:56 UTC), written after the merge as a retrospective record of a chat decision.

On 2026-11-16, before the merge at 08:11:29 UTC, the maintainer chose to merge this spec PR as is and to handle F6 and F7 in the implementation PR for #2867. This comment is the durable record of that decision; it was written later, at this comment's creation time. The audit record of this PR will list the two findings as FOLLOW_UP, and their threads stay open until that implementation PR merges.

josecelano added a commit that referenced this pull request Nov 16, 2026
…h-check reply as an error instead of panicking

a7f184d docs(pr-reviews): [#2867] audit the third da2ce7 review of PR 2879 (josecelano-bot)
fe54dfe docs(issues): [#2867] record the replacement stopped-UDP test as AC4 coverage after the develop merge (josecelano-bot)
195f017 test(axum-health-check-api-server): [#2867] register T3 and start T5's API through the shared helpers (josecelano-bot)
93f392c docs(pr-reviews): [#2867] log the resolution of the second da2ce7 review of PR 2879 (josecelano-bot)
f2d3c11 docs(issues): [#2867] align the evidence with the redone T3 runs (josecelano-bot)
43f6b98 docs(pr-reviews): [#2867] log the resolution of the first Copilot review of PR 2879 (josecelano-bot)
99a3400 docs(issues): [#2867] record the T3 runs redone with the runtime-owned junk peer (josecelano-bot)
9741001 test(axum-health-check-api-server): [#2867] run the T3 junk-answering peer as a task of the test runtime (josecelano-bot)
3d214dd docs(pr-reviews): [#2867] log the resolution of the first da2ce7 review of PR 2879 (josecelano-bot)
99b44a3 docs(pr-reviews): [#2867] state when the maintainer approved deferring the PR 2868 findings (josecelano-bot)
09a0ab2 docs(issues): [#2867] say which test-file state the T5 red run used (josecelano-bot)
2db87bf docs(issues): [#2867] correct four timestamps written ahead of their commits (josecelano-bot)
35f77c2 docs(pr-reviews): [#2867] record the deferred second da2ce7 review of PR 2868 as follow-ups (josecelano-bot)
28a7edf docs(issues): [#2867] record the regression tests, the fix recheck and the deferred PR 2868 findings (josecelano-bot)
52297a9 fix(axum-health-check-api-server): [#2867] report a failed check job instead of panicking (josecelano-bot)
19da988 fix(tracker-client): [#2867] return an error from the UDP health check on an invalid response (josecelano-bot)

Pull request description:

  Closes #2867

  ## Summary

  Implements the spec merged in #2868. A UDP tracker that answers the health check with a datagram that is not a valid tracker response made `GET /health_check` panic three times in a chain, so the client got no report at all. Now the client gets a `200` report with status `Error`, and the UDP detail is an `Err(..)` that names the unrecognized response.

  - `torrust_tracker_client::udp::client::check` returns the receive error's text instead of calling `unwrap()` on it. Its stale `# Panics` doc comment now documents the errors.
  - The health-check handler reports a probe job that panicked or was cancelled (`JoinError`) as a failed check for that service, and logs it at `error` level. The report futures are awaited in place instead of spawned, so building the report cannot panic and the other services' results stay intact.

  ## Regression tests

  Each test was proven red against the bug; the red and green logs are in the issue folder's `evidence/`.

  - T2, `tracker-client` unit test: `check` against a UDP socket that answers with junk bytes returns an error naming the cause (AC1).
  - T3, health-check contract test: the junk-answering socket, registered with the production `Launcher::check`, gives a `200` report with status `Error` and an error detail naming the cause (AC2). Its red run is a mutate-then-restore run with the `check` fix reverted.
  - T5, health-check contract test: a probe whose job panics, next to a passing probe, gives a `200` report with an `Err(..)` detail for the panicking service and `Ok("200 OK")` for the other (AC3).

  ## Files

  - `packages/tracker-client/src/udp/client.rs`: the `check` fix and T2.
  - `packages/axum-health-check-api-server/src/handlers.rs`: the handler fix.
  - `packages/axum-health-check-api-server/tests/server/contract.rs`: T3 and T5, which use the shared test helpers that the #2393 work added (T3 for registration and API start, T5 for API start).
  - `docs/issues/open/2867-udp-health-check-panics-on-invalid-response/`: spec progress, the regression-test logs, and the V4 like-for-like recheck in `manual-verification-evidence.md`.
  - `docs/pr-reviews/pr-2868-review/PR-REVIEW.md`: records the two findings of the second da2ce7 review of #2868 (its F6 and F7) as follow-ups handled here.
  - `docs/pr-reviews/pr-2879-review/PR-REVIEW.md`: the review audit record for this PR.

  ## Deferred findings from #2868

  The maintainer merged #2868 with two non-blocking findings deferred to this PR (approval record: #2868 (comment)). F6: the evidence now says that the stored V1 to V3 logs start at `Finished` and that the V3 rebuild was not kept; every new log keeps its build lines. F7: the artifact-under-test line names the V3 diff.

  ## Validation

  - Stable Rust toolchain (`rustc 1.99.1`): `cargo test -p torrust-tracker-client-lib -p torrust-tracker-axum-health-check-api-server -p torrust-tracker-udp-server` passes.
  - AC4: the stopped-UDP contract test, then ignored by default (#2393), passed when run with `--ignored`, still reporting exactly `Err("Timed Out")`. The #2393 rewrite, merged here with `develop`, replaced it with `it_should_return_error_when_the_registered_udp_service_never_answers_the_check`, which runs by default and passes with the same value (`evidence/never-answering-udp-run.log`).
  - `linter all` passes, and the pre-commit and pre-push hooks pass.

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

ACKs for top commit:
  da2ce7:
    ACK a7f184d — the fixes, T3 and T5 on the shared helpers, AC4's replacement coverage after the develop merge, and an audit record covering all nine review threads recomputed against e784919
  josecelano:
    ACK a7f184d

Tree-SHA512: 9808e4dc837695f252a7b0d15b24eef85a79a01384157d460623e93ed83708126633b086698f86fc620fc2815cec8d7800a18ced2b631fe9cbefd3a5937341f2
josecelano added a commit that referenced this pull request Nov 16, 2026
…nic issue

50ab209 docs(pr-reviews): [#2867] link the PR 2885 audit to the moved process-pr-review skill (josecelano-bot)
356efc0 docs(pr-reviews): [#2867] audit the second da2ce7 review of PR 2885 (josecelano-bot)
9c11ca9 docs(pr-reviews): [#2867] record the Copilot review of PR 2885 as a re-raise of F1 (josecelano-bot)
0e616b1 docs(pr-reviews): [#2867] audit the first da2ce7 review of PR 2885 (josecelano-bot)
f3f3c16 docs(issues): [#2867] leave the reviewer checkpoint open (josecelano-bot)
a70c193 docs(pr-reviews): [#2867] cite the fix commit as the resolution of the PR 2868 follow-ups (josecelano-bot)
b2bccc0 docs(pr-reviews): [#2867] close the PR 2868 follow-up findings after PR 2879 merged (josecelano-bot)
845accc chore(issues): archive closed issue #2867 spec to docs/issues/closed (josecelano-bot)

Pull request description:

  Close-out for #2867 after #2879 merged. Documentation only; no code changes.

  ## Changes

  - Archive the #2867 spec folder from `docs/issues/open/` to `docs/issues/closed/`. The spec now has `status: done`, `related-pr: 2879`, the new `spec-path`, the remaining workflow checkpoints ticked except "Reviewer validated acceptance criteria", and progress-log entries for the merge and this close-out. The reviewer checkpoint stays open: the approving reviews of #2879 validated the criteria, but no reviewer edited the boxes. The evidence file and the PR 2879 audit point at the new path.
  - Close the loop on the two #2868 findings deferred to #2879 (audit rows F7 and F8, da2ce7's F6 and F7 there). Both are now `FIXED`/`RESOLVED`. Their resolution reference is the follow-up's fix commit, `docs(issues): [#2867] record the regression tests, the fix recheck and the deferred PR 2868 findings`, and their Solution names the #2879 merge commit. Their Reply URLs are the closing replies, which carry the merge reference; both threads are resolved, and a GraphQL refresh shows no unresolved thread on #2868. The verification greps say they run at this PR's head, where the spec folder is closed.
  - Add this PR's review audit, `docs/pr-reviews/pr-2885-review/PR-REVIEW.md`: da2ce7's F1 to F4 (all fixed), Copilot's re-raise of F1 (F5, superseded by F1), and da2ce7's F9 (this description, fixed by editing it) and F11 (a push recorded before it happened, fixed in the audit).

  - Merge `develop` after #2886 moved the agent skills to `.claude/skills/`. GitHub reported a conflict on the moved spec; git's rename detection carries #2886's skill-path updates into `docs/issues/closed/2867-.../ISSUE.md` with no conflict. This PR's own audit then links the moved `process-pr-review` skill, as the template does; the older audits keep the old paths, which now lead to redirect stubs.

  The audits' verification greps that name the old `docs/issues/open/...` path record checks made at that time. They are kept on purpose, as the cleanup-completed-issues skill allows for historical records.

  ## History rewrite

  To remove a closing-keyword match from a commit body (review finding F2), the branch was rebuilt on the same base with the archive commit's body reworded, and force-pushed with `--force-with-lease`. Every commit was kept, and the final tree did not change. The review audit maps the two pre-rewrite commit ids to their subjects.

  ## Validation

  - `linter markdown` and `linter cspell` pass. The pre-commit hook passed when each commit was first made and on the reworded archive commit; the three commits replayed after it by `git cherry-pick` keep the trees that passed.
  - `validate-audit-record.py`, run with its GitHub calls sent through the bot account, reports `status ok` with 0 failures on the PR 2868 record and on this PR's record.
  - The `open-pull-request` closing-keyword scan matches nothing in the title, the description or the commit messages.

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

ACKs for top commit:
  da2ce7:
    ACK 50ab209 — the develop merge (tree equal to a clean merge), the moved-skill link and the unchanged close-out, description and audit record (seven threads, validator logic 0 failures) recomputed against 9e463cb
  josecelano:
    ACK 50ab209

Tree-SHA512: c5a57325687150517fe389a4a3de07ca59154d136d1178540b661c414aa03c65133b238fd74d291eb102e74797f32f3244ad1ed0b64d58b5d1fdf479c6297046

This branch was previously deployed

1 inactive deployment
coverage — e6f6869b Deployed Nov 16, 2026 by josecelano-bot via Generate Coverage Report #3198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants