mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
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:
@@ -311,14 +311,21 @@ fn partial_cells_use_the_midpoint_and_descend_from_the_baseline() {
|
||||
|
||||
#[test]
|
||||
fn oversized_axes_are_hidden_instead_of_truncated() {
|
||||
let day = AccountAnalyticsDay {
|
||||
date: "2026-01-15".parse().unwrap(),
|
||||
total: 100_000_000.0,
|
||||
values: vec![value("a", /*value*/ 100_000_000.0)],
|
||||
};
|
||||
let days = [(day.date, Some(&day))];
|
||||
let mut snapshots = Vec::new();
|
||||
for width in [8, 30, 35, 44] {
|
||||
for (width, total) in [
|
||||
(8, 100_000_000.0),
|
||||
(30, 100_000_000.0),
|
||||
(35, 100_000_000.0),
|
||||
(44, 100_000_000.0),
|
||||
(30, 1e30),
|
||||
] {
|
||||
let day = AccountAnalyticsDay {
|
||||
date: "2026-01-15".parse().unwrap(),
|
||||
total,
|
||||
values: vec![value("a", total)],
|
||||
};
|
||||
let days = [(day.date, Some(&day))];
|
||||
|
||||
let rendered = chart(
|
||||
&days,
|
||||
&day.values,
|
||||
@@ -328,9 +335,9 @@ fn oversized_axes_are_hidden_instead_of_truncated() {
|
||||
AccountAnalyticsUnit::Tokens,
|
||||
);
|
||||
let baseline = rendered.lines[5].to_string();
|
||||
assert_eq!(baseline.starts_with('─'), width < 36);
|
||||
assert_eq!(baseline.starts_with('─'), width < 30 || total == 1e30);
|
||||
if width == 8 {
|
||||
assert!(rendered.lines[0].to_string().trim().is_empty());
|
||||
assert!(rendered.lines[0].to_string().contains("100M"));
|
||||
}
|
||||
snapshots.push(format!("width={width}\n{}", display(&rendered)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user