Skip to content

Commit 5e2331d

Browse files
committed
Merge branch 'master' into removeFsExtra2
2 parents 5d6b5f7 + 1205101 commit 5e2331d

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

packages/core/src/amazonqFeatureDev/client/featureDev.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,17 @@ import { createCodeWhispererChatStreamingClient } from '../../shared/clients/cod
2626
import { getClientId, getOptOutPreference, getOperatingSystem } from '../../shared/telemetry/util'
2727
import { extensionVersion } from '../../shared/vscode/env'
2828

29+
// Re-enable once BE is able to handle retries.
30+
const writeAPIRetryOptions = {
31+
maxRetries: 0,
32+
retryDelayOptions: {
33+
// The default number of milliseconds to use in the exponential backoff
34+
base: 500,
35+
},
36+
}
37+
2938
// Create a client for featureDev proxy client based off of aws sdk v2
30-
export async function createFeatureDevProxyClient(): Promise<FeatureDevProxyClient> {
39+
export async function createFeatureDevProxyClient(options?: Partial<ServiceOptions>): Promise<FeatureDevProxyClient> {
3140
const bearerToken = await AuthUtil.instance.getBearerToken()
3241
const cwsprConfig = getCodewhispererConfig()
3342
return (await globals.sdkClientBuilder.createAwsService(
@@ -37,27 +46,22 @@ export async function createFeatureDevProxyClient(): Promise<FeatureDevProxyClie
3746
region: cwsprConfig.region,
3847
endpoint: cwsprConfig.endpoint,
3948
token: new Token({ token: bearerToken }),
40-
// SETTING TO 0 FOR BETA. RE-ENABLE FOR RE-INVENT
41-
maxRetries: 0,
42-
retryDelayOptions: {
43-
// The default number of milliseconds to use in the exponential backoff
44-
base: 500,
45-
},
49+
...options,
4650
} as ServiceOptions,
4751
undefined
4852
)) as FeatureDevProxyClient
4953
}
5054

5155
export class FeatureDevClient {
52-
public async getClient() {
56+
public async getClient(options?: Partial<ServiceOptions>) {
5357
// Should not be stored for the whole session.
5458
// Client has to be reinitialized for each request so we always have a fresh bearerToken
55-
return await createFeatureDevProxyClient()
59+
return await createFeatureDevProxyClient(options)
5660
}
5761

5862
public async createConversation() {
5963
try {
60-
const client = await this.getClient()
64+
const client = await this.getClient(writeAPIRetryOptions)
6165
getLogger().debug(`Executing createTaskAssistConversation with {}`)
6266
const { conversationId, $response } = await client.createTaskAssistConversation().promise()
6367
getLogger().debug(`${featureName}: Created conversation: %O`, {
@@ -82,7 +86,7 @@ export class FeatureDevClient {
8286

8387
public async createUploadUrl(conversationId: string, contentChecksumSha256: string, contentLength: number) {
8488
try {
85-
const client = await this.getClient()
89+
const client = await this.getClient(writeAPIRetryOptions)
8690
const params = {
8791
uploadContext: {
8892
taskAssistPlanningUploadContext: {
@@ -119,7 +123,7 @@ export class FeatureDevClient {
119123

120124
public async startCodeGeneration(conversationId: string, uploadId: string, message: string) {
121125
try {
122-
const client = await this.getClient()
126+
const client = await this.getClient(writeAPIRetryOptions)
123127
const params = {
124128
conversationState: {
125129
conversationId,

packages/core/src/codewhisperer/tracker/codewhispererCodeCoverageTracker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export class CodeWhispererCodeCoverageTracker {
120120
}
121121
})
122122
}
123-
const percentCount = ((unmodifiedAcceptedTokens / totalTokens) * 100).toFixed(2)
123+
const percentCount = ((acceptedTokens / totalTokens) * 100).toFixed(2)
124124
const percentage = Math.round(parseInt(percentCount))
125125
const selectedCustomization = getSelectedCustomization()
126126
if (this._serviceInvocationCount <= 0) {

packages/core/src/test/awsService/accessanalyzer/iamPolicyChecks.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import * as iamPolicyChecks from '../../../awsService/accessanalyzer/vue/iamPoli
1919
import * as vscode from 'vscode'
2020
import { IamPolicyChecksConstants } from '../../../awsService/accessanalyzer/vue/constants'
2121
import { FileSystem } from '../../../shared/fs/fs'
22+
import path from 'path'
2223

2324
const defaultTerraformConfigPath = 'resources/policychecks-tf-default.yaml'
2425
let sandbox: sinon.SinonSandbox
@@ -29,7 +30,10 @@ describe('iamPolicyChecks', function () {
2930
it('IamPolicyChecksWebview built .vue source file path exists', async function () {
3031
assert.ok(
3132
await vscodeFs.existsFile(
32-
globals.context.asAbsolutePath(`src/awsService/accessanalyzer/vue/iamPolicyChecks.vue`)
33+
path.join(
34+
path.dirname(globals.context.extensionPath),
35+
`core/src/awsService/accessanalyzer/vue/iamPolicyChecks.vue`
36+
)
3337
)
3438
)
3539
})

0 commit comments

Comments
 (0)