@@ -110,65 +110,55 @@ function targetLocation(target: ReturnType<typeof sessionNavigationTarget>) {
110110}
111111
112112describe ( "gateway-backed session route resolution" , ( ) => {
113- it . each ( [
114- { mainKey : "main" , face : "chat" , preferenceDerived : false } ,
115- { mainKey : "main" , face : "dashboard" , preferenceDerived : false } ,
116- { mainKey : "main" , face : "chat" , preferenceDerived : true } ,
117- { mainKey : "workspace" , face : "chat" , preferenceDerived : false } ,
118- { mainKey : "workspace" , face : "dashboard" , preferenceDerived : false } ,
119- { mainKey : "workspace" , face : "chat" , preferenceDerived : true } ,
120- ] as const ) (
121- "resolves global $face ownership with $mainKey (preference=$preferenceDerived)" ,
122- async ( { mainKey, face, preferenceDerived } ) => {
123- const globalRow = row ( { key : "global" , kind : "global" , boardFace : "dashboard" } ) ;
124- const { context, list } = contextFor ( ( { agentId, search } ) =>
125- agentId === "research" && search === "global" ? result ( [ globalRow ] ) : result ( [ ] ) ,
126- ) ;
127- context . agents . state . agentsList = {
128- defaultId : "main" ,
129- mainKey,
130- scope : "global" ,
131- agents : [ ] ,
132- } ;
133- context . gateway . snapshot . hello = {
134- snapshot : {
135- sessionDefaults : {
136- defaultAgentId : "main" ,
137- mainKey,
138- mainSessionKey : "global" ,
139- } ,
113+ it ( "resolves a non-default agent's canonical global face from its scoped row" , async ( ) => {
114+ const globalRow = row ( { key : "global" , kind : "global" , boardFace : "dashboard" } ) ;
115+ const { context, list } = contextFor ( ( { agentId, search } ) =>
116+ agentId === "research" && search === "global" ? result ( [ globalRow ] ) : result ( [ ] ) ,
117+ ) ;
118+ context . agents . state . agentsList = {
119+ defaultId : "main" ,
120+ mainKey : "main" ,
121+ scope : "global" ,
122+ agents : [ ] ,
123+ } ;
124+ context . gateway . snapshot . hello = {
125+ snapshot : {
126+ sessionDefaults : {
127+ defaultAgentId : "main" ,
128+ mainKey : "main" ,
129+ mainSessionKey : "global" ,
140130 } ,
141- } as ApplicationContext [ "gateway" ] [ "snapshot" ] [ "hello" ] ;
131+ } ,
132+ } as ApplicationContext [ "gateway" ] [ "snapshot" ] [ "hello" ] ;
142133
143- const location = {
144- pathname : `/${ face } /research` ,
145- search : preferenceDerived ? `?${ SESSION_FACE_PREFERENCE_PARAM } =1` : "" ,
134+ await expect (
135+ loadChatRoute (
136+ context ,
137+ {
138+ pathname : "/chat/research" ,
139+ search : `?${ SESSION_FACE_PREFERENCE_PARAM } =1` ,
140+ hash : "" ,
141+ } ,
142+ "chat" ,
143+ new AbortController ( ) . signal ,
144+ ) ,
145+ ) . resolves . toEqual ( {
146+ kind : "session" ,
147+ sessionKey : "global" ,
148+ agentId : "research" ,
149+ draft : undefined ,
150+ face : "dashboard" ,
151+ canonicalLocation : { pathname : "/dashboard/research" , search : "" , hash : "" } ,
152+ canonicalLocationSource : {
153+ pathname : "/chat/research" ,
154+ search : `?${ SESSION_FACE_PREFERENCE_PARAM } =1` ,
146155 hash : "" ,
147- } ;
148- await expect (
149- loadChatRoute ( context , location , face , new AbortController ( ) . signal ) ,
150- ) . resolves . toEqual ( {
151- kind : "session" ,
152- sessionKey : "global" ,
153- agentId : "research" ,
154- draft : undefined ,
155- face : preferenceDerived ? "dashboard" : face ,
156- ...( preferenceDerived
157- ? {
158- canonicalLocation : { pathname : "/dashboard/research" , search : "" , hash : "" } ,
159- canonicalLocationSource : location ,
160- }
161- : { } ) ,
162- } ) ;
163- if ( preferenceDerived ) {
164- expect ( list ) . toHaveBeenCalledWith (
165- expect . objectContaining ( { agentId : "research" , search : "global" } ) ,
166- ) ;
167- } else {
168- expect ( list ) . not . toHaveBeenCalled ( ) ;
169- }
170- } ,
171- ) ;
156+ } ,
157+ } ) ;
158+ expect ( list ) . toHaveBeenCalledWith (
159+ expect . objectContaining ( { agentId : "research" , search : "global" } ) ,
160+ ) ;
161+ } ) ;
172162
173163 it ( "applies an uncached stored face to a preference-derived open" , async ( ) => {
174164 const dashboardRow = row ( { boardFace : "dashboard" } ) ;
0 commit comments