mirror of
https://github.com/openai/codex.git
synced 2026-11-26 23:40:43 +00:00
## 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
29 lines
1.1 KiB
Rust
29 lines
1.1 KiB
Rust
//! In-flight profile responses cannot expose data after the active account changes.
|
|
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[tokio::test]
|
|
async fn profile_rejects_account_change_during_success_or_error_response() {
|
|
let server = MockServer::start().await;
|
|
for status in [200, 404, 503] {
|
|
server.reset().await;
|
|
let (home, live) = live(&server, "plus").await;
|
|
let home_path = home.path().to_path_buf();
|
|
Mock::given(method("GET"))
|
|
.and(path("/backend-api/wham/profiles/me"))
|
|
.and(header("chatgpt-account-id", "account-a"))
|
|
.respond_with(move |_: &wiremock::Request| {
|
|
sign_in(&home_path, "account-a", "user-b", "plus");
|
|
ResponseTemplate::new(status)
|
|
.set_body_json(json!({"stats":{"lifetime_tokens":123}}))
|
|
})
|
|
.expect(/*r*/ 1)
|
|
.mount(&server)
|
|
.await;
|
|
assert_eq!(
|
|
live.profile().await.err().unwrap(),
|
|
"Account changed. Press R to refresh Analytics."
|
|
);
|
|
}
|
|
}
|