@@ -63,7 +63,6 @@ import {
6363} from '../../../codewhisperer/models/constants'
6464import { UserWrittenCodeTracker } from '../../../codewhisperer/tracker/userWrittenCodeTracker'
6565import { ReferenceLogViewProvider } from '../../../codewhisperer/service/referenceLogViewProvider'
66- import { Auth } from '../../../auth/auth'
6766
6867export interface TestChatControllerEventEmitters {
6968 readonly tabOpened : vscode . EventEmitter < any >
@@ -801,10 +800,8 @@ export class TestController {
801800 session . linesOfCodeGenerated
802801 )
803802
804- if ( ! Auth . instance . isInternalAmazonUser ( ) ) {
805- await this . endSession ( message , FollowUpTypes . SkipBuildAndFinish )
806- return
807- }
803+ await this . endSession ( message , FollowUpTypes . SkipBuildAndFinish )
804+ return
808805
809806 if ( session . listOfTestGenerationJobId . length === 1 ) {
810807 this . startInitialBuild ( message )
@@ -944,17 +941,12 @@ export class TestController {
944941
945942 private startInitialBuild ( data : any ) {
946943 // TODO: Remove the fallback build command after stable version of backend build command.
947- const userMessage = `Would you like me to help build and execute the test? I’ll run following commands.\n\`\`\`sh\n ${ this . sessionStorage . getSession ( ) . shortAnswer ?. buildCommand } \n `
944+ const userMessage = `Would you like me to help build and execute the test? I will need you to let me know what build command to run if you do. `
948945 const followUps : FollowUps = {
949946 text : '' ,
950947 options : [
951948 {
952- pillText : `Build and execute` ,
953- type : FollowUpTypes . BuildAndExecute ,
954- status : 'primary' ,
955- } ,
956- {
957- pillText : `Modify command` ,
949+ pillText : `Specify command then build and execute` ,
958950 type : FollowUpTypes . ModifyCommands ,
959951 status : 'primary' ,
960952 } ,
@@ -984,6 +976,7 @@ export class TestController {
984976 const listOfInstallationDependencies = [ '' ]
985977 const installationDependencies = listOfInstallationDependencies . join ( '\n' )
986978
979+ this . messenger . sendMessage ( 'Build and execute' , data . tabID , 'prompt' )
987980 telemetry . ui_click . emit ( { elementId : 'unitTestGeneration_buildAndExecute' } )
988981
989982 if ( installationDependencies . length > 0 ) {
@@ -1032,6 +1025,11 @@ export class TestController {
10321025 // const installationDependencies = session.shortAnswer?.installationDependencies ?? []
10331026 // MOCK: ignoring the installation case until backend send response
10341027 const installationDependencies : string [ ] = [ ]
1028+ const buildCommands = session . updatedBuildCommands
1029+ if ( ! buildCommands ) {
1030+ throw new Error ( 'Build command not found' )
1031+ return
1032+ }
10351033
10361034 this . messenger . sendBuildProgressMessage ( {
10371035 tabID : data . tabID ,
@@ -1103,7 +1101,7 @@ export class TestController {
11031101 messageId : TestNamedMessages . TEST_GENERATION_BUILD_STATUS_MESSAGE ,
11041102 } )
11051103
1106- const buildStatus = await runBuildCommand ( this . getBuildCommands ( ) )
1104+ const buildStatus = await runBuildCommand ( buildCommands )
11071105 session . buildStatus = buildStatus
11081106
11091107 if ( buildStatus === BuildStatus . FAILURE ) {
@@ -1231,17 +1229,10 @@ export class TestController {
12311229 fileList : this . checkCodeDiffLengthAndBuildStatus ( { codeDiffLength, buildStatus : session . buildStatus } )
12321230 ? {
12331231 fileTreeTitle : 'READY FOR REVIEW' ,
1234- rootFolderTitle : path . basename ( session . projectRootPath ) ,
1232+ rootFolderTitle : 'tests' ,
12351233 filePaths : [ session . generatedFilePath ] ,
12361234 }
12371235 : undefined ,
1238- codeReference : session . references . map (
1239- ( ref : ShortAnswerReference ) =>
1240- ( {
1241- ...ref ,
1242- information : `${ ref . licenseName } - <a href="${ ref . url } ">${ ref . repository } </a>` ,
1243- } ) as CodeReference
1244- ) ,
12451236 } )
12461237 this . messenger . sendBuildProgressMessage ( {
12471238 tabID : data . tabID ,
@@ -1270,7 +1261,7 @@ export class TestController {
12701261
12711262 private modifyBuildCommand ( data : any ) {
12721263 this . sessionStorage . getSession ( ) . conversationState = ConversationState . WAITING_FOR_BUILD_COMMMAND_INPUT
1273- this . messenger . sendMessage ( 'Modify Command ' , data . tabID , 'prompt' )
1264+ this . messenger . sendMessage ( 'Specify commands then build ' , data . tabID , 'prompt' )
12741265 telemetry . ui_click . emit ( { elementId : 'unitTestGeneration_modifyCommand' } )
12751266 this . messenger . sendMessage (
12761267 'Sure, provide all command lines you’d like me to run to build.' ,
@@ -1383,16 +1374,21 @@ export class TestController {
13831374 }
13841375
13851376 // TODO: return build command when product approves
1386- private getBuildCommands = ( ) : string [ ] => {
1387- const session = this . sessionStorage . getSession ( )
1388- if ( session . updatedBuildCommands ?. length ) {
1389- return [ ...session . updatedBuildCommands ]
1390- }
1391-
1392- if ( session . shortAnswer && session . shortAnswer ?. buildCommand ) {
1393- return [ session . shortAnswer . buildCommand ]
1394- }
1395- // TODO: Add a generic command here for external launch according to the build system.
1396- return [ 'brazil-build release' ]
1397- }
1377+ // private getBuildCommands = (): string[] => {
1378+ // const session = this.sessionStorage.getSession()
1379+ // if (session.updatedBuildCommands?.length) {
1380+ // return [...session.updatedBuildCommands]
1381+ // }
1382+
1383+ // // For Internal amazon users only
1384+ // if (Auth.instance.isInternalAmazonUser()) {
1385+ // return ['brazil-build release']
1386+ // }
1387+
1388+ // if (session.shortAnswer && Array.isArray(session.shortAnswer?.buildCommands)) {
1389+ // return [...session.shortAnswer.buildCommands]
1390+ // }
1391+
1392+ // return ['source qdev-wbr/.venv/bin/activate && pytest --continue-on-collection-errors']
1393+ // }
13981394}
0 commit comments