Skip to content

feat(primitives): add runtime service identity types - #2042

Merged
josecelano merged 3 commits into
torrust:developfrom
josecelano:2036-add-runtime-service-registry-metadata
Jul 29, 2026
Merged

feat(primitives): add runtime service identity types#2042
josecelano merged 3 commits into
torrust:developfrom
josecelano:2036-add-runtime-service-registry-metadata

Conversation

@josecelano

Copy link
Copy Markdown
Member

Summary

Defines the tracker-owned canonical runtime identity foundation for #2036.

Validation

  • Focused package tests for primitives, HTTP server, REST API server, and UDP server.
  • Pre-commit checks.
  • Pre-push checks, including nightly workspace checking/documentation and the full stable test suite.

Scope

This PR deliberately does not implement duplicate-port-zero bootstrap propagation (#2035), registry metadata/query APIs (#2041), or event-metrics normalization (#2039).

Closes #2036

Copilot AI review requested due to automatic review settings July 29, 2026 16:58
@josecelano josecelano self-assigned this Jul 29, 2026

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.

Pull request overview

This PR establishes tracker-owned, canonical runtime identity types in torrust-tracker-primitives (service role + role-qualified configuration instance identity) to serve as the shared foundation for upcoming bootstrap/registry/metrics follow-ups (#2035, #2041, #2039). It also removes ad-hoc health-check “type string” constants in server launchers and derives those labels from the new canonical ServiceRole, preserving the existing tracker_rest_api value.

Changes:

  • Added ServiceRole (serde-stable role identifiers + as_str/Display) and ConfigurationInstanceId (role + zero-based index) with unit tests.
  • Updated HTTP, REST API, and UDP health-check job construction to use ServiceRole identifiers instead of local TYPE_STRING constants.
  • Updated issue specifications (#2036, #2035) with approved design decisions, progress, and updated tracking.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/primitives/src/service_role.rs Introduces canonical service-role enum with stable identifiers and tests.
packages/primitives/src/configuration_instance_id.rs Introduces role-qualified, zero-based configuration instance identity with tests.
packages/primitives/src/lib.rs Exposes the new identity types via module exports and re-exports.
packages/axum-http-server/src/server.rs Uses ServiceRole to label the HTTP tracker health-check job.
packages/axum-rest-api-server/src/server.rs Uses ServiceRole to label the REST API health-check job (preserving tracker_rest_api).
packages/udp-server/src/server/launcher.rs Uses ServiceRole to label the UDP tracker health-check job.
docs/issues/open/2036-add-runtime-service-registry-metadata/ISSUE.md Records approved identity design decisions and marks implementation/verification as done.
docs/issues/open/2035-fix-duplicate-port-zero-tracker-instance-bootstrap/ISSUE.md Clarifies phased delivery plan and updates tracking based on the #2036 handoff.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.57%. Comparing base (dc5fa68) to head (7a07fff).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2042   +/-   ##
========================================
  Coverage    81.57%   81.57%           
========================================
  Files          344      344           
  Lines        24645    24653    +8     
  Branches     24645    24653    +8     
========================================
+ Hits         20103    20111    +8     
  Misses        4238     4238           
  Partials       304      304           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@josecelano

Copy link
Copy Markdown
Member Author

ACK 7a07fff

@josecelano
josecelano merged commit 6af41e4 into torrust:develop Jul 29, 2026
18 checks passed
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.

Define canonical runtime service identity

2 participants