@@ -14,7 +14,7 @@ import { TestConfigurationService } from '../../../../../platform/configuration/
1414import { NullLogService } from '../../../../../platform/log/common/log.js' ;
1515import { InMemoryStorageService , StorageScope , StorageTarget } from '../../../../../platform/storage/common/storage.js' ;
1616import type { IAutomationDescriptor , IAutomationRun } from '../../../../../workbench/contrib/chat/common/automations/automation.js' ;
17- import { AutomationInitialDiscoveryState , IAutomationService } from '../../../../../workbench/contrib/chat/common/automations/automationService.js' ;
17+ import { type AutomationCatalogueState , IAutomationService } from '../../../../../workbench/contrib/chat/common/automations/automationService.js' ;
1818import { IWorkbenchAssignmentService } from '../../../../../workbench/services/assignment/common/assignmentService.js' ;
1919import { ILifecycleService , LifecyclePhase } from '../../../../../workbench/services/lifecycle/common/lifecycle.js' ;
2020import type { ICustomViewDescriptor } from '../../../../services/customView/browser/customView.js' ;
@@ -54,7 +54,7 @@ suite('AutomationsNewBadgeState', () => {
5454 readonly activeView ?: ICustomViewDescriptor ;
5555 readonly seen ?: boolean ;
5656 readonly hadPriorWindowOpen ?: boolean ;
57- readonly initialDiscoveryState ?: AutomationInitialDiscoveryState ;
57+ readonly catalogueState ?: AutomationCatalogueState ;
5858 readonly eventuallyReady ?: boolean ;
5959 readonly style ?: AutomationsNewBadgeStyle ;
6060 readonly configuredStyle ?: AutomationsNewBadgeStyle ;
@@ -67,11 +67,11 @@ suite('AutomationsNewBadgeState', () => {
6767 const automations = observableValue < readonly IAutomationDescriptor [ ] > ( disposables , options . automations ?? [ ] ) ;
6868 const runs = observableValue < readonly IAutomationRun [ ] > ( disposables , options . runs ?? [ ] ) ;
6969 const activeView = observableValue < ICustomViewDescriptor | undefined > ( disposables , options . activeView ) ;
70- const initialDiscoveryState = observableValue < AutomationInitialDiscoveryState > ( disposables , options . initialDiscoveryState ?? 'ready' ) ;
70+ const catalogueState = observableValue < AutomationCatalogueState > ( disposables , options . catalogueState ?? 'ready' ) ;
7171 const automationService = new class extends mock < IAutomationService > ( ) {
7272 override readonly automations = automations ;
7373 override readonly runs = runs ;
74- override readonly initialDiscoveryState = initialDiscoveryState ;
74+ override readonly catalogueState = catalogueState ;
7575 } ;
7676 const customViewService = new class extends mock < ICustomViewService > ( ) {
7777 override readonly activeCustomView = activeView ;
@@ -115,7 +115,7 @@ suite('AutomationsNewBadgeState', () => {
115115 assignmentService,
116116 configurationService,
117117 refetchAssignments,
118- initialDiscoveryState ,
118+ catalogueState ,
119119 completeEventually : ( ) => eventually . complete ( ) ,
120120 } ;
121121 }
@@ -156,13 +156,13 @@ suite('AutomationsNewBadgeState', () => {
156156 ] ) ;
157157 } ) ;
158158
159- test ( 'never reveals after initial provider discovery is suppressed' , async ( ) => {
159+ test ( 'never reveals after initial catalogue discovery is suppressed' , async ( ) => {
160160 const snapshots = [ ] ;
161- for ( const initialState of [ 'pending ' , 'unavailable' ] as const ) {
162- const fixture = createState ( { initialDiscoveryState : initialState , style : 'accent' } ) ;
161+ for ( const initialState of [ 'loading ' , 'unavailable' , 'error '] as const ) {
162+ const fixture = createState ( { catalogueState : initialState , style : 'accent' } ) ;
163163
164164 await fixture . state . initialize ( ) ;
165- fixture . initialDiscoveryState . set ( 'ready' , undefined ) ;
165+ fixture . catalogueState . set ( 'ready' , undefined ) ;
166166 await fixture . configurationService . setUserConfiguration ( AUTOMATIONS_NEW_BADGE_STYLE_SETTING , 'soft' ) ;
167167 fixture . configurationService . onDidChangeConfigurationEmitter . fire ( upcastPartial < IConfigurationChangeEvent > ( {
168168 affectsConfiguration : key => key === AUTOMATIONS_NEW_BADGE_STYLE_SETTING ,
@@ -178,8 +178,9 @@ suite('AutomationsNewBadgeState', () => {
178178 }
179179
180180 assert . deepStrictEqual ( snapshots , [
181- { initialState : 'pending ' , showNewBadge : false , stored : undefined , treatments : [ ] } ,
181+ { initialState : 'loading ' , showNewBadge : false , stored : undefined , treatments : [ ] } ,
182182 { initialState : 'unavailable' , showNewBadge : false , stored : undefined , treatments : [ ] } ,
183+ { initialState : 'error' , showNewBadge : false , stored : undefined , treatments : [ ] } ,
183184 ] ) ;
184185 } ) ;
185186
@@ -220,13 +221,13 @@ suite('AutomationsNewBadgeState', () => {
220221 } ) ;
221222 } ) ;
222223
223- test ( 'suppresses for the window when aggregate discovery becomes pending after presentation' , async ( ) => {
224+ test ( 'suppresses for the window when the aggregate catalogue starts loading after presentation' , async ( ) => {
224225 const fixture = createState ( ) ;
225226 await fixture . state . initialize ( ) ;
226227 const beforeDiscoveryChange = fixture . state . presentation . get ( ) ;
227228
228- fixture . initialDiscoveryState . set ( 'pending ' , undefined ) ;
229- fixture . initialDiscoveryState . set ( 'ready' , undefined ) ;
229+ fixture . catalogueState . set ( 'loading ' , undefined ) ;
230+ fixture . catalogueState . set ( 'ready' , undefined ) ;
230231 fixture . refetchAssignments . fire ( ) ;
231232 await Promise . resolve ( ) ;
232233
@@ -241,22 +242,28 @@ suite('AutomationsNewBadgeState', () => {
241242 } ) ;
242243 } ) ;
243244
244- test ( 'suppresses for the window when aggregate discovery becomes unavailable' , async ( ) => {
245- const fixture = createState ( ) ;
246- await fixture . state . initialize ( ) ;
247- const beforeDiscoveryChange = fixture . state . presentation . get ( ) ;
245+ test ( 'suppresses for the window when the aggregate catalogue becomes unavailable or errors' , async ( ) => {
246+ const snapshots = [ ] ;
247+ for ( const catalogueState of [ 'unavailable' , 'error' ] as const ) {
248+ const fixture = createState ( ) ;
249+ await fixture . state . initialize ( ) ;
250+ const beforeDiscoveryChange = fixture . state . presentation . get ( ) ;
248251
249- fixture . initialDiscoveryState . set ( 'unavailable' , undefined ) ;
252+ fixture . catalogueState . set ( catalogueState , undefined ) ;
253+ fixture . catalogueState . set ( 'ready' , undefined ) ;
250254
251- assert . deepStrictEqual ( {
252- beforeDiscoveryChange,
253- afterDiscoveryChange : fixture . state . presentation . get ( ) ,
254- stored : fixture . storageService . get ( AUTOMATIONS_NEW_BADGE_SEEN_STORAGE_KEY , StorageScope . APPLICATION ) ,
255- } , {
256- beforeDiscoveryChange : 'outline' ,
257- afterDiscoveryChange : undefined ,
258- stored : undefined ,
259- } ) ;
255+ snapshots . push ( {
256+ catalogueState,
257+ beforeDiscoveryChange,
258+ afterDiscoveryChange : fixture . state . presentation . get ( ) ,
259+ stored : fixture . storageService . get ( AUTOMATIONS_NEW_BADGE_SEEN_STORAGE_KEY , StorageScope . APPLICATION ) ,
260+ } ) ;
261+ }
262+
263+ assert . deepStrictEqual ( snapshots , [
264+ { catalogueState : 'unavailable' , beforeDiscoveryChange : 'outline' , afterDiscoveryChange : undefined , stored : undefined } ,
265+ { catalogueState : 'error' , beforeDiscoveryChange : 'outline' , afterDiscoveryChange : undefined , stored : undefined } ,
266+ ] ) ;
260267 } ) ;
261268
262269 test ( 'lets the hidden setting override and live-update the treatment' , async ( ) => {
0 commit comments