From 5174198450c5a7180f251ddc234ffdf6af5c2442 Mon Sep 17 00:00:00 2001
From: aws-toolkit-automation <>
Date: Wed, 5 Feb 2025 20:22:09 +0000
Subject: [PATCH 01/12] Release 1.46.0
---
package-lock.json | 4 +-
packages/amazonq/.changes/1.46.0.json | 38 +++++++++++++++++++
...-22f55c14-bd62-49d7-aa68-3ab3cc8f0929.json | 4 --
...-5c9f7fbc-1333-4c28-a049-7b17a17a7cea.json | 4 --
...-c3484e6b-4093-4d35-8964-b5d07fb76469.json | 4 --
...-ca03bdf5-a707-479e-9405-e9ac3b73e30a.json | 4 --
...-dc78e630-6320-4297-9ae9-7a19891f5357.json | 4 --
...-e2bb3c83-52e8-4ae9-aedb-844e8780971b.json | 4 --
...-b63d765a-24f9-44e6-b826-b905f35e67d1.json | 4 --
...-d4b1f56f-fbfd-43e9-b4e1-e2c972dcf197.json | 4 --
packages/amazonq/CHANGELOG.md | 11 ++++++
packages/amazonq/package.json | 2 +-
12 files changed, 52 insertions(+), 35 deletions(-)
create mode 100644 packages/amazonq/.changes/1.46.0.json
delete mode 100644 packages/amazonq/.changes/next-release/Bug Fix-22f55c14-bd62-49d7-aa68-3ab3cc8f0929.json
delete mode 100644 packages/amazonq/.changes/next-release/Bug Fix-5c9f7fbc-1333-4c28-a049-7b17a17a7cea.json
delete mode 100644 packages/amazonq/.changes/next-release/Bug Fix-c3484e6b-4093-4d35-8964-b5d07fb76469.json
delete mode 100644 packages/amazonq/.changes/next-release/Bug Fix-ca03bdf5-a707-479e-9405-e9ac3b73e30a.json
delete mode 100644 packages/amazonq/.changes/next-release/Bug Fix-dc78e630-6320-4297-9ae9-7a19891f5357.json
delete mode 100644 packages/amazonq/.changes/next-release/Bug Fix-e2bb3c83-52e8-4ae9-aedb-844e8780971b.json
delete mode 100644 packages/amazonq/.changes/next-release/Feature-b63d765a-24f9-44e6-b826-b905f35e67d1.json
delete mode 100644 packages/amazonq/.changes/next-release/Feature-d4b1f56f-fbfd-43e9-b4e1-e2c972dcf197.json
diff --git a/package-lock.json b/package-lock.json
index 5fa0d8b6865..cd775bdd02c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -44,7 +44,7 @@
"prettier": "^3.3.3",
"prettier-plugin-sh": "^0.14.0",
"pretty-quick": "^4.0.0",
- "ts-node": "^10.9.1",
+ "ts-node": "^10.9.2",
"typescript": "^5.0.4",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4",
@@ -23904,7 +23904,7 @@
},
"packages/amazonq": {
"name": "amazon-q-vscode",
- "version": "1.46.0-SNAPSHOT",
+ "version": "1.46.0",
"license": "Apache-2.0",
"dependencies": {
"aws-core-vscode": "file:../core/"
diff --git a/packages/amazonq/.changes/1.46.0.json b/packages/amazonq/.changes/1.46.0.json
new file mode 100644
index 00000000000..1253cbe3d01
--- /dev/null
+++ b/packages/amazonq/.changes/1.46.0.json
@@ -0,0 +1,38 @@
+{
+ "date": "2025-02-05",
+ "version": "1.46.0",
+ "entries": [
+ {
+ "type": "Bug Fix",
+ "description": "Citation links are not clickable as numbers, but appear as non-clickable texts"
+ },
+ {
+ "type": "Bug Fix",
+ "description": "Fix language server start failure in AL2023 ARM64"
+ },
+ {
+ "type": "Bug Fix",
+ "description": "/review: Auto-review issues did not populate code issues list"
+ },
+ {
+ "type": "Bug Fix",
+ "description": "Amazon Q: Fix code upload error when using /dev or /doc on Remote SSH"
+ },
+ {
+ "type": "Bug Fix",
+ "description": "/test placeholder text aligned across IDEs"
+ },
+ {
+ "type": "Bug Fix",
+ "description": "Inline: Typos in the first example suggestion"
+ },
+ {
+ "type": "Feature",
+ "description": "Inline suggestions: Pre-fetch recommendations to reduce suggestion latency."
+ },
+ {
+ "type": "Feature",
+ "description": "Added github issue link and description to the chat answer feedback form"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/packages/amazonq/.changes/next-release/Bug Fix-22f55c14-bd62-49d7-aa68-3ab3cc8f0929.json b/packages/amazonq/.changes/next-release/Bug Fix-22f55c14-bd62-49d7-aa68-3ab3cc8f0929.json
deleted file mode 100644
index ba2818371ba..00000000000
--- a/packages/amazonq/.changes/next-release/Bug Fix-22f55c14-bd62-49d7-aa68-3ab3cc8f0929.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "type": "Bug Fix",
- "description": "Citation links are not clickable as numbers, but appear as non-clickable texts"
-}
diff --git a/packages/amazonq/.changes/next-release/Bug Fix-5c9f7fbc-1333-4c28-a049-7b17a17a7cea.json b/packages/amazonq/.changes/next-release/Bug Fix-5c9f7fbc-1333-4c28-a049-7b17a17a7cea.json
deleted file mode 100644
index 783359087ea..00000000000
--- a/packages/amazonq/.changes/next-release/Bug Fix-5c9f7fbc-1333-4c28-a049-7b17a17a7cea.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "type": "Bug Fix",
- "description": "Fix language server start failure in AL2023 ARM64"
-}
diff --git a/packages/amazonq/.changes/next-release/Bug Fix-c3484e6b-4093-4d35-8964-b5d07fb76469.json b/packages/amazonq/.changes/next-release/Bug Fix-c3484e6b-4093-4d35-8964-b5d07fb76469.json
deleted file mode 100644
index 694495c26ae..00000000000
--- a/packages/amazonq/.changes/next-release/Bug Fix-c3484e6b-4093-4d35-8964-b5d07fb76469.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "type": "Bug Fix",
- "description": "/review: Auto-review issues did not populate code issues list"
-}
diff --git a/packages/amazonq/.changes/next-release/Bug Fix-ca03bdf5-a707-479e-9405-e9ac3b73e30a.json b/packages/amazonq/.changes/next-release/Bug Fix-ca03bdf5-a707-479e-9405-e9ac3b73e30a.json
deleted file mode 100644
index 4399da617e7..00000000000
--- a/packages/amazonq/.changes/next-release/Bug Fix-ca03bdf5-a707-479e-9405-e9ac3b73e30a.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "type": "Bug Fix",
- "description": "Amazon Q: Fix code upload error when using /dev or /doc on Remote SSH"
-}
diff --git a/packages/amazonq/.changes/next-release/Bug Fix-dc78e630-6320-4297-9ae9-7a19891f5357.json b/packages/amazonq/.changes/next-release/Bug Fix-dc78e630-6320-4297-9ae9-7a19891f5357.json
deleted file mode 100644
index e34722b9aac..00000000000
--- a/packages/amazonq/.changes/next-release/Bug Fix-dc78e630-6320-4297-9ae9-7a19891f5357.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "type": "Bug Fix",
- "description": "/test placeholder text aligned across IDEs"
-}
diff --git a/packages/amazonq/.changes/next-release/Bug Fix-e2bb3c83-52e8-4ae9-aedb-844e8780971b.json b/packages/amazonq/.changes/next-release/Bug Fix-e2bb3c83-52e8-4ae9-aedb-844e8780971b.json
deleted file mode 100644
index 55ce7a614a9..00000000000
--- a/packages/amazonq/.changes/next-release/Bug Fix-e2bb3c83-52e8-4ae9-aedb-844e8780971b.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "type": "Bug Fix",
- "description": "Inline: Typos in the first example suggestion"
-}
diff --git a/packages/amazonq/.changes/next-release/Feature-b63d765a-24f9-44e6-b826-b905f35e67d1.json b/packages/amazonq/.changes/next-release/Feature-b63d765a-24f9-44e6-b826-b905f35e67d1.json
deleted file mode 100644
index 595e48f0026..00000000000
--- a/packages/amazonq/.changes/next-release/Feature-b63d765a-24f9-44e6-b826-b905f35e67d1.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "type": "Feature",
- "description": "Inline suggestions: Pre-fetch recommendations to reduce suggestion latency."
-}
diff --git a/packages/amazonq/.changes/next-release/Feature-d4b1f56f-fbfd-43e9-b4e1-e2c972dcf197.json b/packages/amazonq/.changes/next-release/Feature-d4b1f56f-fbfd-43e9-b4e1-e2c972dcf197.json
deleted file mode 100644
index 065aad75325..00000000000
--- a/packages/amazonq/.changes/next-release/Feature-d4b1f56f-fbfd-43e9-b4e1-e2c972dcf197.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "type": "Feature",
- "description": "Added github issue link and description to the chat answer feedback form"
-}
diff --git a/packages/amazonq/CHANGELOG.md b/packages/amazonq/CHANGELOG.md
index 8e8dd546b83..fa9896f64f1 100644
--- a/packages/amazonq/CHANGELOG.md
+++ b/packages/amazonq/CHANGELOG.md
@@ -1,3 +1,14 @@
+## 1.46.0 2025-02-05
+
+- **Bug Fix** Citation links are not clickable as numbers, but appear as non-clickable texts
+- **Bug Fix** Fix language server start failure in AL2023 ARM64
+- **Bug Fix** /review: Auto-review issues did not populate code issues list
+- **Bug Fix** Amazon Q: Fix code upload error when using /dev or /doc on Remote SSH
+- **Bug Fix** /test placeholder text aligned across IDEs
+- **Bug Fix** Inline: Typos in the first example suggestion
+- **Feature** Inline suggestions: Pre-fetch recommendations to reduce suggestion latency.
+- **Feature** Added github issue link and description to the chat answer feedback form
+
## 1.45.0 2025-01-30
- **Bug Fix** Allow AB users with an overridden customization to go back to the default customization
diff --git a/packages/amazonq/package.json b/packages/amazonq/package.json
index 62f008a2213..6ed5ba737ec 100644
--- a/packages/amazonq/package.json
+++ b/packages/amazonq/package.json
@@ -2,7 +2,7 @@
"name": "amazon-q-vscode",
"displayName": "Amazon Q",
"description": "The most capable generative AI-powered assistant for building, operating, and transforming software, with advanced capabilities for managing data and AI",
- "version": "1.46.0-SNAPSHOT",
+ "version": "1.46.0",
"extensionKind": [
"workspace"
],
From 2b345c9f9c1a64d469b573ccd2f9384a29819912 Mon Sep 17 00:00:00 2001
From: aws-toolkit-automation <>
Date: Thu, 6 Feb 2025 18:44:51 +0000
Subject: [PATCH 02/12] Update version to snapshot version: 1.47.0-SNAPSHOT
---
package-lock.json | 4 ++--
packages/amazonq/package.json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index cd775bdd02c..bd4a964f591 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -44,7 +44,7 @@
"prettier": "^3.3.3",
"prettier-plugin-sh": "^0.14.0",
"pretty-quick": "^4.0.0",
- "ts-node": "^10.9.2",
+ "ts-node": "^10.9.1",
"typescript": "^5.0.4",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4",
@@ -23904,7 +23904,7 @@
},
"packages/amazonq": {
"name": "amazon-q-vscode",
- "version": "1.46.0",
+ "version": "1.47.0-SNAPSHOT",
"license": "Apache-2.0",
"dependencies": {
"aws-core-vscode": "file:../core/"
diff --git a/packages/amazonq/package.json b/packages/amazonq/package.json
index 6ed5ba737ec..deb37933ae8 100644
--- a/packages/amazonq/package.json
+++ b/packages/amazonq/package.json
@@ -2,7 +2,7 @@
"name": "amazon-q-vscode",
"displayName": "Amazon Q",
"description": "The most capable generative AI-powered assistant for building, operating, and transforming software, with advanced capabilities for managing data and AI",
- "version": "1.46.0",
+ "version": "1.47.0-SNAPSHOT",
"extensionKind": [
"workspace"
],
From 610dd186585536f7c33147645650370e3d69e133 Mon Sep 17 00:00:00 2001
From: Josh Pinkney <103940141+jpinkney-aws@users.noreply.github.com>
Date: Thu, 6 Feb 2025 15:55:32 -0500
Subject: [PATCH 03/12] fix(amazonq): debugging amazon q can crash vscode
(#6514)
## Problem
If you have amazon q locally and start a debugging session, pressing
stop can sometimes crash the entirety of vscode
## Solution
remove
[debugWebviews](https://github.com/microsoft/vscode-js-debug/blob/main/OPTIONS.md#rendererdebugoptions)/[rendererDebugOptions](https://github.com/microsoft/vscode-js-debug/blob/main/OPTIONS.md#rendererdebugoptions)
from amazon q's launch config since they cause the local amazon q
webview to attach to the debug instance which coincidentally ends up
crashing vscode when extension debugging is stopped
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
---
packages/amazonq/.vscode/launch.json | 5 -----
1 file changed, 5 deletions(-)
diff --git a/packages/amazonq/.vscode/launch.json b/packages/amazonq/.vscode/launch.json
index 120eacdb44d..84f48b6f785 100644
--- a/packages/amazonq/.vscode/launch.json
+++ b/packages/amazonq/.vscode/launch.json
@@ -9,11 +9,6 @@
"name": "Extension",
"type": "extensionHost",
"request": "launch",
- "debugWebviews": true,
- "rendererDebugOptions": {
- "urlFilter": "*amazonwebservices.amazon-q-vscode*",
- "webRoot": "${workspaceFolder}"
- },
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"env": {
From fb5baceae2b3b441910dd92d812cafd388b45b50 Mon Sep 17 00:00:00 2001
From: Vlad <44401081+witness-me@users.noreply.github.com>
Date: Thu, 6 Feb 2025 12:55:43 -0800
Subject: [PATCH 04/12] fix(lint): Remove extra space (#6517)
## Problem
A line in
[packages/core/package.nls.json](https://github.com/aws/aws-toolkit-vscode/compare/master...witness-me:fix-lint?expand=1#diff-4d90099a916e267c6fa8cfeeec9c569c4889dc50cb53178e1c748d0d37ff501e)
contains extra space, which is inconsistent with current code style
## Solution
Remove extra space
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
Co-authored-by: Vlad Nikolaenko
---
packages/core/package.nls.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/core/package.nls.json b/packages/core/package.nls.json
index 850f7242b45..e910c009d58 100644
--- a/packages/core/package.nls.json
+++ b/packages/core/package.nls.json
@@ -20,7 +20,7 @@
"AWS.configuration.description.suppressPrompts": "Prompts which ask for confirmation. Checking an item suppresses the prompt.",
"AWS.configuration.enableCodeLenses": "Enable SAM hints in source code and template.yaml files",
"AWS.configuration.description.resources.enabledResources": "AWS resources to display in the 'Resources' portion of the explorer.",
- "AWS.configuration.description.featureDevelopment.allowRunningCodeAndTests": "Allow /dev to run code and test commands",
+ "AWS.configuration.description.featureDevelopment.allowRunningCodeAndTests": "Allow /dev to run code and test commands",
"AWS.configuration.description.experiments": "Try experimental features and give feedback. Note that experimental features may be removed at any time.\n * `jsonResourceModification` - Enables basic create, update, and delete support for cloud resources via the JSON Resources explorer component.",
"AWS.stepFunctions.asl.format.enable.desc": "Enables the default formatter used with Amazon States Language files",
"AWS.stepFunctions.asl.maxItemsComputed.desc": "The maximum number of outline symbols and folding regions computed (limited for performance reasons).",
From 02d21a2fafc7479fb398ea078aa3e3adf7c62e7a Mon Sep 17 00:00:00 2001
From: jonife <79116465+jonife@users.noreply.github.com>
Date: Thu, 6 Feb 2025 14:17:20 -0800
Subject: [PATCH 05/12] fix(appbuilder): Update support for enVar in the
webview (#6413)
## Problem
Update support for enVar in the webview
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
---
.../core/src/awsService/appBuilder/explorer/samProject.ts | 5 ++++-
.../core/src/lambda/vue/configEditor/samInvokeBackend.ts | 4 ++++
.../core/src/lambda/vue/configEditor/samInvokeComponent.vue | 3 ---
.../core/src/lambda/vue/configEditor/samInvokeFrontend.ts | 5 +++++
packages/core/src/test/lambda/vue/samInvokeBackend.test.ts | 3 +++
.../Feature-b2217598-82cb-4268-b731-e137fa6a92e8.json | 4 ++++
6 files changed, 20 insertions(+), 4 deletions(-)
create mode 100644 packages/toolkit/.changes/next-release/Feature-b2217598-82cb-4268-b731-e137fa6a92e8.json
diff --git a/packages/core/src/awsService/appBuilder/explorer/samProject.ts b/packages/core/src/awsService/appBuilder/explorer/samProject.ts
index ce8d0c4878a..722ec323192 100644
--- a/packages/core/src/awsService/appBuilder/explorer/samProject.ts
+++ b/packages/core/src/awsService/appBuilder/explorer/samProject.ts
@@ -30,6 +30,9 @@ export interface ResourceTreeEntity {
Events?: ResourceTreeEntity[]
Path?: string
Method?: string
+ Environment?: {
+ Variables: Record
+ }
}
export async function getStackName(projectRoot: vscode.Uri): Promise {
@@ -81,10 +84,10 @@ function getResourceEntity(template: any): ResourceTreeEntity[] {
Handler: resource.Properties?.Handler ?? template?.Globals?.Function?.Handler,
Events: resource.Properties?.Events ? getEvents(resource.Properties.Events) : undefined,
CodeUri: resource.Properties?.CodeUri ?? template?.Globals?.Function?.CodeUri,
+ Environment: resource.Properties?.Environment ?? template?.Globals?.Function?.Environment,
}
resourceTree.push(resourceEntity)
}
-
return resourceTree
}
diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts b/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts
index ba624536b0f..2c3c8ee40dd 100644
--- a/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts
+++ b/packages/core/src/lambda/vue/configEditor/samInvokeBackend.ts
@@ -46,6 +46,9 @@ export interface ResourceData {
runtime: string
stackName: string
source: string
+ environment?: {
+ Variables: Record
+ }
}
export type AwsSamDebuggerConfigurationLoose = AwsSamDebuggerConfiguration & {
@@ -441,6 +444,7 @@ export async function registerSamDebugInvokeVueCommand(
runtime: resource.resource.Runtime!,
arn: resource.functionArn ?? '',
stackName: resource.stackName ?? '',
+ environment: resource.resource.Environment,
source: source,
})
await telemetry.sam_openConfigUi.run(async (span) => {
diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue b/packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue
index 468d7393ac6..6d64291cff6 100644
--- a/packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue
+++ b/packages/core/src/lambda/vue/configEditor/samInvokeComponent.vue
@@ -29,9 +29,6 @@
debugger to the code running in a local Docker container. open
launch.json.
- Note: If you are accessing environment variables in your function code, ensure you
- input them in the "Additional fields -> Lambda -> Environment variables" section, following JSON
- format:{"KEY":"VALUE"}
diff --git a/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts b/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts
index c266abb8a4b..6502accae41 100644
--- a/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts
+++ b/packages/core/src/lambda/vue/configEditor/samInvokeFrontend.ts
@@ -345,6 +345,11 @@ export default defineComponent({
this.launchConfig.invokeTarget.lambdaHandler = this.resourceData.handler
if (this.launchConfig.lambda) {
this.launchConfig.lambda.runtime = this.resourceData.runtime
+ if (this.resourceData.environment?.Variables !== undefined) {
+ this.environmentVariables.value = JSON.stringify(
+ this.resourceData.environment?.Variables
+ )
+ }
}
}
},
diff --git a/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts b/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts
index 18ae33b67d0..cbad9bfff55 100644
--- a/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts
+++ b/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts
@@ -728,6 +728,9 @@ describe('SamInvokeWebview', () => {
},
lambda: {
runtime: 'python3.9',
+ environmentVariables: {
+ PARAM1: 'VALUE',
+ },
},
sam: {
containerBuild: false,
diff --git a/packages/toolkit/.changes/next-release/Feature-b2217598-82cb-4268-b731-e137fa6a92e8.json b/packages/toolkit/.changes/next-release/Feature-b2217598-82cb-4268-b731-e137fa6a92e8.json
new file mode 100644
index 00000000000..e96232f471c
--- /dev/null
+++ b/packages/toolkit/.changes/next-release/Feature-b2217598-82cb-4268-b731-e137fa6a92e8.json
@@ -0,0 +1,4 @@
+{
+ "type": "Feature",
+ "description": "Lambda: Support for environment variables in the editor webview."
+}
From 34dc1019b79bc1abae6515b230a174313dc012d6 Mon Sep 17 00:00:00 2001
From: David <60020664+dhasani23@users.noreply.github.com>
Date: Thu, 6 Feb 2025 19:19:55 -0400
Subject: [PATCH 06/12] fix(amazonq): log full error (#6422)
## Problem
When API calls fail, it can be difficult to debug without the requestId.
## Solution
Log entire error to ensure we have all relevant details, not just the
error message.
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
---------
Co-authored-by: David Hasani
---
.../transformByQ/transformApiHandler.ts | 64 +++++++------------
1 file changed, 24 insertions(+), 40 deletions(-)
diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts b/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts
index b5f4d2d1447..023e0208bf8 100644
--- a/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts
+++ b/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts
@@ -127,7 +127,9 @@ export async function uploadArtifactToS3(
if (response.status === 200) {
break
}
- throw new Error('Upload failed')
+ throw new Error(
+ `Upload failed, status = ${response.status}; full response: ${JSON.stringify(response)}`
+ )
} catch (e: any) {
if (response && !retriableCodes.includes(response.status)) {
throw new Error(`Upload failed with status code = ${response.status}; did not automatically retry`)
@@ -169,7 +171,7 @@ export async function resumeTransformationJob(jobId: string, userActionStatus: T
}
} catch (e: any) {
const errorMessage = `Resuming the job failed due to: ${(e as Error).message}`
- getLogger().error(`CodeTransformation: ResumeTransformation error = ${errorMessage}`)
+ getLogger().error(`CodeTransformation: ResumeTransformation error = %O`, e)
throw new Error(errorMessage)
}
}
@@ -180,18 +182,12 @@ export async function stopJob(jobId: string) {
}
try {
- const response = await codeWhisperer.codeWhispererClient.codeModernizerStopCodeTransformation({
+ await codeWhisperer.codeWhispererClient.codeModernizerStopCodeTransformation({
transformationJobId: jobId,
})
- if (response !== undefined) {
- // always store request ID, but it will only show up in a notification if an error occurs
- if (response.$response.requestId) {
- transformByQState.setJobFailureMetadata(` (request ID: ${response.$response.requestId})`)
- }
- }
} catch (e: any) {
- const errorMessage = (e as Error).message
- getLogger().error(`CodeTransformation: StopTransformation error = ${errorMessage}`)
+ transformByQState.setJobFailureMetadata(` (request ID: ${e.requestId ?? 'unavailable'})`)
+ getLogger().error(`CodeTransformation: StopTransformation error = %O`, e)
throw new Error('Stop job failed')
}
}
@@ -209,12 +205,10 @@ export async function uploadPayload(payloadFileName: string, uploadContext?: Upl
uploadIntent: CodeWhispererConstants.uploadIntent,
uploadContext,
})
- if (response.$response.requestId) {
- transformByQState.setJobFailureMetadata(` (request ID: ${response.$response.requestId})`)
- }
} catch (e: any) {
- const errorMessage = `The upload failed due to: ${(e as Error).message}`
- getLogger().error(`CodeTransformation: CreateUploadUrl error: = ${e}`)
+ const errorMessage = `Creating the upload URL failed due to: ${(e as Error).message}`
+ transformByQState.setJobFailureMetadata(` (request ID: ${e.requestId ?? 'unavailable'})`)
+ getLogger().error(`CodeTransformation: CreateUploadUrl error: = %O`, e)
throw new Error(errorMessage)
}
@@ -449,13 +443,11 @@ export async function startJob(uploadId: string) {
},
})
getLogger().info('CodeTransformation: called startJob API successfully')
- if (response.$response.requestId) {
- transformByQState.setJobFailureMetadata(` (request ID: ${response.$response.requestId})`)
- }
return response.transformationJobId
} catch (e: any) {
const errorMessage = `Starting the job failed due to: ${(e as Error).message}`
- getLogger().error(`CodeTransformation: StartTransformation error = ${errorMessage}`)
+ transformByQState.setJobFailureMetadata(` (request ID: ${e.requestId ?? 'unavailable'})`)
+ getLogger().error(`CodeTransformation: StartTransformation error = %O`, e)
throw new Error(errorMessage)
}
}
@@ -573,9 +565,6 @@ export async function getTransformationPlan(jobId: string) {
response = await codeWhisperer.codeWhispererClient.codeModernizerGetCodeTransformationPlan({
transformationJobId: jobId,
})
- if (response.$response.requestId) {
- transformByQState.setJobFailureMetadata(` (request ID: ${response.$response.requestId})`)
- }
const stepZeroProgressUpdates = response.transformationPlan.transformationSteps[0].progressUpdates
@@ -618,13 +607,14 @@ export async function getTransformationPlan(jobId: string) {
return plan
} catch (e: any) {
const errorMessage = (e as Error).message
- getLogger().error(`CodeTransformation: GetTransformationPlan error = ${errorMessage}`)
+ transformByQState.setJobFailureMetadata(` (request ID: ${e.requestId ?? 'unavailable'})`)
+ getLogger().error(`CodeTransformation: GetTransformationPlan error = %O`, e)
/* Means API call failed
* If response is defined, means a display/parsing error occurred, so continue transformation
*/
if (response === undefined) {
- throw new Error('Get plan API call failed')
+ throw new Error(errorMessage)
}
}
}
@@ -638,13 +628,10 @@ export async function getTransformationSteps(jobId: string, handleThrottleFlag:
const response = await codeWhisperer.codeWhispererClient.codeModernizerGetCodeTransformationPlan({
transformationJobId: jobId,
})
- if (response.$response.requestId) {
- transformByQState.setJobFailureMetadata(` (request ID: ${response.$response.requestId})`)
- }
return response.transformationPlan.transformationSteps.slice(1) // skip step 0 (contains supplemental info)
} catch (e: any) {
- const errorMessage = (e as Error).message
- getLogger().error(`CodeTransformation: GetTransformationPlan error = ${errorMessage}`)
+ transformByQState.setJobFailureMetadata(` (request ID: ${e.requestId ?? 'unavailable'})`)
+ getLogger().error(`CodeTransformation: GetTransformationPlan error = %O`, e)
throw e
}
}
@@ -682,7 +669,6 @@ export async function pollTransformationJob(jobId: string, validStates: string[]
transformByQState.setJobFailureErrorNotification(
`${CodeWhispererConstants.failedToCompleteJobGenericNotification} ${errorMessage}`
)
- transformByQState.setJobFailureMetadata(` (request ID: ${response.$response.requestId})`)
}
if (validStates.includes(status)) {
break
@@ -700,14 +686,14 @@ export async function pollTransformationJob(jobId: string, validStates: string[]
* is called, we break above on validStatesForCheckingDownloadUrl and check final status in finalizeTransformationJob
*/
if (CodeWhispererConstants.failureStates.includes(status)) {
- transformByQState.setJobFailureMetadata(` (request ID: ${response.$response.requestId})`)
- throw new JobStoppedError(response.$response.requestId)
+ throw new JobStoppedError(
+ response.transformationJob.reason ?? 'no failure reason in GetTransformation response'
+ )
}
await sleep(CodeWhispererConstants.transformationJobPollingIntervalSeconds * 1000)
} catch (e: any) {
- let errorMessage = (e as Error).message
- errorMessage += ` -- ${transformByQState.getJobFailureMetadata()}`
- getLogger().error(`CodeTransformation: GetTransformation error = ${errorMessage}`)
+ getLogger().error(`CodeTransformation: GetTransformation error = %O`, e)
+ transformByQState.setJobFailureMetadata(` (request ID: ${e.requestId ?? 'unavailable'})`)
throw e
}
}
@@ -752,7 +738,6 @@ export async function downloadResultArchive(
pathToArchive: string,
downloadArtifactType: TransformationDownloadArtifactType
) {
- let downloadErrorMessage = undefined
const cwStreamingClient = await createCodeWhispererChatStreamingClient()
try {
@@ -765,8 +750,7 @@ export async function downloadResultArchive(
pathToArchive
)
} catch (e: any) {
- downloadErrorMessage = (e as Error).message
- getLogger().error(`CodeTransformation: ExportResultArchive error = ${downloadErrorMessage}`)
+ getLogger().error(`CodeTransformation: ExportResultArchive error = %O`, e)
throw e
} finally {
cwStreamingClient.destroy()
@@ -795,7 +779,7 @@ export async function downloadAndExtractResultArchive(
zip.extractAllTo(pathToArchiveDir)
} catch (e) {
downloadErrorMessage = (e as Error).message
- getLogger().error(`CodeTransformation: ExportResultArchive error = ${downloadErrorMessage}`)
+ getLogger().error(`CodeTransformation: ExportResultArchive error = %O`, e)
throw new Error('Error downloading transformation result artifacts: ' + downloadErrorMessage)
}
}
From 928593c32b4b510b3faa94c0d462a5e12203e6d7 Mon Sep 17 00:00:00 2001
From: Hweinstock <42325418+Hweinstock@users.noreply.github.com>
Date: Fri, 7 Feb 2025 08:24:15 -0500
Subject: [PATCH 07/12] refactor(debounce): avoid reimplementations of the same
logic. (#6507)
## Problem
`debounce` is reimplemented in multiple places. There is `debounce`:
https://github.com/aws/aws-toolkit-vscode/blob/100eb0737789d9d5ba4b04e055730b467bd97e14/packages/core/src/shared/utilities/functionUtils.ts#L89-L108
`cancellableDebounce`:
https://github.com/aws/aws-toolkit-vscode/blob/100eb0737789d9d5ba4b04e055730b467bd97e14/packages/core/src/shared/utilities/functionUtils.ts#L114-L147
and a very similar function `keyedDebounce`:
https://github.com/aws/aws-toolkit-vscode/blob/100eb0737789d9d5ba4b04e055730b467bd97e14/packages/core/src/auth/auth.ts#L107-L122
These functions should share common implementation logic, and live in
the same place for easier discoverability.
## Solution
- reimplement `debounce` in terms of `cancellableDebounce` since its a
special case.
- move these functions to shared, common location.
- augment `debounce` to allow the callback to take arguments.
---
- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
---
packages/core/src/auth/auth.ts | 19 +-----
.../src/shared/utilities/functionUtils.ts | 65 +++++++++++--------
2 files changed, 39 insertions(+), 45 deletions(-)
diff --git a/packages/core/src/auth/auth.ts b/packages/core/src/auth/auth.ts
index bfe2090268f..fba0c80e261 100644
--- a/packages/core/src/auth/auth.ts
+++ b/packages/core/src/auth/auth.ts
@@ -21,7 +21,7 @@ import { SsoClient } from './sso/clients'
import { getLogger } from '../shared/logger'
import { CredentialsProviderManager } from './providers/credentialsProviderManager'
import { asString, CredentialsId, CredentialsProvider, fromString } from './providers/credentials'
-import { once } from '../shared/utilities/functionUtils'
+import { keyedDebounce, once } from '../shared/utilities/functionUtils'
import { CredentialsSettings } from './credentials/utils'
import {
extractDataFromSection,
@@ -104,23 +104,6 @@ interface AuthService {
updateConnection(connection: Pick, profile: Profile): Promise
}
-function keyedDebounce(
- fn: (key: K, ...args: U) => Promise
-): typeof fn {
- const pending = new Map>()
-
- return (key, ...args) => {
- if (pending.has(key)) {
- return pending.get(key)!
- }
-
- const promise = fn(key, ...args).finally(() => pending.delete(key))
- pending.set(key, promise)
-
- return promise
- }
-}
-
export interface ConnectionStateChangeEvent {
readonly id: Connection['id']
readonly state: ProfileMetadata['connectionState']
diff --git a/packages/core/src/shared/utilities/functionUtils.ts b/packages/core/src/shared/utilities/functionUtils.ts
index d21727bac1d..3bcb87730fa 100644
--- a/packages/core/src/shared/utilities/functionUtils.ts
+++ b/packages/core/src/shared/utilities/functionUtils.ts
@@ -85,38 +85,28 @@ export function memoize(fn: (...args: U) => T): (...args: U)
* Multiple calls made during the debounce window will receive references to the
* same Promise similar to {@link shared}. The window will also be 'rolled', delaying
* the execution by another {@link delay} milliseconds.
+ *
+ * This function prevents execution until {@link delay} milliseconds have passed
+ * since the last invocation regardless of arguments. If this should be
+ * argument dependent, look into {@link keyedDebounce}
*/
-export function debounce(cb: () => T | Promise, delay: number = 0): () => Promise {
- let timeout: Timeout | undefined
- let promise: Promise | undefined
-
- return () => {
- timeout?.refresh()
-
- return (promise ??= new Promise((resolve, reject) => {
- timeout = new Timeout(delay)
- timeout.onCompletion(async () => {
- timeout = promise = undefined
- try {
- resolve(await cb())
- } catch (err) {
- reject(err)
- }
- })
- }))
- }
+export function debounce(
+ cb: (...args: Input) => Output | Promise