fix(timeline): report true total_events in robot JSON meta
The robot JSON envelope's meta.total_events field was incorrectly reporting events.len() (the post-limit count), making it identical to meta.showing. This defeated the purpose of having both fields. Changes across the pipeline to fix this: - collect_events now returns (Vec<TimelineEvent>, usize) where the second element is the total event count before truncation - TimelineResult gains a total_events_before_limit field (serde-skipped) so the value flows cleanly from collect through to the renderer - main.rs passes the real total instead of the events.len() workaround Additional cleanup in this pass: - Derive PartialEq/Eq/PartialOrd/Ord on TimelineEventType, replacing the hand-rolled event_type_discriminant() function. Variant declaration order now defines sort tiebreak, documented in a doc comment. - Validate --since input with a proper LoreError::Other instead of silently treating invalid values as None - Fix ANSI-aware tag column padding with console::pad_str (colored tags like "[merged]" were misaligned because ANSI escapes consumed width) - Remove dead print_timeline_json and infer_max_depth functions that were superseded by print_timeline_json_with_meta Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1416,12 +1416,9 @@ fn handle_timeline(
|
||||
let result = run_timeline(&config, ¶ms)?;
|
||||
|
||||
if robot_mode {
|
||||
// total_events_before_limit: the result already has events truncated,
|
||||
// but we can compute it from the pipeline if needed. For now, use events.len()
|
||||
// since collect_events already applied the limit internally.
|
||||
print_timeline_json_with_meta(
|
||||
&result,
|
||||
result.events.len(),
|
||||
result.total_events_before_limit,
|
||||
params.depth,
|
||||
params.expand_mentions,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user