@@ -25,119 +25,38 @@ type testWindowRestorer struct {
2525func (r * testWindowRestorer ) Unminimise (context.Context ) { r .unminimised ++ }
2626func (r * testWindowRestorer ) Show (context.Context ) { r .shown ++ }
2727
28- func TestDesktopOptionsDefaultToReadOnlyAndRequireExplicitProfileControl (t * testing.T ) {
28+ func TestDesktopOptionsDefaultToReadOnlyAndRequireExplicitCapabilities (t * testing.T ) {
2929 defaults , err := parseDesktopOptions (nil )
3030 if err != nil {
3131 t .Fatal (err )
3232 }
33- if defaults .profileControl || defaults .runCreation || defaults .sessionMessages ||
34- defaults .sessionSteeringControl || defaults .runLifecycle || defaults .runExecution ||
35- defaults .planDeliveryControl || defaults .approvalControl ||
36- defaults .modelControl || defaults .fileEditReview || defaults .runWakeControl ||
37- defaults .version {
33+ if defaults != (desktopOptions {}) {
3834 t .Fatalf ("unexpected defaults: %#v" , defaults )
3935 }
40- enabled , err := parseDesktopOptions ([]string {"--enable-profile-control" })
41- if err != nil {
42- t .Fatal (err )
43- }
44- if ! enabled .profileControl || enabled .runCreation || enabled .sessionMessages ||
45- enabled .sessionSteeringControl || enabled .runLifecycle || enabled .runExecution ||
46- enabled .planDeliveryControl || enabled .approvalControl ||
47- enabled .modelControl || enabled .fileEditReview || enabled .runWakeControl ||
48- enabled .version {
49- t .Fatalf ("profile control was not explicit: %#v" , enabled )
50- }
51- creation , err := parseDesktopOptions ([]string {"--enable-run-creation" })
52- if err != nil {
53- t .Fatal (err )
54- }
55- if creation .profileControl || ! creation .runCreation || creation .sessionMessages ||
56- creation .sessionSteeringControl || creation .runLifecycle || creation .runExecution ||
57- creation .planDeliveryControl || creation .approvalControl ||
58- creation .modelControl || creation .fileEditReview || creation .runWakeControl ||
59- creation .version {
60- t .Fatalf ("Run creation was not independently explicit: %#v" , creation )
61- }
62- messages , err := parseDesktopOptions ([]string {"--enable-session-messages" })
63- if err != nil {
64- t .Fatal (err )
65- }
66- if messages .profileControl || messages .runCreation || ! messages .sessionMessages ||
67- messages .sessionSteeringControl || messages .runLifecycle || messages .runExecution ||
68- messages .planDeliveryControl || messages .approvalControl ||
69- messages .modelControl || messages .fileEditReview || messages .runWakeControl ||
70- messages .version {
71- t .Fatalf ("Session messages were not independently explicit: %#v" , messages )
72- }
73- steering , err := parseDesktopOptions ([]string {"--enable-session-steering-control" })
74- if err != nil {
75- t .Fatal (err )
76- }
77- if steering .profileControl || steering .runCreation || steering .sessionMessages ||
78- ! steering .sessionSteeringControl || steering .runLifecycle || steering .runExecution ||
79- steering .planDeliveryControl || steering .approvalControl ||
80- steering .modelControl || steering .fileEditReview || steering .runWakeControl ||
81- steering .version {
82- t .Fatalf ("Session steering cancellation was not independently explicit: %#v" , steering )
83- }
84- lifecycle , err := parseDesktopOptions ([]string {"--enable-run-lifecycle" })
85- if err != nil {
86- t .Fatal (err )
87- }
88- if ! lifecycle .runLifecycle || lifecycle .runExecution || lifecycle .profileControl ||
89- lifecycle .runCreation || lifecycle .sessionMessages || lifecycle .sessionSteeringControl ||
90- lifecycle .planDeliveryControl || lifecycle .approvalControl {
91- t .Fatalf ("Run lifecycle was not independently explicit: %#v" , lifecycle )
92- }
93- execution , err := parseDesktopOptions ([]string {"--enable-run-execution" })
94- if err != nil {
95- t .Fatal (err )
96- }
97- if ! execution .runExecution || execution .runLifecycle || execution .profileControl ||
98- execution .runCreation || execution .sessionMessages || execution .sessionSteeringControl ||
99- execution .planDeliveryControl || execution .approvalControl {
100- t .Fatalf ("Run execution was not independently explicit: %#v" , execution )
101- }
102- plan , err := parseDesktopOptions ([]string {"--enable-plan-delivery" })
103- if err != nil {
104- t .Fatal (err )
105- }
106- if ! plan .planDeliveryControl || plan .approvalControl || plan .runExecution ||
107- plan .runLifecycle || plan .profileControl || plan .runCreation || plan .sessionMessages ||
108- plan .sessionSteeringControl {
109- t .Fatalf ("Plan/Delivery control was not independently explicit: %#v" , plan )
110- }
111- approvals , err := parseDesktopOptions ([]string {"--enable-approvals" })
112- if err != nil {
113- t .Fatal (err )
114- }
115- if ! approvals .approvalControl || approvals .planDeliveryControl || approvals .runExecution ||
116- approvals .runLifecycle || approvals .profileControl || approvals .runCreation ||
117- approvals .sessionMessages || approvals .sessionSteeringControl {
118- t .Fatalf ("Approval control was not independently explicit: %#v" , approvals )
119- }
12036 for _ , current := range []struct {
121- flag string
122- check func ( desktopOptions ) bool
37+ flag string
38+ want desktopOptions
12339 }{
124- {flag : "--enable-model-control" , check : func (value desktopOptions ) bool {
125- return value .modelControl && ! value .fileEditReview && ! value .runWakeControl
126- }},
127- {flag : "--enable-file-edit-review" , check : func (value desktopOptions ) bool {
128- return ! value .modelControl && value .fileEditReview && ! value .runWakeControl
129- }},
130- {flag : "--enable-run-wake" , check : func (value desktopOptions ) bool {
131- return ! value .modelControl && ! value .fileEditReview && value .runWakeControl
132- }},
40+ {flag : "--enable-profile-control" , want : desktopOptions {profileControl : true }},
41+ {flag : "--enable-run-creation" , want : desktopOptions {runCreation : true }},
42+ {flag : "--enable-session-messages" , want : desktopOptions {sessionMessages : true }},
43+ {flag : "--enable-session-steering-control" , want : desktopOptions {sessionSteeringControl : true }},
44+ {flag : "--enable-run-lifecycle" , want : desktopOptions {runLifecycle : true }},
45+ {flag : "--enable-run-execution" , want : desktopOptions {runExecution : true }},
46+ {flag : "--enable-plan-delivery" , want : desktopOptions {planDeliveryControl : true }},
47+ {flag : "--enable-approvals" , want : desktopOptions {approvalControl : true }},
48+ {flag : "--enable-model-control" , want : desktopOptions {modelControl : true }},
49+ {flag : "--enable-file-edit-review" , want : desktopOptions {fileEditReview : true }},
50+ {flag : "--enable-run-wake" , want : desktopOptions {runWakeControl : true }},
51+ {flag : "--enable-file-edit-apply" , want : desktopOptions {fileEditApply : true }},
52+ {flag : "--enable-run-wake-execution" , want : desktopOptions {runWakeExecution : true }},
53+ {flag : "--enable-skill-installation" , want : desktopOptions {skillInstallation : true }},
13354 } {
13455 parsed , err := parseDesktopOptions ([]string {current .flag })
13556 if err != nil {
13657 t .Fatal (err )
13758 }
138- if ! current .check (parsed ) || parsed .profileControl || parsed .runCreation ||
139- parsed .sessionMessages || parsed .sessionSteeringControl || parsed .runLifecycle ||
140- parsed .runExecution || parsed .planDeliveryControl || parsed .approvalControl {
59+ if parsed != current .want {
14160 t .Fatalf ("%s was not independently explicit: %#v" , current .flag , parsed )
14261 }
14362 }
0 commit comments