-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(amazon q): display multiple diff patches #5812
Merged
nkomonen-amazon
merged 22 commits into
aws:master
from
ntarakad-aws:selective_transform
Nov 20, 2024
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f04eb9c
adding functionality to allow jdk17 as source and display multiple gi…
ntarakad-aws 598ce08
addressing comments to add to models and minor edits
ntarakad-aws 6481abc
editing the clear changes and updating test file
ntarakad-aws 631d3f7
editing test file to use models patchinfo
ntarakad-aws 5343877
fixing package files that we don't want in commit
ntarakad-aws 6cd90c2
added test cases for new parseDiff logic
ntarakad-aws 693d4be
removing redundant unit test
ntarakad-aws f55cd36
updated tests to account for no diff.json and performed e2e transform…
ntarakad-aws fb3436f
added numbering to make it obvious to user which patch file they're v…
ntarakad-aws bd8f324
updated json structure based on backend and now collecting patchfiles…
ntarakad-aws 1f38262
adding additional transformationFinished parameter
ntarakad-aws d4ef664
added patch description chat message and working on user input for on…
ntarakad-aws 88bba94
added form to select one or multiple diffs and dynamically add to man…
ntarakad-aws 5192262
fixing java 11 messaging
ntarakad-aws d9ac6eb
removed redudnant check for one or multiple diffs when accepting changes
ntarakad-aws c509beb
fixing tests and endpoint
ntarakad-aws e63ab97
addressing minor comments and fixing chat messaging
ntarakad-aws adda8af
fixing tests and addressing comments to remove redundancy
ntarakad-aws 9342606
updating test import and adding changelog
ntarakad-aws 7b85bfb
addressing comments from PR and adding feature flag
ntarakad-aws 7a0f743
fixing failed unit tests
ntarakad-aws d6c2229
updated test file
ntarakad-aws File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
packages/amazonq/test/unit/amazonqGumby/resources/files/diff.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"content": [ | ||
{ | ||
"name": "Added file", | ||
"fileName": "resources/files/addedFile.diff", | ||
"isSuccessful": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ import { getStringHash } from '../../../shared/utilities/textUtilities' | |
import { getVersionData } from '../../../codewhisperer/service/transformByQ/transformMavenHandler' | ||
import AdmZip from 'adm-zip' | ||
import { AuthError } from '../../../auth/sso/server' | ||
import { isSelectiveTransformationReady } from '../../../dev/config' | ||
|
||
// These events can be interactions within the chat, | ||
// or elsewhere in the IDE | ||
|
@@ -358,6 +359,7 @@ export class GumbyController { | |
this.transformationFinished({ | ||
message: CodeWhispererConstants.jobCancelledChatMessage, | ||
tabID: message.tabID, | ||
includeStartNewTransformationButton: true, | ||
}) | ||
break | ||
case ButtonActions.CONFIRM_SKIP_TESTS_FORM: | ||
|
@@ -366,6 +368,12 @@ export class GumbyController { | |
case ButtonActions.CANCEL_SKIP_TESTS_FORM: | ||
this.messenger.sendJobFinishedMessage(message.tabID, CodeWhispererConstants.jobCancelledChatMessage) | ||
break | ||
case ButtonActions.CONFIRM_SELECTIVE_TRANSFORMATION_FORM: | ||
await this.handleOneOrMultipleDiffs(message) | ||
break | ||
case ButtonActions.CANCEL_SELECTIVE_TRANSFORMATION_FORM: | ||
this.messenger.sendJobFinishedMessage(message.tabID, CodeWhispererConstants.jobCancelledChatMessage) | ||
break | ||
case ButtonActions.CONFIRM_SQL_CONVERSION_TRANSFORMATION_FORM: | ||
await this.handleUserSQLConversionProjectSelection(message) | ||
break | ||
|
@@ -416,6 +424,20 @@ export class GumbyController { | |
result: MetadataResult.Pass, | ||
}) | ||
this.messenger.sendSkipTestsSelectionMessage(skipTestsSelection, message.tabID) | ||
if (!isSelectiveTransformationReady) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: this is just a feature flag, waiting for our backend work to be ready, will merge with this flag until then |
||
// perform local build | ||
await this.validateBuildWithPromptOnError(message) | ||
} else { | ||
await this.messenger.sendOneOrMultipleDiffsPrompt(message.tabID) | ||
} | ||
} | ||
|
||
private async handleOneOrMultipleDiffs(message: any) { | ||
const oneOrMultipleDiffsSelection = message.formSelectedValues['GumbyTransformOneOrMultipleDiffsForm'] | ||
if (oneOrMultipleDiffsSelection === CodeWhispererConstants.multipleDiffsMessage) { | ||
transformByQState.setMultipleDiffs(true) | ||
} | ||
this.messenger.sendOneOrMultipleDiffsMessage(oneOrMultipleDiffsSelection, message.tabID) | ||
// perform local build | ||
await this.validateBuildWithPromptOnError(message) | ||
} | ||
|
@@ -452,7 +474,6 @@ export class GumbyController { | |
this.messenger.sendUnrecoverableErrorResponse('unsupported-source-jdk-version', message.tabID) | ||
return | ||
} | ||
|
||
await processLanguageUpgradeTransformFormInput(pathToProject, fromJDKVersion, toJDKVersion) | ||
await this.messenger.sendSkipTestsPrompt(message.tabID) | ||
}) | ||
|
@@ -563,6 +584,7 @@ export class GumbyController { | |
this.transformationFinished({ | ||
message: CodeWhispererConstants.jobCancelledChatMessage, | ||
tabID: message.tabID, | ||
includeStartNewTransformationButton: true, | ||
}) | ||
return | ||
} | ||
|
@@ -591,11 +613,15 @@ export class GumbyController { | |
) | ||
} | ||
|
||
private transformationFinished(data: { message: string | undefined; tabID: string }) { | ||
private transformationFinished(data: { | ||
message: string | undefined | ||
tabID: string | ||
includeStartNewTransformationButton: boolean | ||
}) { | ||
this.resetTransformationChatFlow() | ||
// at this point job is either completed, partially_completed, cancelled, or failed | ||
if (data.message) { | ||
this.messenger.sendJobFinishedMessage(data.tabID, data.message) | ||
this.messenger.sendJobFinishedMessage(data.tabID, data.message, data.includeStartNewTransformationButton) | ||
} | ||
} | ||
|
||
|
@@ -701,7 +727,11 @@ export class GumbyController { | |
try { | ||
await finishHumanInTheLoop() | ||
} catch (err: any) { | ||
this.transformationFinished({ tabID: message.tabID, message: (err as Error).message }) | ||
this.transformationFinished({ | ||
tabID: message.tabID, | ||
message: (err as Error).message, | ||
includeStartNewTransformationButton: true, | ||
}) | ||
} | ||
|
||
this.messenger.sendStaticTextResponse('end-HIL-early', message.tabID) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our CI caught this block being duplicated, consider making a function like
makeReadme()
. This will not block the PR