-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathcompaction.rs
More file actions
113 lines (103 loc) · 3.88 KB
/
Copy pathcompaction.rs
File metadata and controls
113 lines (103 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
use github_copilot_sdk::rpc::{LogRequest, SessionLogLevel};
use super::support::with_e2e_context;
#[tokio::test]
async fn should_return_empty_handoff_summary_for_fresh_session() {
with_e2e_context(
"compaction",
"should_return_empty_handoff_summary_for_fresh_session",
|ctx| {
Box::pin(async move {
ctx.set_default_copilot_user();
let client = ctx.start_client().await;
let session = client
.create_session(ctx.approve_all_session_config())
.await
.expect("create session");
let summary = session
.rpc()
.history()
.summarize_for_handoff()
.await
.expect("summarize fresh session");
assert!(summary.summary.is_empty());
session.disconnect().await.expect("disconnect session");
client.stop().await.expect("stop client");
})
},
)
.await;
}
#[tokio::test]
async fn should_report_noop_when_cancelling_compaction_without_inflight_work() {
with_e2e_context(
"compaction",
"should_report_noop_when_cancelling_compaction_without_inflight_work",
|ctx| {
Box::pin(async move {
ctx.set_default_copilot_user();
let client = ctx.start_client().await;
let session = client
.create_session(ctx.approve_all_session_config())
.await
.expect("create session");
let cancelled = session
.rpc()
.history()
.cancel_background_compaction()
.await
.expect("cancel background compaction");
assert!(!cancelled.cancelled);
let aborted = session
.rpc()
.history()
.abort_manual_compaction()
.await
.expect("abort manual compaction");
assert!(!aborted.aborted);
session.disconnect().await.expect("disconnect session");
client.stop().await.expect("stop client");
})
},
)
.await;
}
#[tokio::test]
async fn should_summarize_for_handoff_after_non_ephemeral_log_event() {
with_e2e_context(
"compaction",
"should_summarize_for_handoff_after_non_ephemeral_log_event",
|ctx| {
Box::pin(async move {
ctx.set_default_copilot_user();
let client = ctx.start_client().await;
let session = client
.create_session(ctx.approve_all_session_config())
.await
.expect("create session");
let log = session
.rpc()
.log(LogRequest {
ephemeral: Some(false),
level: Some(SessionLogLevel::Info),
message: "Rust handoff summary source".to_string(),
tip: None,
r#type: Some("notification".to_string()),
url: None,
})
.await
.expect("log handoff source");
assert!(!log.event_id.trim().is_empty());
let summary = session
.rpc()
.history()
.summarize_for_handoff()
.await
.expect("summarize after log");
assert!(summary.summary.is_empty() || summary.summary.contains("Rust"));
session.disconnect().await.expect("disconnect session");
client.stop().await.expect("stop client");
})
},
)
.await;
}