Skip to content

Commit 68c2f16

Browse files
author
David Hasani
committed
add check for empty diff
1 parent 71cca19 commit 68c2f16

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ export async function postTransformationJob() {
684684
codeTransformJobId: transformByQState.getJobId(),
685685
codeTransformResultStatusMessage: resultStatusMessage,
686686
codeTransformRunTimeLatency: durationInMs,
687+
reason: transformByQState.getPolledJobStatus(),
687688
result:
688689
transformByQState.isSucceeded() || transformByQState.isPartiallySucceeded()
689690
? MetadataResult.Pass

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ export const receivedValidConfigFileMessage =
653653
'The dependency upgrade file looks good. I will use this information to upgrade the dependencies you specified.'
654654

655655
export const chooseConfigFileMessage =
656-
'Would you like to provide a dependency upgrade file? You can specify first and third party dependencies and their versions in a YAML or JSON file, and I will upgrade them during the transformation. For an example dependency upgrade file, see the [documentation](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/code-transformation.html#dependency-upgrade-file).'
656+
'Would you like to provide a dependency upgrade file? You can specify first and third party dependencies and their versions in a YAML file, and I will upgrade them during the transformation. For an example dependency upgrade file, see the [documentation](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/code-transformation.html#dependency-upgrade-file).'
657657

658658
export const enterJavaHomePlaceholder = 'Enter the path to your Java installation'
659659

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,12 @@ export class ZipManifest {
675675
version: string = '1.0'
676676
hilCapabilities: string[] = ['HIL_1pDependency_VersionUpgrade']
677677
// TO-DO: add something like AGENTIC_PLAN_V1 here when BE allowlists everyone
678+
// TO-DO: is SELECTIVE_TRANSFORMATION_V2 needed here?
678679
transformCapabilities: string[] = ['EXPLAINABILITY_V1', 'CLIENT_SIDE_BUILD']
679680
dependencyUpgradeConfigFile?: string = undefined
681+
// TODO: make sure the below 2 keys don't mess up SQL conversions when present
682+
noInteractiveMode: boolean = true
683+
compilationsJsonFile: string = 'compilations.json'
680684
customBuildCommand: string = 'clean test'
681685
requestedConversions?: {
682686
sqlConversion?: {

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,9 @@ export async function pollTransformationJob(jobId: string, validStates: string[]
696696
break
697697
}
698698

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*
699702
if (
700703
status === 'TRANSFORMING' &&
701704
transformByQState.getTransformationType() === TransformationType.LANGUAGE_UPGRADE
@@ -769,7 +772,13 @@ async function attemptLocalBuild() {
769772
getLogger().info(
770773
`CodeTransformation: downloaded clientInstructions with diff.patch at: ${clientInstructionsPath}`
771774
)
772-
await processClientInstructions(jobId, clientInstructionsPath, artifactId)
775+
const diffContents = await fs.readFileText(clientInstructionsPath)
776+
// make sure diff.patch is not empty
777+
if (diffContents.trim()) {
778+
await processClientInstructions(jobId, clientInstructionsPath, artifactId)
779+
} else {
780+
getLogger().info('CodeTransformation: diff.patch is empty, skipping client-side build for this iteration')
781+
}
773782
}
774783
}
775784

0 commit comments

Comments
 (0)