Skip to content

Commit

Permalink
Merge master into feature/amazonqLSP
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-toolkit-automation authored Dec 9, 2024
2 parents 81a12b2 + 226dd6f commit ea2cb7f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/core/src/amazonqTest/chat/controller/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ export class TestController {
cwsprChatProgrammingLanguage: session.fileLanguage ?? 'plaintext',
jobId: session.listOfTestGenerationJobId[0], // For RIV, UTG does only one StartTestGeneration API call
jobGroup: session.testGenerationJobGroupName,
requestId: session.startTestGenerationRequestId,
hasUserPromptSupplied: session.hasUserPromptSupplied,
isCodeBlockSelected: session.isCodeBlockSelected,
buildPayloadBytes: session.srcPayloadSize,
Expand Down Expand Up @@ -725,6 +726,7 @@ export class TestController {
cwsprChatProgrammingLanguage: session.fileLanguage ?? 'plaintext',
jobId: session.listOfTestGenerationJobId[0], // For RIV, UTG does only one StartTestGeneration API call so jobId = session.listOfTestGenerationJobId[0]
jobGroup: session.testGenerationJobGroupName,
requestId: session.startTestGenerationRequestId,
buildPayloadBytes: session.srcPayloadSize,
buildZipFileBytes: session.srcZipFileSize,
artifactsUploadDuration: session.artifactsUploadDuration,
Expand Down Expand Up @@ -848,6 +850,7 @@ export class TestController {
cwsprChatProgrammingLanguage: session.fileLanguage ?? 'plaintext',
jobId: session.listOfTestGenerationJobId[0], // For RIV, UTG does only one StartTestGeneration API call so jobId = session.listOfTestGenerationJobId[0]
jobGroup: session.testGenerationJobGroupName,
requestId: session.startTestGenerationRequestId,
buildPayloadBytes: session.srcPayloadSize,
buildZipFileBytes: session.srcZipFileSize,
artifactsUploadDuration: session.artifactsUploadDuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export class Messenger {
fileName: string
) {
let message = ''
const messageId = response.$metadata.requestId ?? ''
let messageId = response.$metadata.requestId ?? ''
let codeReference: CodeReference[] = []

if (response.generateAssistantResponseResponse === undefined) {
Expand Down Expand Up @@ -267,6 +267,7 @@ export class Messenger {
}

if (requestID !== undefined) {
messageId = requestID
message += `\n\nRequest ID: ${requestID}`
}
this.sendMessage(message.trim(), tabID, 'answer')
Expand All @@ -282,6 +283,7 @@ export class Messenger {
reasonDesc: getTelemetryReasonDesc(CodeWhispererConstants.unitTestGenerationCancelMessage),
isSupportedLanguage: false,
credentialStartUrl: AuthUtil.instance.startUrl,
requestId: messageId,
})

this.dispatcher.sendUpdatePromptProgress(
Expand All @@ -296,6 +298,7 @@ export class Messenger {
result: 'Succeeded',
isSupportedLanguage: false,
credentialStartUrl: AuthUtil.instance.startUrl,
requestId: messageId,
})
this.dispatcher.sendUpdatePromptProgress(
new UpdatePromptProgressMessage(tabID, testGenCompletedField)
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/amazonqTest/chat/session/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class Session {
//This is unique per each test generation cycle
public testGenerationJobGroupName: string | undefined = undefined
public listOfTestGenerationJobId: string[] = []
public startTestGenerationRequestId: string | undefined = undefined
public testGenerationJob: TestGenerationJob | undefined

// Start Test generation
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/codewhisperer/service/testGenHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,13 @@ export async function createTestJob(
logger.debug('target line range end: %O', firstTargetLineRangeList?.end)

const resp = await codewhispererClient.codeWhispererClient.startTestGeneration(req).catch((err) => {
ChatSessionManager.Instance.getSession().startTestGenerationRequestId = err.requestId
logger.error(`Failed creating test job. Request id: ${err.requestId}`)
throw err
})
logger.info('Unit test generation request id: %s', resp.$response.requestId)
logger.debug('Unit test generation data: %O', resp.$response.data)
ChatSessionManager.Instance.getSession().startTestGenerationRequestId = resp.$response.requestId
if (resp.$response.error) {
logger.error('Unit test generation error: %O', resp.$response.error)
}
Expand Down

0 comments on commit ea2cb7f

Please sign in to comment.