feat(primitives): add runtime service identity types - #2042
Conversation
There was a problem hiding this comment.
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) andConfigurationInstanceId(role + zero-based index) with unit tests. - Updated HTTP, REST API, and UDP health-check job construction to use
ServiceRoleidentifiers instead of localTYPE_STRINGconstants. - 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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
ACK 7a07fff |
Summary
Defines the tracker-owned canonical runtime identity foundation for #2036.
ServiceRoleandConfigurationInstanceIdtotorrust-tracker-primitives.ServiceRolewhile preserving thetracker_rest_apiresponse value.Validation
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