Skip to content

Commit 327c891

Browse files
committed
remove short circuiting steps
1 parent 62691f9 commit 327c891

File tree

3 files changed

+40
-34
lines changed

3 files changed

+40
-34
lines changed

packages/core/src/amazonqGumby/chat/controller/controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { featureName } from '../../models/constants'
1717
import { AuthUtil } from '../../../codewhisperer/util/authUtil'
1818
import {
1919
cleanupTransformationJob,
20-
// compileProject,
20+
compileProject,
2121
finishHumanInTheLoop,
2222
getValidLanguageUpgradeCandidateProjects,
2323
postTransformationJob,
@@ -534,7 +534,7 @@ export class GumbyController {
534534
try {
535535
this.sessionStorage.getSession().conversationState = ConversationState.COMPILING
536536
this.messenger.sendCompilationInProgress(message.tabID)
537-
// await compileProject()
537+
await compileProject()
538538
} catch (err: any) {
539539
this.messenger.sendUnrecoverableErrorResponse('could-not-compile-project', message.tabID)
540540
// reset state to allow "Start a new transformation" button to work

packages/core/src/codewhisperer/commands/startTransformByQ.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ import { dependencyNoAvailableVersions } from '../../amazonqGumby/models/constan
7676
import { HumanInTheLoopManager } from '../service/transformByQ/humanInTheLoopManager'
7777
import { setContext } from '../../shared/vscode/setContext'
7878
import { makeTemporaryToolkitFolder } from '../../shared'
79-
// import globals from '../../shared/extensionGlobals'
79+
import globals from '../../shared/extensionGlobals'
8080
import { convertDateToTimestamp } from '../../shared/datetime'
8181
import { findStringInDirectory } from '../../shared/utilities/workspaceUtils'
8282

@@ -164,24 +164,24 @@ export function startInterval() {
164164

165165
export async function startTransformByQ() {
166166
// Set the default state variables for our store and the UI
167-
// const transformStartTime = globals.clock.Date.now()
167+
const transformStartTime = globals.clock.Date.now()
168168
await setTransformationToRunningState()
169169

170170
try {
171171
// Set webview UI to poll for progress
172172
startInterval()
173173

174174
// step 1: CreateUploadUrl and upload code
175-
// const uploadId = await preTransformationUploadCode()
175+
const uploadId = await preTransformationUploadCode()
176176

177177
// step 2: StartJob and store the returned jobId in TransformByQState
178-
// const jobId = await startTransformationJob(uploadId, transformStartTime)
178+
const jobId = await startTransformationJob(uploadId, transformStartTime)
179179

180180
// step 3 (intermediate step): show transformation-plan.md file
181-
// await pollTransformationStatusUntilPlanReady(jobId)
181+
await pollTransformationStatusUntilPlanReady(jobId)
182182

183183
// step 4: poll until artifacts are ready to download
184-
await humanInTheLoopRetryLogic('jobId')
184+
await humanInTheLoopRetryLogic(jobId)
185185
} catch (error: any) {
186186
await transformationJobErrorHandler(error)
187187
} finally {
@@ -200,8 +200,7 @@ export async function startTransformByQ() {
200200
export async function humanInTheLoopRetryLogic(jobId: string) {
201201
let status = ''
202202
try {
203-
// status = await pollTransformationStatusUntilComplete(jobId)
204-
status = 'COMPLETED'
203+
status = await pollTransformationStatusUntilComplete(jobId)
205204
if (status === 'PAUSED') {
206205
const hilStatusFailure = await initiateHumanInTheLoopPrompt(jobId)
207206
if (hilStatusFailure) {

packages/core/src/codewhisperer/service/transformByQ/transformationResultsViewProvider.ts

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
// import AdmZip from 'adm-zip'
6+
import AdmZip from 'adm-zip'
77
import os from 'os'
88
import fs from 'fs' // eslint-disable-line no-restricted-imports
99
import { parsePatch, applyPatches, ParsedDiff } from 'diff'
1010
import path from 'path'
1111
import vscode from 'vscode'
12-
// import { ExportIntent } from '@amzn/codewhisperer-streaming'
12+
import { ExportIntent } from '@amzn/codewhisperer-streaming'
1313
import {
1414
TransformByQReviewStatus,
1515
transformByQState,
1616
PatchInfo,
1717
DescriptionContent,
1818
TransformationType,
1919
} from '../../models/model'
20-
import { ExportResultArchiveStructure } from '../../../shared/utilities/download'
20+
import { ExportResultArchiveStructure, downloadExportResultArchive } from '../../../shared/utilities/download'
2121
import { getLogger } from '../../../shared/logger'
2222
import { telemetry } from '../../../shared/telemetry/telemetry'
2323
import { CodeTransformTelemetryState } from '../../../amazonqGumby/telemetry/codeTransformTelemetryState'
2424
import { MetadataResult } from '../../../shared/telemetry/telemetryClient'
2525
import * as CodeWhispererConstants from '../../models/constants'
26-
// import { createCodeWhispererChatStreamingClient } from '../../../shared/clients/codewhispererChatClient'
26+
import { createCodeWhispererChatStreamingClient } from '../../../shared/clients/codewhispererChatClient'
2727
import { ChatSessionManager } from '../../../amazonqGumby/chat/storages/chatSession'
2828
import { setContext } from '../../../shared/vscode/setContext'
2929
import * as codeWhisperer from '../../client/codewhisperer'
@@ -325,7 +325,11 @@ export class ProposedTransformationExplorer {
325325
treeDataProvider: transformDataProvider,
326326
})
327327

328+
<<<<<<< HEAD
328329
let patchFiles: string[] = []
330+
=======
331+
const patchFiles: string[] = []
332+
>>>>>>> d92cadc19 (remove short circuiting steps)
329333
let singlePatchFile: string = ''
330334
let patchFilesDescriptions: DescriptionContent | undefined = undefined
331335

@@ -377,15 +381,15 @@ export class ProposedTransformationExplorer {
377381
vscode.commands.registerCommand('aws.amazonq.transformationHub.reviewChanges.startReview', async () => {
378382
await setContext('gumby.reviewState', TransformByQReviewStatus.PreparingReview)
379383

380-
// const pathToArchive = path.join(
381-
// ProposedTransformationExplorer.TmpDir,
382-
// transformByQState.getJobId(),
383-
// 'ExportResultsArchive.zip'
384-
// )
385-
const exportResultsArchiveSize = 0
384+
const pathToArchive = path.join(
385+
ProposedTransformationExplorer.TmpDir,
386+
transformByQState.getJobId(),
387+
'ExportResultsArchive.zip'
388+
)
389+
let exportResultsArchiveSize = 0
386390
let downloadErrorMessage = undefined
387391

388-
// const cwStreamingClient = await createCodeWhispererChatStreamingClient()
392+
const cwStreamingClient = await createCodeWhispererChatStreamingClient()
389393
try {
390394
await telemetry.codeTransform_downloadArtifact.run(async () => {
391395
telemetry.record({
@@ -394,17 +398,17 @@ export class ProposedTransformationExplorer {
394398
codeTransformJobId: transformByQState.getJobId(),
395399
})
396400

397-
// await downloadExportResultArchive(
398-
// cwStreamingClient,
399-
// {
400-
// exportId: transformByQState.getJobId(),
401-
// exportIntent: ExportIntent.TRANSFORMATION,
402-
// },
403-
// pathToArchive
404-
// )
401+
await downloadExportResultArchive(
402+
cwStreamingClient,
403+
{
404+
exportId: transformByQState.getJobId(),
405+
exportIntent: ExportIntent.TRANSFORMATION,
406+
},
407+
pathToArchive
408+
)
405409

406410
// Update downloaded artifact size
407-
// exportResultsArchiveSize = (await fs.promises.stat(pathToArchive)).size
411+
exportResultsArchiveSize = (await fs.promises.stat(pathToArchive)).size
408412

409413
telemetry.record({ codeTransformTotalByteSize: exportResultsArchiveSize })
410414
})
@@ -425,17 +429,20 @@ export class ProposedTransformationExplorer {
425429
getLogger().error(`CodeTransformation: ExportResultArchive error = ${downloadErrorMessage}`)
426430
throw new Error('Error downloading diff')
427431
} finally {
428-
// cwStreamingClient.destroy()
432+
cwStreamingClient.destroy()
429433
}
430434

431435
let deserializeErrorMessage = undefined
432436
let pathContainingArchive = ''
437+
<<<<<<< HEAD
433438
patchFiles = [] // reset patchFiles if there was a previous transformation
439+
=======
440+
>>>>>>> d92cadc19 (remove short circuiting steps)
434441
try {
435442
// Download and deserialize the zip
436-
// pathContainingArchive = path.dirname(pathToArchive)
437-
// const zip = new AdmZip(pathToArchive)
438-
// zip.extractAllTo(pathContainingArchive)
443+
pathContainingArchive = path.dirname(pathToArchive)
444+
const zip = new AdmZip(pathToArchive)
445+
zip.extractAllTo(pathContainingArchive)
439446
const files = fs.readdirSync(path.join(pathContainingArchive, ExportResultArchiveStructure.PathToPatch))
440447
if (files.length === 1) {
441448
singlePatchFile = path.join(

0 commit comments

Comments
 (0)