Add an account Summary tab to Analytics (#45769)

## What changed

- Make Summary the initial Analytics tab, showing profile identity, token totals, streaks, activity insights, and most-used plugins and skills.
- Move daily, weekly, and cumulative token activity charts into Summary. Replace the usage menu's separate views with “View analytics”; `/usage weekly` and the other explicit modes open Summary with the requested view, while reopening from the menu retains navigation.
- Load account profiles independently of other reports, preserve missing values separately from zero, and reject responses when the active account changes. Refresh retries profile failures.
- Adapt Summary to narrow terminals and compact large chart totals and axis labels. Show the account email without its ID in the Analytics header.
- Flush queued transcript history before opening an overlay so startup output stays in the transcript.

## Testing

Add profile decoding and account identity tests, Summary layout and navigation snapshots, refresh and cancellation coverage, and regression tests for retained navigation and transcript history when opening Analytics.

GitOrigin-RevId: 6dbe6c4c98209000d8b4bc18a4e01b98fab5991a
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-09-15 19:13:08 +00:00
1 parent 8f0d2459ac
commit 9bd49c9dcc
122 files changed
+3685 -1980

No files matched your search

@@ -7,10 +7,10 @@ use pretty_assertions::assert_eq;
#[test]
fn analytics_tools_reflow_and_keep_independent_days() {
let mut view = fixture::view(models::AccountKind::Consumer);
press(&mut view, KeyCode::Char('3'));
press(&mut view, KeyCode::Char('4'));
let wide = screen(&mut view, /*width*/ 140, /*height*/ 48);
assert!(wide.contains("186 calls"));
press(&mut view, KeyCode::Char('4'));
press(&mut view, KeyCode::Char('5'));
press(&mut view, KeyCode::Left);
press(&mut view, KeyCode::Enter);
assert_eq!(
@@ -56,7 +56,7 @@ fn analytics_tools_handle_empty_days_and_independent_failures() {
}
history.data.remove(/*index*/ 5);
view.sections[Section::Skills].history = Load::Ready(history);
press(&mut view, KeyCode::Char('4'));
press(&mut view, KeyCode::Char('5'));
let empty = screen(&mut view, /*width*/ 140, /*height*/ 44);
assert!(empty.contains("No uses reported for Sep 2."));
assert!(!empty.contains("details"));
@@ -73,7 +73,7 @@ fn analytics_tools_handle_empty_days_and_independent_failures() {
Load::Error("Skills could not be loaded. Press R to retry.".into());
let partial = screen(&mut view, /*width*/ 140, /*height*/ 44);
assert!(partial.contains("Skills could not be loaded"));
press(&mut view, KeyCode::Char('3'));
press(&mut view, KeyCode::Char('4'));
assert!(screen(&mut view, /*width*/ 140, /*height*/ 44).contains("186 calls"));
insta::assert_snapshot!(format!("{empty}\n{missing}\n{partial}"));
}