From dd32766c558572a3344fe01b58f0811c295b9c9a Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 27 Jul 2026 23:28:00 +0000 Subject: [PATCH] fix(cli): render sub-millisecond timer inputs correctly in `dora node info` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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 Claude-Session: https://claude.ai/code/session_0142J7B2578ixrh77kNDNJry --- binaries/cli/src/command/node/info.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/binaries/cli/src/command/node/info.rs b/binaries/cli/src/command/node/info.rs index 4ea372e487..ba3b6b2cb1 100644 --- a/binaries/cli/src/command/node/info.rs +++ b/binaries/cli/src/command/node/info.rs @@ -230,18 +230,16 @@ fn build_input_info(node_desc: &dora_message::descriptor::Node) -> Vec format!("{}/{}", user.source, user.output), - InputMapping::Timer { interval } => { - format!("dora/timer/millis/{}", interval.as_millis()) - } - mapping @ InputMapping::Logs(_) => mapping.to_string(), - }; - InputInfo { - id: input_id.to_string(), - source, - } + .map(|(input_id, input)| InputInfo { + id: input_id.to_string(), + // Use `InputMapping`'s canonical `Display` rather than re-deriving the + // source string here. The previous hand-rolled + // `dora/timer/millis/{interval.as_millis()}` truncated any + // sub-millisecond timer (e.g. a `dora/timer/hz/2000` = 500µs input) + // to `dora/timer/millis/0`, a nonsensical zero-interval source; + // `Display` picks the coarsest exact unit and round-trips through the + // descriptor parser. + source: input.mapping.to_string(), }) .collect() }