Repository navigation
fix(rust-sdk): treat an uptime-flagged ring timestamp as no usable time - #22481
Conversation
Custody firmware sets bit 31 when the RTC is unset. The low 31 bits are seconds since boot, and reading the raw word dates the recording in 2038. Match RingProtocol.readRecordTimestamp and return 0. Co-authored-by: nabilh <[email protected]>
|
Verdict: this fix is correct, tightly scoped, and matches the maintained client protocol — nothing blocking from my side. I verified it against
One non-blocking design note: 0 doubles as the "no usable clock" sentinel, so a real epoch of exactly 0 (1970-01-01) is indistinguishable — the same trade-off the Dart side makes, so consistency wins here. USER IMPACT: recordings captured before the ring's clock was set are no longer dated in 2038; they now carry "no usable time" (0), matching the phone app. Leaving for human maintainer review before merge. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Treats an uptime-flagged ring timestamp (high bit set) as no usable time instead of misreading it as a 2038 epoch date. Clear root cause, scoped diff, tests added. No CI has run on this PR yet (only cubic ran) so I can't confirm green -- approving only.
kodjima33
left a comment
There was a problem hiding this comment.
Re-checked from prior approve-pending-CI: mergeable=MERGEABLE (UNSTABLE is a non-required context, no failing required check). Uptime-flagged ring-timestamp fix matches app-side RingProtocol handling, scoped+tested. Confidence 4/5 holds. Merging.
What changed and why
omi-device::record_timestampread a ring record's 4-byte prefix as epoch seconds even when custody firmware sets bit 31. That flag means the RTC was unset and the low 31 bits are seconds since boot, which is howRingProtocol.readRecordTimestampinapp/lib/services/devices/ring_protocol.darttreats it. The raw word0x800004D2(1,234 seconds since boot) is 2,147,484,882, a date in 2038, so a caller would file the recording years in the future. A flagged timestamp now returns 0, the same "no usable time" result as the app. An ordinary epoch word whose high bit is clear is unchanged.No open issue tracks this helper. Nearby timestamp reports, including #20358, are a different offline-sync clock offset and already have a pull request.
Product invariants affected
none
How it was verified
From
sdks/rust/omi-device, with the stable toolchain (the crate's MSRV is 1.85; the image default is 1.83):cargo +stable fmt --checkcargo +stable clippy -- -D warningscargo +stable test --locked— 9 unit tests and 4 codec tests passed, 0 failedThe new tests decode a 444-byte record in memory. No pendant, Bluetooth adapter, or credentials are involved.
make preflightagainstorigin/main(325b7e3f2d) passed, 12 checks.Tests
epoch_ring_timestamp_keeps_its_secondsanduptime_flagged_ring_timestamp_is_not_epoch_timeinsdks/rust/omi-device/src/lib.rs. They cover epoch1234, the highest non-flag word0x7FFFFFFF, a flagged uptime of 1,234 seconds, and the flag alone. Before this change the flagged record returned2_147_484_882, so the new assertion fails on the old helper.UI evidence
UI-Evidence: none -- Rust protocol helper, no user interface.
Failure class (fixes)
Failure-Class: none
Prepared with AI assistance.