@@ -356,6 +356,57 @@ describe('case_create auto-creates GitHub issue for dev cases', () => {
356356 ) ;
357357 } ) ;
358358
359+ // INVARIANT: Dev case notifications go to main group, not source group
360+ // SUT: processTaskIpc case_create notification routing
361+ test ( 'dev case created from non-main group notifies main group' , async ( ) => {
362+ mockedCreateGitHubIssue . mockResolvedValue ( {
363+ success : true ,
364+ issueUrl : 'https://github.com/Garsson-io/kaizen/issues/60' ,
365+ issueNumber : 60 ,
366+ } ) ;
367+
368+ await processTaskIpc (
369+ {
370+ type : 'case_create' ,
371+ description : 'Fix widget rendering' ,
372+ caseType : 'dev' ,
373+ chatJid : 'tg:222' ,
374+ requestId : 'req-dev-routing' ,
375+ } as any ,
376+ 'telegram_work' ,
377+ false ,
378+ deps ,
379+ ) ;
380+
381+ // Notification should go to main group (tg:111), not source group (tg:222)
382+ expect ( sendMessage ) . toHaveBeenCalledWith (
383+ 'tg:111' ,
384+ expect . stringContaining ( 'dev case created' ) ,
385+ ) ;
386+ } ) ;
387+
388+ // INVARIANT: Work case notifications go to source group, not main group
389+ test ( 'work case created from non-main group notifies source group' , async ( ) => {
390+ await processTaskIpc (
391+ {
392+ type : 'case_create' ,
393+ description : 'Process client order' ,
394+ caseType : 'work' ,
395+ chatJid : 'tg:222' ,
396+ requestId : 'req-work-routing' ,
397+ } as any ,
398+ 'telegram_work' ,
399+ false ,
400+ deps ,
401+ ) ;
402+
403+ // Notification should go to source group (tg:222), not main
404+ expect ( sendMessage ) . toHaveBeenCalledWith (
405+ 'tg:222' ,
406+ expect . stringContaining ( 'work case created' ) ,
407+ ) ;
408+ } ) ;
409+
359410 test ( 'work case does NOT create GitHub issue' , async ( ) => {
360411 await processTaskIpc (
361412 {
0 commit comments