@@ -916,49 +916,65 @@ describe("one finding handed over on its own", () => {
916916
917917 it ( "keeps the pull request chip free of ask instructions when a fix and an ask share a draft" , ( ) => {
918918 const metadata = { ...base , state : "open" as const , isDraft : false } ;
919- const ask = buildAskAboutPullRequestHandoff ( metadata ) ;
920- for ( const fix of [
921- buildFixFindingHandoff ( { ...metadata , finding : { kind : "thread" , thread : reviewThread } } ) ,
922- buildFixFindingHandoff ( {
923- ...metadata ,
924- finding : {
925- kind : "check" ,
926- check : { name : "lint" , status : "failure" , description : null , url : null } ,
927- } ,
928- } ) ,
929- buildFixFindingHandoff ( {
930- ...metadata ,
931- finding : {
932- kind : "comment" ,
933- comment : {
934- id : "review" ,
935- kind : "review" ,
936- reviewState : null ,
937- author : null ,
938- body : "fix it" ,
939- createdAt : "2026-07-03T00:00:00Z" ,
940- url : null ,
941- path : null ,
942- } ,
943- } ,
944- } ) ,
945- buildFixFindingsHandoff ( {
946- ...metadata ,
947- reviewThreads : [ reviewThread ] ,
948- comments : [ ] ,
949- checks : [ ] ,
950- commentsTruncated : false ,
951- } ) ,
952- ] ) {
953- for ( const next of [
954- appendHandoff ( ask , fix ) ,
955- appendHandoff ( { prompt : fix . prompt , reviewComments : [ ...fix . reviewComments ] } , ask ) ,
956- ] ) {
957- const contexts = next . reviewComments . filter ( ( comment ) => comment . pullRequest !== undefined ) ;
958- expect ( contexts ) . toHaveLength ( 1 ) ;
959- expect ( contexts [ 0 ] ?. text ) . not . toContain ( "Do not change any code" ) ;
960- expect ( contexts [ 0 ] ?. pullRequest ) . toEqual ( metadata ) ;
919+ try {
920+ for ( const initial of [ false , true ] ) {
921+ setMergeRequestTerms ( initial ) ;
922+ const fixes = [
923+ buildFixFindingHandoff ( {
924+ ...metadata ,
925+ finding : { kind : "thread" , thread : reviewThread } ,
926+ } ) ,
927+ buildFixFindingHandoff ( {
928+ ...metadata ,
929+ finding : {
930+ kind : "check" ,
931+ check : { name : "lint" , status : "failure" , description : null , url : null } ,
932+ } ,
933+ } ) ,
934+ buildFixFindingHandoff ( {
935+ ...metadata ,
936+ finding : {
937+ kind : "comment" ,
938+ comment : {
939+ id : "review" ,
940+ kind : "review" ,
941+ reviewState : null ,
942+ author : null ,
943+ body : "fix it" ,
944+ createdAt : "2026-07-03T00:00:00Z" ,
945+ url : null ,
946+ path : null ,
947+ } ,
948+ } ,
949+ } ) ,
950+ buildFixFindingsHandoff ( {
951+ ...metadata ,
952+ reviewThreads : [ reviewThread ] ,
953+ comments : [ ] ,
954+ checks : [ ] ,
955+ commentsTruncated : false ,
956+ } ) ,
957+ ] ;
958+ for ( const selected of [ false , true ] ) {
959+ setMergeRequestTerms ( selected ) ;
960+ const ask = buildAskAboutPullRequestHandoff ( metadata ) ;
961+ for ( const fix of fixes ) {
962+ for ( const next of [
963+ appendHandoff ( ask , fix ) ,
964+ appendHandoff ( { prompt : fix . prompt , reviewComments : [ ...fix . reviewComments ] } , ask ) ,
965+ ] ) {
966+ const contexts = next . reviewComments . filter (
967+ ( comment ) => comment . pullRequest !== undefined ,
968+ ) ;
969+ expect ( contexts ) . toHaveLength ( 1 ) ;
970+ expect ( contexts [ 0 ] ?. text ) . not . toContain ( "Do not change any code" ) ;
971+ expect ( contexts [ 0 ] ?. pullRequest ) . toEqual ( metadata ) ;
972+ }
973+ }
974+ }
961975 }
976+ } finally {
977+ setMergeRequestTerms ( false ) ;
962978 }
963979 } ) ;
964980
0 commit comments