Skip to content

Commit

Permalink
Merge master into feature/falcon
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-toolkit-automation authored Mar 10, 2025
2 parents 1db0893 + 0ed2a3a commit d0b8baf
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 14 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"skippedTestReport": "ts-node ./scripts/skippedTestReport.ts ./packages/amazonq/test/e2e/"
},
"devDependencies": {
"@aws-toolkits/telemetry": "^1.0.305",
"@aws-toolkits/telemetry": "^1.0.307",
"@playwright/browser-chromium": "^1.43.1",
"@stylistic/eslint-plugin": "^2.11.0",
"@types/he": "^1.2.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "/review: Zip files are created with the wrong file path for file scans in multifolder workspaces."
}
22 changes: 18 additions & 4 deletions packages/core/src/amazonqTest/chat/controller/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class TestController {
}
TelemetryHelper.instance.sendTestGenerationToolkitEvent(
session,
true,
session.isSupportedLanguage,
true,
isCancel ? 'Cancelled' : 'Failed',
session.startTestGenerationRequestId,
Expand All @@ -295,7 +295,15 @@ export class TestController {
session.isCodeBlockSelected,
session.artifactsUploadDuration,
session.srcPayloadSize,
session.srcZipFileSize
session.srcZipFileSize,
session.charsOfCodeAccepted,
session.numberOfTestsGenerated,
session.linesOfCodeGenerated,
session.charsOfCodeGenerated,
session.numberOfTestsGenerated,
session.linesOfCodeGenerated,
undefined,
isCancel ? 'CANCELLED' : 'FAILED'
)
if (session.stopIteration) {
// Error from Science
Expand Down Expand Up @@ -502,6 +510,7 @@ export class TestController {
unsupportedMessage = `<span style="color: #EE9D28;">&#9888;<b>I'm sorry, but /test only supports Python and Java</b><br></span> I will still generate a suggestion below.`
}
this.messenger.sendMessage(unsupportedMessage, tabID, 'answer')
session.isSupportedLanguage = false
await this.onCodeGeneration(
session,
userPrompt,
Expand Down Expand Up @@ -529,6 +538,7 @@ export class TestController {
)
}
session.isCodeBlockSelected = selectionRange !== undefined
session.isSupportedLanguage = true

/**
* Zip the project
Expand Down Expand Up @@ -792,7 +802,9 @@ export class TestController {
session.linesOfCodeAccepted,
session.charsOfCodeGenerated,
session.numberOfTestsGenerated,
session.linesOfCodeGenerated
session.linesOfCodeGenerated,
undefined,
'ACCEPTED'
)

await this.endSession(message, FollowUpTypes.SkipBuildAndFinish)
Expand Down Expand Up @@ -918,7 +930,9 @@ export class TestController {
0,
session.charsOfCodeGenerated,
session.numberOfTestsGenerated,
session.linesOfCodeGenerated
session.linesOfCodeGenerated,
undefined,
'REJECTED'
)
telemetry.ui_click.emit({ elementId: 'unitTestGeneration_rejectDiff' })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ export class Messenger {
undefined,
undefined,
undefined,
'TestGenCancelled'
'TestGenCancelled',
'CANCELLED'
)
this.dispatcher.sendUpdatePromptProgress(
new UpdatePromptProgressMessage(tabID, cancellingProgressField)
Expand All @@ -310,7 +311,19 @@ export class Messenger {
'Succeeded',
messageId,
performance.now() - session.testGenerationStartTime,
undefined
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
'ACCEPTED'
)
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 @@ -35,6 +35,7 @@ export class Session {
public testGenerationJob: TestGenerationJob | undefined

// Start Test generation
public isSupportedLanguage: boolean = false
public conversationState: ConversationState = ConversationState.IDLE
public shortAnswer: ShortAnswer | undefined
public sourceFilePath: string = ''
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/codewhisperer/util/telemetryHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
CodewhispererPreviousSuggestionState,
CodewhispererUserDecision,
CodewhispererUserTriggerDecision,
Status,
telemetry,
} from '../../shared/telemetry/telemetry'
import { CodewhispererCompletionType, CodewhispererSuggestionState } from '../../shared/telemetry/telemetry'
Expand Down Expand Up @@ -85,12 +86,13 @@ export class TelemetryHelper {
generatedCharactersCount?: number,
generatedCount?: number,
generatedLinesCount?: number,
reason?: string
reason?: string,
status?: Status
) {
telemetry.amazonq_utgGenerateTests.emit({
cwsprChatProgrammingLanguage: session.fileLanguage ?? 'plaintext',
hasUserPromptSupplied: session.hasUserPromptSupplied,
isSupportedLanguage: isSupportedLanguage,
isSupportedLanguage: session.isSupportedLanguage,
isFileInWorkspace: isFileInWorkspace,
result: result,
artifactsUploadDuration: artifactsUploadDuration,
Expand All @@ -110,6 +112,7 @@ export class TelemetryHelper {
requestId: requestId,
reasonDesc: reasonDesc,
reason: reason,
status: status,
})
}

Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/codewhisperer/util/zipUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ export class ZipUtil {
// Note: workspaceFolder.name is not the same as the file system folder name,
// use the fsPath value instead
const projectName = path.basename(workspaceFolder.uri.fsPath)
const relativePath = vscode.workspace.asRelativePath(uri)
// Set includeWorkspaceFolder to false because we are already manually prepending the projectName
const relativePath = vscode.workspace.asRelativePath(uri, false)
const zipEntryPath = this.getZipEntryPath(projectName, relativePath)
zip.addFile(zipEntryPath, Buffer.from(content, 'utf-8'))

Expand Down

0 comments on commit d0b8baf

Please sign in to comment.