Files
codex/codex-rs/tui/src/app/safety_buffering_tests.rs
T
Felipe Coury dbcd837c20 Paginate TUI transcript history (#36950)
## What changed

- Load older transcript items in bounded pages as users scroll upward, and let `Home` continue fetching until the start of the thread.
- Show loading, partial-history, retry, and complete states in the transcript overlay while preserving the visible scroll position as pages are prepended.
- Use paginated history for resume, fork, retry, and prompt-edit flows, while falling back to legacy history requests when the app server does not support pagination.

## Testing

- Cover multi-page transcript loading, page-boundary prompt reconciliation, legacy-server fallback, bounded retry history, and transcript history-state rendering.

GitOrigin-RevId: cc6b764bc4185d079b2f68bedf235c1d08278dfb
2026-08-04 19:12:46 +00:00

45 lines
1.3 KiB
Rust

use super::*;
use codex_app_server_protocol::TurnItemsView;
fn turn(id: &str, status: TurnStatus) -> Turn {
Turn {
id: id.to_string(),
items: Vec::new(),
items_view: TurnItemsView::Full,
status,
error: None,
started_at: None,
completed_at: None,
duration_ms: None,
}
}
#[test]
fn retry_rejects_a_stale_or_in_progress_turn() {
let stale = vec![
turn("turn-1", TurnStatus::Interrupted),
turn("turn-2", TurnStatus::InProgress),
];
let in_progress = vec![turn("turn-1", TurnStatus::InProgress)];
let previous_in_progress = vec![
turn("turn-1", TurnStatus::InProgress),
turn("turn-2", TurnStatus::Interrupted),
];
assert!(safety_retry_fork_point(&stale, "turn-1").is_err());
assert!(safety_retry_fork_point(&in_progress, "turn-1").is_err());
assert!(safety_retry_fork_point(&in_progress, "missing").is_err());
assert!(safety_retry_fork_point(&previous_in_progress, "turn-2").is_err());
}
#[test]
fn retry_accepts_a_targeted_latest_turn_and_its_completed_predecessor() {
let turns = vec![
turn("turn-1", TurnStatus::Completed),
turn("turn-2", TurnStatus::Interrupted),
];
assert!(safety_retry_fork_point(&turns, "turn-2").is_ok());
assert!(safety_retry_fork_point(&turns[1..], "turn-2").is_ok());
}