Skip to content

Commit 032ddbb

Browse files
zy1233cursoragentz123385708
authored
test(tui): make the prompt history tick test wait for a fresh daemon result (#65)
activate() copies the daemon snapshot at once, so a quick daemon had already delivered both entries and tick() never saw a newer generation. Ask the daemon for a new generation after activate and wait for tick() to deliver it. Co-authored-by: Cursor Agent <[email protected]> Co-authored-by: z123385708 <[email protected]>
1 parent 25f92bc commit 032ddbb

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎tui/crates/codegen/pi-pager/src/app/app_view_tests.rs‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,21 @@ fn needs_animation_gates_prompt_history_tick_delivery() {
463463
app.needs_animation(),
464464
"an open prompt history overlay must request animation ticks"
465465
);
466+
// `activate` already copied whatever the daemon had published, so that
467+
// snapshot may hold both entries before the first tick (the daemon is
468+
// quick) or none (it is slow). `tick()` only reports a change for a newer
469+
// generation. Ask for a fresh one, which the daemon publishes after
470+
// `activate` took its copy whichever case happened, then wait for `tick()`
471+
// to deliver it. The deadline only ends a hang; a pass returns at once.
472+
app.agents
473+
.get_mut(&id)
474+
.unwrap()
475+
.prompt
476+
.history_search
477+
.update_query("");
478+
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(30);
466479
let mut delivered = false;
467-
for _ in 0..1000 {
480+
while std::time::Instant::now() < deadline {
468481
if app.tick() && app.agents[&id].prompt.history_search.result_count() == 2 {
469482
delivered = true;
470483
break;

0 commit comments

Comments
 (0)