fix(cli): render sub-millisecond timer inputs correctly in dora node info - #2859
Conversation
… info`
`build_input_info` reconstructed every timer input source as
`dora/timer/millis/{interval.as_millis()}`. `Duration::as_millis()`
floors to 0 for any sub-millisecond interval, so a valid high-rate
timer input such as `dora/timer/hz/2000` (500µs) was displayed as
`dora/timer/millis/0` — a nonsensical zero-interval source that no
longer round-trips through the descriptor parser. Whole-Hz timers like
`dora/timer/hz/3` were also rendered lossily as `millis/333`.
Use `InputMapping`'s canonical `Display` instead of re-deriving the
source string by hand. `Display` already picks the coarsest exact unit
(secs/millis/micros/nanos) and is the form the descriptor round-trips
through; the `User` and `Logs` arms rendered identically to it anyway,
so this also removes a small hand-rolled reimplementation of the trait.
The sub-millisecond round-trip is already covered by dora-message's
`timer_subms_interval_roundtrips` test.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0142J7B2578ixrh77kNDNJry
|
😎 Merged successfully - details. |
Automated review run summaryThis PR is one of a batch opened by an automated Claude Code review pass over Opened PRsCorrectness
Robustness / security
Rejected findings (verified, deliberately not filed)
ValidationPer-PR: Generated by Claude Code |
|
Automated review by Claude — this is a fully automated review; no human has vetted it. No issues found. Delegating to Generated by Claude Code |
|
@phil-opp the Trunk merge queue failed for this PR. See the Trunk merge-status comment for details. Posted as a new comment so GitHub sends an email — Trunk's sticky comment is edited in place and won't trigger a notification. |
Issue
build_input_infoinbinaries/cli/src/command/node/info.rsreconstructed every timer input source by hand asdora/timer/millis/{interval.as_millis()}.Duration::as_millis()floors to0for any sub-millisecond interval, so a valid high-rate timer input such asdora/timer/hz/2000(500 µs) was displayed bydora node infoasdora/timer/millis/0— a nonsensical zero-interval source that no longer round-trips through the descriptor parser. Whole-Hz timers likedora/timer/hz/3(~333 ms) were also rendered lossily asmillis/333.Fix
Use
InputMapping's canonicalDisplayimpl (libraries/message/src/config.rs) instead of re-deriving the source string.Displayalready selects the coarsest exact unit (secs/millis/micros/nanos) and is the form the descriptor round-trips through. TheUserandLogsarms of the old hand-rolledmatchrendered identically toDisplayanyway, so this also removes a small reimplementation of the trait —build_input_infonow just callsinput.mapping.to_string().Validation
timer_subms_interval_roundtripstest, which guaranteesDisplaynever truncates.cargo test -p dora-cli,cargo clippy -p dora-cli --all-targets -- -D warnings, andcargo fmt --all -- --checkall pass.🤖 This is a machine-generated pull request opened by Claude Code. A human maintainer should review before merging.
🤖 Generated with Claude Code
https://claude.ai/code/session_0142J7B2578ixrh77kNDNJry
Generated by Claude Code