Skip to content
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

fix(amazonq): ensure summary.md + icons saved, populate job history sooner, fix minor styling issues #4928

Merged
merged 8 commits into from
May 6, 2024

Conversation

dhasani23
Copy link
Contributor

Problem

Several minor issues from GA launch: summary.md + icons not actually being saved when users accept changes, job history info not shown until the job terminates, and issues with white text / blue highlighting / grey text in transformation plan not visible with certain background colors.

Solution

Since the summary.md and icons are in their own new directories, ensure those are created before saving the files. Populate the job history tab once job ID is available and allow users to switch back and forth between plan progress and job history throughout the transformation. Use default text color which will adjust by background, make blue highlighting look better for dark backgrounds, use a lighter grey font color.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@dhasani23 dhasani23 requested review from a team as code owners May 3, 2024 18:31
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The author of this PR: #4914
was unable to test his work, so putting that work here.

@@ -28,7 +28,7 @@ export class TabDataGenerator {
['unknown', 'Ask a question or enter "/" for quick actions'],
['cwc', 'Ask a question or enter "/" for quick actions'],
['featuredev', 'Briefly describe a task or issue'],
['gumby', 'Chat is disabled during Code Transformation.'],
['gumby', 'Open a new tab to chat with Q'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exact text was approved by our technical writer.

@@ -8,7 +8,6 @@ import { randomUUID } from '../../common/crypto'
interface ICodeTransformTelemetryState {
sessionId: string
sessionStartTime: number
resultStatus: string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant; we already store job status.

return getIcon('vscode-play')
default:
return getIcon('vscode-stop-circle')
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both of these above were unused.

@@ -0,0 +1,105 @@
@keyframes spin {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The author of this PR (#4914) was unable to test it so adding his work here.

@@ -56,6 +56,18 @@ export function throwIfCancelled() {
}
}

export async function updateJobHistory() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this function async?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this one has no need to be, can change it back.

@@ -210,7 +214,6 @@ export async function startTransformationJob(uploadId: string) {
}
throw new Error('Start job failed')
}
transformByQState.setJobId(encodeHTML(jobId))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove jobId from transform state? This can cause some metrics to miss jobId?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I didn't remove, I just moved it to happen sooner. I set the jobId right after the upload completes so that it is populated in the job history tab sooner.

transformByQState.resetPlanSteps()
transformByQState.resetSessionJobHistory()
transformByQState.setJobId('') // so that details for last job are not overwritten when running one job after another
Copy link
Contributor

@tincheng tincheng May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose (or the comment) of not overwritten the last job's ID was not very clear to me, since a back-to-back job should ideally be persisting the context for the new job? Shouldn't JobId here already persist the new Job's ID (followup question to the above for removing setJobId() )

Copy link
Contributor Author

@dhasani23 dhasani23 May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sessionJobHistory maps jobIds to details about the job, and in the beginning of a 2nd job, if the previous job's ID is not cleared, the updateHistory function running on an interval could put that ID back in the map, but this time with outdated/inaccurate info (info from the current job).

Comment on lines +414 to +415
transformByQState.setToCancelled()
transformByQState.setPolledJobStatus('CANCELLED')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need both?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in the job history panel we display the polledJobStatus so need this set too for the text/display purposes.

@@ -226,8 +226,12 @@ export async function pollTransformationStatusUntilPlanReady(jobId: string) {
await pollTransformationJob(jobId, CodeWhispererConstants.validStatesForPlanGenerated)
} catch (error) {
getLogger().error(`CodeTransformation: ${CodeWhispererConstants.failedToCompleteJobNotification}`, error)
transformByQState.setJobFailureErrorNotification(CodeWhispererConstants.failedToCompleteJobNotification)
transformByQState.setJobFailureErrorChatMessage(CodeWhispererConstants.failedToCompleteJobChatMessage)
if (!transformByQState.getJobFailureErrorNotification()) {
Copy link
Contributor Author

@dhasani23 dhasani23 May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To prevent the error notification / chat message from being overwritten if they were already set by our pollTransformationJob function -- pollTransformationJob will set these if our backend returns a specific error reason, in which case we want to show that to user, not these generic messages.

@nkomonen-amazon nkomonen-amazon merged commit e5f26e4 into aws:master May 6, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants