Skip to content

Commit 5226db6

Browse files
authored
fix(amazonq): fix /transform test, remove feedback form aws#6903
## Problem We don't yet have legal approval to show users a feedback form. It is currently disabled / commented out, but better to remove the unused code until we get approval, since it may take a while and may not even happen. ## Solution Remove unused code and fix test.
1 parent 1b3681c commit 5226db6

File tree

4 files changed

+6
-113
lines changed

4 files changed

+6
-113
lines changed

packages/amazonq/test/e2e/amazonq/transformByQ.test.ts

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('Amazon Q Code Transformation', function () {
6565
})
6666

6767
describe('Starting a transformation from chat', () => {
68-
it.skip('Can click through all user input forms for a Java upgrade', async () => {
68+
it('Can click through all user input forms for a Java upgrade', async () => {
6969
sinon.stub(startTransformByQ, 'getValidSQLConversionCandidateProjects').resolves([])
7070
sinon.stub(GumbyController.prototype, 'validateLanguageUpgradeProjects' as keyof GumbyController).resolves([
7171
{
@@ -168,39 +168,18 @@ describe('Amazon Q Code Transformation', function () {
168168
.getChatMessenger()
169169
?.sendJobFinishedMessage(tab.tabID, CodeWhispererConstants.viewProposedChangesChatMessage)
170170

171-
// wait for download message and feedback form to be sent
172-
await tab.waitForEvent(() => tab.getChatItems().length > 15, {
173-
waitTimeoutInMs: 5000,
174-
waitIntervalInMs: 1000,
175-
})
176-
177-
const submitFeedbackForm = tab.getChatItems().pop()
178-
assert.strictEqual(submitFeedbackForm?.formItems?.[0]?.id ?? undefined, 'TransformFeedbackRerunJob')
179-
assert.strictEqual(submitFeedbackForm?.formItems?.[1]?.id ?? undefined, 'TransformFeedbackViewLogs')
180-
181-
const submitFeedbackFormItemValues = {
182-
TransformFeedbackRerunJob: 'No',
183-
TransformFeedbackViewLogs: 'Yes',
184-
}
185-
const submitFeedbackFormValues: Record<string, string> = { ...submitFeedbackFormItemValues }
186-
187-
const viewSummaryChatItem = tab.getChatItems()[tab.getChatItems().length - 2]
188-
assert.strictEqual(viewSummaryChatItem?.body?.includes('view a summary'), true)
189-
190171
tab.clickCustomFormButton({
191-
id: 'gumbyFeedbackFormConfirm',
192-
text: 'Confirm',
193-
formItemValues: submitFeedbackFormValues,
172+
id: 'gumbyViewSummary',
173+
text: 'View summary',
194174
})
195175

196-
// wait for feedback received message to be sent
197-
await tab.waitForEvent(() => tab.getChatItems().length > 16, {
176+
await tab.waitForEvent(() => tab.getChatItems().length > 14, {
198177
waitTimeoutInMs: 5000,
199178
waitIntervalInMs: 1000,
200179
})
201180

202-
const feedbackReceivedMessage = tab.getChatItems().pop()
203-
assert.strictEqual(feedbackReceivedMessage?.body?.includes('Feedback received') ?? undefined, true)
181+
const viewSummaryChatItem = tab.getChatItems().pop()
182+
assert.strictEqual(viewSummaryChatItem?.body?.includes('view a summary'), true)
204183
})
205184

206185
it('CANNOT do a Java 21 to Java 17 transformation', async () => {

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
validateCanCompileProject,
2929
getValidSQLConversionCandidateProjects,
3030
openHilPomFile,
31-
getFeedbackCommentData,
3231
} from '../../../codewhisperer/commands/startTransformByQ'
3332
import { JDKVersion, TransformationCandidateProject, transformByQState } from '../../../codewhisperer/models/model'
3433
import {
@@ -62,7 +61,6 @@ import {
6261
validateSQLMetadataFile,
6362
} from '../../../codewhisperer/service/transformByQ/transformFileHandler'
6463
import { getAuthType } from '../../../auth/utils'
65-
import globals from '../../../shared/extensionGlobals'
6664

6765
// These events can be interactions within the chat,
6866
// or elsewhere in the IDE
@@ -372,9 +370,6 @@ export class GumbyController {
372370
case ButtonActions.CONFIRM_SKIP_TESTS_FORM:
373371
await this.handleSkipTestsSelection(message)
374372
break
375-
case ButtonActions.CONFIRM_FEEDBACK_FORM:
376-
await this.handleFeedback(message)
377-
break
378373
case ButtonActions.CONFIRM_SELECTIVE_TRANSFORMATION_FORM:
379374
await this.handleOneOrMultipleDiffs(message)
380375
break
@@ -639,17 +634,6 @@ export class GumbyController {
639634
}
640635
}
641636

642-
private async handleFeedback(message: any) {
643-
const canRerunJob = message.formSelectedValues['TransformFeedbackRerunJob']
644-
const canViewLogs = message.formSelectedValues['TransformFeedbackViewLogs']
645-
const comment = `Permission to re-run job: ${canRerunJob}\nPermission to view logs: ${canViewLogs}\n${getFeedbackCommentData()}`
646-
this.messenger.sendFeedbackReceivedMessage(canRerunJob, canViewLogs, message.tabID)
647-
if (comment.toLowerCase().includes('yes')) {
648-
// post feedback if user says yes to at least one of the questions
649-
await globals.telemetry.postFeedback({ comment: comment, sentiment: 'Positive' })
650-
}
651-
}
652-
653637
private resetTransformationChatFlow() {
654638
this.sessionStorage.getSession().conversationState = ConversationState.IDLE
655639
}

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

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -542,15 +542,6 @@ export class Messenger {
542542
})
543543
}
544544

545-
if (
546-
transformByQState.isPartiallySucceeded() &&
547-
message === CodeWhispererConstants.viewProposedChangesChatMessage
548-
) {
549-
// get permission to re-run job and view logs after partially successful job is downloaded
550-
// TODO: uncomment this when feature is ready
551-
// this.sendFeedbackFormMessage(tabID)
552-
}
553-
554545
this.dispatcher.sendChatMessage(
555546
new ChatMessage(
556547
{
@@ -808,64 +799,4 @@ ${codeSnippet}
808799
)
809800
)
810801
}
811-
812-
public sendFeedbackFormMessage(tabID: string) {
813-
const formItems: ChatItemFormItem[] = []
814-
formItems.push({
815-
id: 'TransformFeedbackRerunJob',
816-
type: 'radiogroup',
817-
title: 'To improve our service, do we have permission to re-run your job? (you will *not* be charged)',
818-
mandatory: true,
819-
options: [
820-
{
821-
value: 'Yes',
822-
label: 'Yes',
823-
},
824-
{
825-
value: 'No',
826-
label: 'No',
827-
},
828-
],
829-
})
830-
831-
formItems.push({
832-
id: 'TransformFeedbackViewLogs',
833-
type: 'radiogroup',
834-
title: 'Do we also have permission to view the logs associated with your job?',
835-
mandatory: true,
836-
options: [
837-
{
838-
value: 'Yes',
839-
label: 'Yes',
840-
},
841-
{
842-
value: 'No',
843-
label: 'No',
844-
},
845-
],
846-
})
847-
848-
this.dispatcher.sendChatPrompt(
849-
new ChatPrompt(
850-
{
851-
message: 'Amazon Q Permissions Form',
852-
formItems: formItems,
853-
},
854-
'FeedbackForm',
855-
tabID,
856-
false
857-
)
858-
)
859-
}
860-
861-
public sendFeedbackReceivedMessage(canRerunJob: string, canViewLogs: string, tabID: string) {
862-
const message = `### Response received
863-
-------------
864-
| | |
865-
| :------------------- | -------: |
866-
| **Permission to re-run job** | ${canRerunJob} |
867-
| **Permission to view logs** | ${canViewLogs} |
868-
`
869-
this.dispatcher.sendChatMessage(new ChatMessage({ message, messageType: 'prompt' }, tabID))
870-
}
871802
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export enum ButtonActions {
1818
CONFIRM_SQL_CONVERSION_TRANSFORMATION_FORM = 'gumbySQLConversionTransformFormConfirm',
1919
CANCEL_TRANSFORMATION_FORM = 'gumbyTransformFormCancel', // shared between Language Upgrade & SQL Conversion
2020
CONFIRM_SKIP_TESTS_FORM = 'gumbyTransformSkipTestsFormConfirm',
21-
CONFIRM_FEEDBACK_FORM = 'gumbyFeedbackFormConfirm',
2221
CONFIRM_SELECTIVE_TRANSFORMATION_FORM = 'gumbyTransformOneOrMultipleDiffsFormConfirm',
2322
SELECT_SQL_CONVERSION_METADATA_FILE = 'gumbySQLConversionMetadataTransformFormConfirm',
2423
CONFIRM_DEPENDENCY_FORM = 'gumbyTransformDependencyFormConfirm',

0 commit comments

Comments
 (0)