@@ -410,6 +410,100 @@ func Test_SearchIssues(t *testing.T) {
410
410
expectError : false ,
411
411
expectedResult : mockSearchResult ,
412
412
},
413
+ {
414
+ name : "query with existing is:issue filter - no duplication" ,
415
+ mockedClient : mock .NewMockedHTTPClient (
416
+ mock .WithRequestMatchHandler (
417
+ mock .GetSearchIssues ,
418
+ expectQueryParams (
419
+ t ,
420
+ map [string ]string {
421
+ "q" : "repo:github/github-mcp-server is:issue is:open (label:critical OR label:urgent)" ,
422
+ "page" : "1" ,
423
+ "per_page" : "30" ,
424
+ },
425
+ ).andThen (
426
+ mockResponse (t , http .StatusOK , mockSearchResult ),
427
+ ),
428
+ ),
429
+ ),
430
+ requestArgs : map [string ]interface {}{
431
+ "query" : "repo:github/github-mcp-server is:issue is:open (label:critical OR label:urgent)" ,
432
+ },
433
+ expectError : false ,
434
+ expectedResult : mockSearchResult ,
435
+ },
436
+ {
437
+ name : "query with existing repo: filter and conflicting owner/repo params - uses query filter" ,
438
+ mockedClient : mock .NewMockedHTTPClient (
439
+ mock .WithRequestMatchHandler (
440
+ mock .GetSearchIssues ,
441
+ expectQueryParams (
442
+ t ,
443
+ map [string ]string {
444
+ "q" : "is:issue repo:github/github-mcp-server critical" ,
445
+ "page" : "1" ,
446
+ "per_page" : "30" ,
447
+ },
448
+ ).andThen (
449
+ mockResponse (t , http .StatusOK , mockSearchResult ),
450
+ ),
451
+ ),
452
+ ),
453
+ requestArgs : map [string ]interface {}{
454
+ "query" : "repo:github/github-mcp-server critical" ,
455
+ "owner" : "different-owner" ,
456
+ "repo" : "different-repo" ,
457
+ },
458
+ expectError : false ,
459
+ expectedResult : mockSearchResult ,
460
+ },
461
+ {
462
+ name : "query with both is: and repo: filters already present" ,
463
+ mockedClient : mock .NewMockedHTTPClient (
464
+ mock .WithRequestMatchHandler (
465
+ mock .GetSearchIssues ,
466
+ expectQueryParams (
467
+ t ,
468
+ map [string ]string {
469
+ "q" : "is:issue repo:octocat/Hello-World bug" ,
470
+ "page" : "1" ,
471
+ "per_page" : "30" ,
472
+ },
473
+ ).andThen (
474
+ mockResponse (t , http .StatusOK , mockSearchResult ),
475
+ ),
476
+ ),
477
+ ),
478
+ requestArgs : map [string ]interface {}{
479
+ "query" : "is:issue repo:octocat/Hello-World bug" ,
480
+ },
481
+ expectError : false ,
482
+ expectedResult : mockSearchResult ,
483
+ },
484
+ {
485
+ name : "complex query with multiple OR operators and existing filters" ,
486
+ mockedClient : mock .NewMockedHTTPClient (
487
+ mock .WithRequestMatchHandler (
488
+ mock .GetSearchIssues ,
489
+ expectQueryParams (
490
+ t ,
491
+ map [string ]string {
492
+ "q" : "repo:github/github-mcp-server is:issue (label:critical OR label:urgent OR label:high-priority OR label:blocker)" ,
493
+ "page" : "1" ,
494
+ "per_page" : "30" ,
495
+ },
496
+ ).andThen (
497
+ mockResponse (t , http .StatusOK , mockSearchResult ),
498
+ ),
499
+ ),
500
+ ),
501
+ requestArgs : map [string ]interface {}{
502
+ "query" : "repo:github/github-mcp-server is:issue (label:critical OR label:urgent OR label:high-priority OR label:blocker)" ,
503
+ },
504
+ expectError : false ,
505
+ expectedResult : mockSearchResult ,
506
+ },
413
507
{
414
508
name : "search issues fails" ,
415
509
mockedClient : mock .NewMockedHTTPClient (
0 commit comments