Repository navigation
Description
Goal
Expose an unambiguous updated_at_ms peer timestamp in the current v1 REST API while preserving both existing timestamp fields for v1 client compatibility. Mark the misnamed updated_milliseconds_ago field as deprecated so clients can migrate before API v2 uses only the corrected name.
Problem
The v1 peer DTO field updated_milliseconds_ago behaves as an absolute Unix timestamp in milliseconds, although its _ago suffix implies a relative duration. Both it and the deprecated updated field hold the same value.
Scope
In Scope
- Add a required
updated_at_ms: u128field to the v1Peerprotocol DTO. - Serialize and deserialize it as an absolute Unix timestamp in milliseconds since epoch.
- Retain
updatedand deprecateupdated_milliseconds_agoin v1. - Populate all three timestamp fields from the same domain timestamp.
- Add independent conversion and raw JSON contract coverage.
- Update endpoint and Rust API documentation.
Out of Scope
- Removing or renaming legacy fields in v1.
- Changing
DurationSinceUnixEpochor domainpeer::Peer. - Any API v2 implementation.
- Retroactively changing closed issue SI-33: Define REST API contract-first package architecture for EPIC #1669 #1930.
Acceptance Criteria
- The v1
PeerDTO has a requiredupdated_at_ms: u128field documented as an absolute Unix-millisecond timestamp. from_domain_peermapsupdated_at_msfromDurationSinceUnixEpoch::as_millis().- Until API v2,
updated,updated_milliseconds_ago, andupdated_at_msare serialized with equal values; the legacy fields are deprecated and direct consumers toupdated_at_ms. - The v1 torrent endpoint documentation accurately describes the timestamp fields.
- API v2 uses
updated_at_msand omits both legacy fields. linter all, relevant tests, applicable pre-push checks, and mandatory manual verification pass.
Verification
Automatic checks: focused protocol, runtime-adapter, and Axum REST API tests; cargo test --test integration; nightly documentation; linter all; and applicable pre-push checks.
Manual checks: inspect a local tracker’s v1 torrent response after announcing a peer; verify all three timestamp keys are present and equal; deserialize through the typed client; and inspect generated endpoint and Peer documentation.
References
- Historical analysis: SI-33: Define REST API contract-first package architecture for EPIC #1669 #1930
- Related ADR:
docs/adrs/20260623200526_adopt_contract-first_architecture_for_rest_api.md
Activity
docs(issues): clarify scope for torrust#2130
docs(issues): record implementation verification for torrust#2130
docs(issues): record manual verification for torrust#2130
docs(issues): complete review for torrust#2130
docs(issues): mark torrust#2130 in review
docs(issues): add issue specification for #2130
Merge torrust#2131: feat(rest-api): [torrust#2130] add peer updated-a…