-
Notifications
You must be signed in to change notification settings - Fork 243
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
refactor(amazonq): refactor, remove shortAnswer to suit the API changes, display the plan summary to the customer #5453
base: main
Are you sure you want to change the base?
Conversation
.../src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt
Fixed
Show fixed
Hide fixed
.../src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt
Fixed
Show fixed
Hide fixed
.../src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt
Fixed
Show fixed
Hide fixed
.../src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt
Fixed
Show fixed
Hide fixed
...c/software/aws/toolkits/jetbrains/services/amazonqCodeTest/model/PackageAndTargetFileInfo.kt
Fixed
Show fixed
Hide fixed
.../src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt
Fixed
Show fixed
Hide fixed
.../src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt
Fixed
Show fixed
Hide fixed
83c52fc
to
e8cee82
Compare
} | ||
|
||
// TO DO | ||
// add TestGenerationJobStatus.STOPPED status | ||
|
||
// If job status is Failed and has no ShortAnswer then there might be some issue in the backend. |
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.
is this still true?
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.
no, i think that is no in to-do any more
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.
Yeah we can remove this comment
@@ -0,0 +1,4 @@ | |||
{ |
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.
We don't need change log for this IMO.
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.
Better to add change log for Plan summary
footer = listOf(testFileName) | ||
), | ||
messageIdOverride = codeTestResponseContext.testSummaryMessageId | ||
var packageInfoList = testGenerationResponse.testGenerationJob().packageInfoList() |
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.
packageInfoList is declared at L176
throw CodeTestException("TestGenFailedError: ${shortAnswer.planSummary}", "TestGenFailedError", shortAnswer.planSummary) | ||
} | ||
|
||
val packageInfoList = testGenerationResponse.testGenerationJob().packageInfoList() |
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.
Why we are declaring this again? Any specific reason.
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.
previously the L176 declaration is not the correct one, will remove this in the new commit
} | ||
|
||
// TO DO |
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.
QQ: Do we have TestGenerationJobStatus.STOPPED field from backend?
if (shortAnswer.stopIteration == "true") { | ||
throw CodeTestException("TestGenFailedError: ${shortAnswer.planSummary}", "TestGenFailedError", shortAnswer.planSummary) | ||
if (previousIterationContext == null) { | ||
val packageInfoList = testGenerationResponse.testGenerationJob().packageInfoList() |
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.
Can we declare these variables globally to the function?
) | ||
} | ||
} catch (e: Exception) { | ||
LOG.debug("failed to process package info: ${e.message}") |
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.
This Log does not give good insight to the user and developer to debug.
.../src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt
Show resolved
Hide resolved
@@ -37,14 +37,18 @@ data class Session(val tabId: String) { | |||
// First iteration will have a value of 1 | |||
var iteration: Int = 0 | |||
var projectRoot: String = "/" | |||
var shortAnswer: ShortAnswer = ShortAnswer() | |||
|
|||
// var shortAnswer: ShortAnswer = ShortAnswer() |
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.
Remove commented code
7507e97
to
f1d44db
Compare
} | ||
|
||
// polling every 2 seconds to reduce # of API calls |
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.
Can you include this comment
.../src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt
Show resolved
Hide resolved
var selectedFile: VirtualFile? = null | ||
var testFileRelativePathToProjectRoot: String = "" | ||
var testFileName: String = "" | ||
var viewDiffMessageId: String? = null | ||
var openedDiffFile: VirtualFile? = null | ||
val generatedTestDiffs = mutableMapOf<String, String>() | ||
var codeReferences: List<ShortAnswerReference>? = null | ||
|
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.
unnecessary line
.replace(Regex("\\s*```$"), "") // Remove trailing triple backticks | ||
.trim() | ||
|
||
val fullMessage = """ |
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.
Rename fullMessage
to summary or something relevant.
9a03a36
to
3480d4c
Compare
.../src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt
Fixed
Show fixed
Hide fixed
.../src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt
Fixed
Show resolved
Hide resolved
.../src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt
Fixed
Show fixed
Hide fixed
.../src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/CodeWhispererUTGChatManager.kt
Fixed
Show fixed
Hide fixed
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.
can we figure out why this keeps happening?
@@ -0,0 +1,4 @@ | |||
{ | |||
"type" : "feature", | |||
"description" : "display plan summary to customer" |
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.
changelogs do not meet bar for what will be shown to customer
@@ -0,0 +1,4 @@ | |||
{ | |||
"type" : "feature", | |||
"description" : "Amazonq /test now display the plan summary to customer" |
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.
AmazonQ /test now displays a concise test plan summary to users.
14cd758
to
c01a48d
Compare
c904a51
to
650c45f
Compare
2e82a65
to
465676f
Compare
Problem
Before re:Invent, we used shortAnswer to pass data such as the test file path. However, this approach is unreliable in a long term. To improve stability, we decided to refactor the backend API by replacing shortAnswer with packageInfo and targetFileInfo. These new fields will now carry the values previously stored in shortAnswer, ensuring a more structured and reliable data transfer mechanism.
Solution
Remove the shortAnswer and replace it with packageInfo and targetFileInfo.
To-Do
Checklist
License
I confirm that my contribution is made under the terms of the Apache 2.0 license.