@@ -350,6 +350,48 @@ it.effect("records only failed calls of tools that hand off no work", () => {
350350 ) ;
351351} ) ;
352352
353+ it . effect ( "rejects an unknown organize target instead of archiving the calling thread" , ( ) => {
354+ const dispatched : Array < unknown > = [ ] ;
355+ return Effect . gen ( function * ( ) {
356+ const server = yield * McpServer . McpServer ;
357+ const outcome = yield * server
358+ . callTool ( {
359+ name : "t3_thread_organize" ,
360+ arguments : { action : "archive" , threadIds : [ "other-thread" ] } ,
361+ } )
362+ . pipe (
363+ Effect . provideService ( McpInvocationContext . McpInvocationContext , scope ) ,
364+ Effect . provideService ( McpSchema . McpServerClient , client ) ,
365+ Effect . result ,
366+ ) ;
367+ expect ( dispatched ) . toEqual ( [ ] ) ;
368+ expect ( outcome ) . toMatchObject ( {
369+ _tag : "Failure" ,
370+ failure : { message : expect . stringContaining ( "Expected no excess property" ) } ,
371+ } ) ;
372+ } ) . pipe (
373+ Effect . provide (
374+ layerThreadToolkit . pipe (
375+ Layer . provideMerge ( McpServer . McpServer . layer ) ,
376+ Layer . provide ( NodeCrypto . layer ) ,
377+ Layer . provide (
378+ Layer . mock ( ThreadManagement . ThreadManagementService ) ( {
379+ getThreadShell : ( id ) => Effect . succeed ( McpToolAccessTestkit . liveThreadShell ( id ) ) ,
380+ getProjectThreadRecords : ( { threadId : id } ) =>
381+ Effect . succeed (
382+ McpToolAccessTestkit . idleThreadProjection ( McpToolAccessTestkit . liveThreadShell ( id ) ) ,
383+ ) ,
384+ dispatch : ( command ) => {
385+ dispatched . push ( command ) ;
386+ return Effect . succeed ( { sequence : 1 } as never ) ;
387+ } ,
388+ } ) ,
389+ ) ,
390+ ) ,
391+ ) ,
392+ ) ;
393+ } ) ;
394+
353395it . effect ( "keeps unexpected handler defects private through the production registration" , ( ) =>
354396 Effect . gen ( function * ( ) {
355397 const server = yield * McpServer . McpServer ;
0 commit comments