-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsession_resumable_test.dart
More file actions
97 lines (92 loc) · 2.66 KB
/
Copy pathsession_resumable_test.dart
File metadata and controls
97 lines (92 loc) · 2.66 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
// SPEC-29: Session DTO carries `resumable`; codec parses it (default false).
import 'package:flutter_test/flutter_test.dart';
import 'package:makit/transport/codec.dart';
void main() {
group('Session resumable field (SPEC-29)', () {
test('decodeSessions parses resumable=true', () {
final sessions = WireCodec.decodeSessions([
{
'id': 's1',
'projectId': 'p1',
'agent': 'pi',
'title': 'resumable one',
'status': 'exited',
'policy': 'ask-on-risky',
'resumable': true,
},
]);
expect(sessions!.single.resumable, isTrue);
});
test('resumable defaults to false when absent (back-compat)', () {
final sessions = WireCodec.decodeSessions([
{
'id': 's2',
'projectId': 'p1',
'agent': 'pi',
'title': 'legacy',
'status': 'idle',
'policy': 'ask-on-risky',
},
]);
expect(sessions!.single.resumable, isFalse);
expect(sessions.single.closed, isFalse);
});
test('decodeSessions parses closed=true (SPEC-29)', () {
final sessions = WireCodec.decodeSessions([
{
'id': 's3',
'projectId': 'p1',
'agent': 'pi',
'title': 'closed one',
'status': 'exited',
'policy': 'ask-on-risky',
'closed': true,
},
]);
expect(sessions!.single.closed, isTrue);
});
});
group('Session lineage fields (SPEC-46 D10)', () {
test(
'decodeSessions parses parentId, handoffReason, origin when present',
() {
final sessions = WireCodec.decodeSessions([
{
'id': 's1',
'projectId': 'p1',
'agent': 'codex',
'title': 'handed off',
'status': 'idle',
'policy': 'ask-on-risky',
'parentId': 'parent-1',
'handoffReason': 'out of context',
'origin': 'agent',
},
]);
final s = sessions!.single;
expect(s.parentId, 'parent-1');
expect(s.handoffReason, 'out of context');
expect(s.origin, 'agent');
},
);
test(
'lineage defaults to null when absent (pre-SPEC-46 row, no throw)',
() {
final sessions = WireCodec.decodeSessions([
{
'id': 's2',
'projectId': 'p1',
'agent': 'pi',
'title': 'legacy',
'status': 'idle',
'policy': 'ask-on-risky',
},
]);
final s = sessions!.single;
expect(s.parentId, isNull);
expect(s.handoffReason, isNull);
expect(s.origin, isNull);
},
);
});
}