mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Add gated plan usage history to TUI analytics (#45766)
## What changed - Add consumer plan usage history behind `analytics_plan_history`, disabled by default, fetching seven days of five-hour and weekly allowance periods. - Show period usage percentages with expandable breakdowns by feature, model, surface, or turn start, plus snapshot freshness and incomplete coverage indicators. - Preserve unknown usage separately from zero and handle an unavailable history endpoint without blocking other analytics reports. ## Testing Add backend and TUI tests for unavailable endpoints, response validation, feature and account gating, account changes during requests, period navigation, snapshot resets, and narrow and wide layouts. GitOrigin-RevId: 7bea87a3407730b18040d7dda7e7dd0afe67fb2e
This commit is contained in:
1 parent
0e7ab7c1b5
commit
0d0979f457
23 files changed
+1062
-18
No files matched your search
@@ -92,7 +92,8 @@ impl AnalyticsView {
|
||||
pub(super) fn render(&mut self, area: Rect, buf: &mut Buffer) {
|
||||
self.poll_reports();
|
||||
let width = usize::from(area.width.saturating_sub(/*rhs*/ 4)).max(/*other*/ 1);
|
||||
let show_range = self.section != Section::Chats && !self.visible_sections().is_empty();
|
||||
let show_range = !matches!(self.section, Section::Chats | Section::Plan)
|
||||
&& !self.visible_sections().is_empty();
|
||||
let hint = |action| {
|
||||
self.keymap
|
||||
.primary_hint(action)
|
||||
@@ -112,6 +113,15 @@ impl AnalyticsView {
|
||||
} else {
|
||||
let navigation = if !self.zoomed {
|
||||
format!("{}/z maximize", hint(ListAction::Accept))
|
||||
} else if self.section == Section::Plan {
|
||||
format!(
|
||||
"{}/{} window · {}/{} period · {} details",
|
||||
hint(ListAction::MoveLeft),
|
||||
hint(ListAction::MoveRight),
|
||||
hint(ListAction::MoveUp),
|
||||
hint(ListAction::MoveDown),
|
||||
hint(ListAction::Accept)
|
||||
)
|
||||
} else if self.section != Section::Chats {
|
||||
format!(
|
||||
"{}/{} day · {} details",
|
||||
|
||||
Reference in new issue
Block a user