Skip to content

feat(http-tracker): [#2289] migrate HTTP tracker to token lifecycle - #2297

Merged
josecelano merged 3 commits into
torrust:developfrom
josecelano:2289-1488-si-11-migrate-http-tracker-token-lifecycle
Sep 22, 2026
Merged

josecelano merged 3 commits into
torrust:developfrom
josecelano:2289-1488-si-11-migrate-http-tracker-token-lifecycle

Conversation

@josecelano

Copy link
Copy Markdown
Member

Closes #2289

Summary

  • Add an additive token-aware HTTP server lifecycle that retains the Axum drain-controller handle.
  • Derive one child cancellation token per configured HTTP tracker instance and join server and controller children on every component terminal path.
  • Preserve the legacy HTTP start/stop API and add deterministic lifecycle, bootstrap propagation, and ownership tests.
  • Record direct tracker PID SIGTERM, listener-rebind, verification, retrospective, and independent-review evidence.

Validation

  • linter all
  • cargo test -p torrust-tracker-axum-http-server
  • cargo test -p torrust-tracker
  • TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-commit.sh
  • TORRUST_GIT_HOOKS_LOG_DIR=.tmp ./contrib/dev-tools/git/hooks/pre-push.sh
  • Direct target/debug/torrust-tracker PID SIGTERM twice: both exited 0, logged the token-aware HTTP drain, and rebound the HTTP listener.

Copilot AI lite review requested due to automatic review settings September 22, 2026 13:09

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

Review effort: Lite
Findings: 4 Medium severity · 1 Low severity

Open (5)
What changed in this PR

This PR migrates the HTTP tracker bootstrap/runtime to a token-driven lifecycle, ensuring the Axum drain controller is retained and joined deterministically while keeping the legacy start/stop API intact.

Changes:

  • Introduces TokenAwareServerTask to own and abort/join both the server task and its drain controller.
  • Adds a token-aware HttpServer::start_with_cancellation path returning both runtime and shutdown-controller handles.
  • Expands tests across bootstrap + HTTP server crates to validate cancellation, independent completion/failure, and bootstrap propagation.
File Description
src/​bootstrap/​jobs/​manager.rs Adds TokenAwareServerTask to encapsulate server + controller ownership.
src/​bootstrap/​jobs/​http_tracker.rs Switches HTTP tracker job to token-aware server start and supervises both task handles; adds lifecycle tests.
src/​app.rs Passes a per-instance child cancellation token into HTTP tracker bootstrap; adds propagation test.
packages/​axum-http-server/​src/​server.rs Adds token-aware server start returning task + drain-controller handles; refactors server future creation; adds tests.
docs/​issues/​open/​2289-1488-si-11-migrate-http-tracker-token-lifecycle/​*.md Updates verification/retrospective/evidence documents for the migration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/axum-http-server/src/server.rs Outdated
Comment thread packages/axum-http-server/src/server.rs Outdated
Comment thread packages/axum-http-server/src/server.rs Outdated
Comment thread packages/axum-http-server/src/server.rs Outdated
Comment thread packages/axum-http-server/src/server.rs Outdated
Copilot stopped reviewing on behalf of josecelano due to an error September 22, 2026 13:30
@josecelano josecelano self-assigned this Sep 22, 2026
@josecelano
josecelano force-pushed the 2289-1488-si-11-migrate-http-tracker-token-lifecycle branch from 0ea7772 to e6dba8c Compare September 22, 2026 15:54
@josecelano
josecelano force-pushed the 2289-1488-si-11-migrate-http-tracker-token-lifecycle branch from e6dba8c to d93f3eb Compare September 22, 2026 16:10
@josecelano
josecelano force-pushed the 2289-1488-si-11-migrate-http-tracker-token-lifecycle branch from d93f3eb to 5de3875 Compare September 22, 2026 17:04
@josecelano

Copy link
Copy Markdown
Member Author

ACK 5de3875

@josecelano
josecelano merged commit 9da90fc into torrust:develop Sep 22, 2026
21 checks passed
josecelano added a commit that referenced this pull request Sep 22, 2026
…ssues/closed

51e1b1b chore(issues): archive closed issue #2289 spec to docs/issues/closed (Jose Celano)

Pull request description:

  Archives the completed SI-11 specification for #2289 after PR #2297 merged and closed the issue.

  - Moved the issue folder and evidence from `docs/issues/open/` to `docs/issues/closed/`
  - Updated archived metadata: `status: done`, `spec-path`, `related-pr`, and closure checkpoint
  - Updated the live #1488 roadmap link and status to `Done`
  - Retained the PR #2291 review path as immutable historical context

  Validation: `linter markdown`, pre-commit, and pre-push passed.

ACKs for top commit:
  josecelano:
    ACK 51e1b1b

Tree-SHA512: d6ea6eddbce8e014e3ef68ed0f3e75a24ea34fdcdbe9e52083511a2eb5e6e058af1734782adae0df694ddf336087767536e7a75e9809e4a8609f3b0441587344

This branch was successfully deployed

1 active deployment
coverage — 5de38752 Deployed Sep 22, 2026 by josecelano via Generate Coverage Report #2262
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.

Migrate HTTP tracker to token lifecycle

2 participants