From 6b5e6ae6431cd50b78697aa2eac896696202d806 Mon Sep 17 00:00:00 2001 From: zerob13 Date: Fri, 20 Nov 2026 14:50:09 +0800 Subject: [PATCH] test(app-server): settle context usage before comparing exports The export flow copies the live database and then exports both. The branch is idle by then, but ContextUsage may still append its `context-usage/recovered` fact, so the live export can hold one event the copy lacks. Reading `session.context.usage` on both branches first waits for that write. Seen on the Linux verification trial (run 44684351971); reproduced locally 1 of 12 under CPU load, 0 of 60 with the read. Refs #1919 --- .../dim-app-server/tests/transport_flow/timeline_export.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/dim-app-server/tests/transport_flow/timeline_export.rs b/crates/dim-app-server/tests/transport_flow/timeline_export.rs index 32828949d9..798be8abbd 100644 --- a/crates/dim-app-server/tests/transport_flow/timeline_export.rs +++ b/crates/dim-app-server/tests/transport_flow/timeline_export.rs @@ -397,6 +397,13 @@ async fn timeline_export_reads_a_live_product_home_and_its_copies() { assert_ok(&branched); let child = branched["result"]["branch"]["branchId"].as_str().unwrap().to_owned(); idle(&mut client, &sid, &child).await; + for branch in ["main", child.as_str()] { + assert_ok( + &client + .rpc("session.context.usage", json!({"sessionId":sid,"branchId":branch})) + .await, + ); + } let copy = directory.join("copies/backup.sqlite"); backup(&database, ©);