Skip to content

Add peer.updated_at_ms to v1 REST API #2130

Closed

Description

@josecelano

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: u128 field to the v1 Peer protocol DTO.
  • Serialize and deserialize it as an absolute Unix timestamp in milliseconds since epoch.
  • Retain updated and deprecate updated_milliseconds_ago in 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

Acceptance Criteria

  • The v1 Peer DTO has a required updated_at_ms: u128 field documented as an absolute Unix-millisecond timestamp.
  • from_domain_peer maps updated_at_ms from DurationSinceUnixEpoch::as_millis().
  • Until API v2, updated, updated_milliseconds_ago, and updated_at_ms are serialized with equal values; the legacy fields are deprecated and direct consumers to updated_at_ms.
  • The v1 torrent endpoint documentation accurately describes the timestamp fields.
  • API v2 uses updated_at_ms and 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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions