Skip to content

Commit 3dc1c35

Browse files
author
David Hasani
committed
poll for ACA properly
1 parent bf384c5 commit 3dc1c35

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ export async function setTransformationToRunningState() {
641641
transformByQState.resetSessionJobHistory()
642642
transformByQState.setJobId('') // so that details for last job are not overwritten when running one job after another
643643
transformByQState.setPolledJobStatus('') // so that previous job's status does not display at very beginning of this job
644+
transformByQState.setHasSeenTransforming(false)
644645

645646
CodeTransformTelemetryState.instance.setStartTime()
646647
transformByQState.setStartTime(

packages/core/src/codewhisperer/models/model.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,8 @@ export class TransformByQState {
776776

777777
private polledJobStatus: string = ''
778778

779+
private hasSeenTransforming: boolean = false
780+
779781
private payloadFilePath: string = ''
780782

781783
private jobFailureErrorNotification: string | undefined = undefined
@@ -823,6 +825,10 @@ export class TransformByQState {
823825
return this.transformByQState === TransformByQStatus.PartiallySucceeded
824826
}
825827

828+
public getHasSeenTransforming() {
829+
return this.hasSeenTransforming
830+
}
831+
826832
public getTransformationType() {
827833
return this.transformationType
828834
}
@@ -995,6 +1001,10 @@ export class TransformByQState {
9951001
this.transformByQState = TransformByQStatus.PartiallySucceeded
9961002
}
9971003

1004+
public setHasSeenTransforming(hasSeen: boolean) {
1005+
this.hasSeenTransforming = hasSeen
1006+
}
1007+
9981008
public setTransformationType(type: TransformationType) {
9991009
this.transformationType = type
10001010
}
@@ -1137,6 +1147,7 @@ export class TransformByQState {
11371147

11381148
public setJobDefaults() {
11391149
this.setToNotStarted()
1150+
this.hasSeenTransforming = false
11401151
this.jobFailureErrorNotification = undefined
11411152
this.jobFailureErrorChatMessage = undefined
11421153
this.payloadFilePath = ''

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,9 @@ export async function pollTransformationJob(jobId: string, validStates: string[]
654654
if (CodeWhispererConstants.validStatesForBuildSucceeded.includes(status)) {
655655
jobPlanProgress['buildCode'] = StepProgress.Succeeded
656656
}
657+
if (status === 'TRANSFORMING') {
658+
transformByQState.setHasSeenTransforming(true)
659+
}
657660
// emit metric when job status changes
658661
if (status !== transformByQState.getPolledJobStatus()) {
659662
telemetry.codeTransform_jobStatusChanged.emit({
@@ -696,11 +699,9 @@ export async function pollTransformationJob(jobId: string, validStates: string[]
696699
break
697700
}
698701

699-
// TO-DO: make sure we are not in AWAITING_CLIENT_ACTION while job is in PLANNING state
700-
// (that should only happen in interactive mode; IDE is always non-interactive)
701-
// otherwise below need to change *status === 'TRANSFORMING'* to *jobPlanProgress['generatePlan'] === StepProgress.Succeeded*
702+
// TO-DO: later, handle case where PlannerAgent needs to run mvn dependency:tree during PLANNING stage; not needed for now
702703
if (
703-
status === 'TRANSFORMING' &&
704+
transformByQState.getHasSeenTransforming() &&
704705
transformByQState.getTransformationType() === TransformationType.LANGUAGE_UPGRADE
705706
) {
706707
// client-side build is N/A for SQL conversions

0 commit comments

Comments
 (0)