@@ -185,6 +185,58 @@ describe("makeAiSearchToolDiscoveryProvider", () => {
185185} ) ;
186186
187187describe ( "reindexAiSearch" , ( ) => {
188+ it . effect ( "indexes an identity document when schema collection fails" , ( ) =>
189+ Effect . gen ( function * ( ) {
190+ let uploadedContent = "" ;
191+ const stored : AiSearchItemRow [ ] = [ ] ;
192+
193+ const result = yield * reindexAiSearch ( {
194+ executor : {
195+ tools : {
196+ manifest : ( ) =>
197+ Effect . succeed ( [
198+ {
199+ path : "github.default.main.repos.create" ,
200+ name : "repos.create" ,
201+ description : "Create a repository" ,
202+ integration : "github" ,
203+ fingerprintVersion : "v1" ,
204+ indexFingerprint : "fingerprint" ,
205+ } ,
206+ ] ) ,
207+ schema : ( ) => Effect . fail ( "schema unavailable" ) ,
208+ } ,
209+ } as never ,
210+ aiSearch : {
211+ ...makeAiSearch ( ) ,
212+ items : {
213+ ...makeAiSearch ( ) . items ,
214+ upload : async ( name , content ) => {
215+ uploadedContent = String ( content ) ;
216+ return { id : `item:${ name } ` , key : name } ;
217+ } ,
218+ } ,
219+ } ,
220+ items : makeItemsCollection ( {
221+ list : ( ) => Effect . succeed ( [ ] ) ,
222+ put : ( { data } ) =>
223+ Effect . sync ( ( ) => {
224+ stored . push ( data ) ;
225+ return { ...githubRow , data } ;
226+ } ) ,
227+ } ) ,
228+ owner : "org" ,
229+ namespace : "org" ,
230+ } ) ;
231+
232+ expect ( result ) . toMatchObject ( { indexed : 1 , skipped : 0 , removed : 0 } ) ;
233+ expect ( uploadedContent ) . toContain ( "# github.default.main.repos.create" ) ;
234+ expect ( uploadedContent ) . toContain ( "Description: Create a repository" ) ;
235+ expect ( uploadedContent ) . not . toContain ( "Input schema" ) ;
236+ expect ( stored [ 0 ] ?. fingerprint ) . toBe ( "github.default.main.repos.create:v1:fingerprint:" ) ;
237+ } ) ,
238+ ) ;
239+
188240 it . effect ( "removes stale rows even when deleting the remote AI Search item fails" , ( ) =>
189241 Effect . gen ( function * ( ) {
190242 const removed : string [ ] = [ ] ;
0 commit comments