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

feat(amazonq): UTG build and execute for internal users. #5436

Open
wants to merge 29 commits into
base: feature/build-execute
Choose a base branch
from

Conversation

laileni-aws
Copy link
Contributor

@laileni-aws laileni-aws commented Mar 4, 2025

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

This PR is an extension implementation for this #5396.
This PR introduces a build-exec loop for internal Amazon users, allowing them to run a customized build command after Amazon Q generates unit tests. The goal is to ensure that the newly generated unit tests do not break the initial build.

Solution

Adding back build and execute logic for internal amazon users to fix the errors when generating unit tests. Allow users to run 3 iterations to fix the codes if there are any issues cause build failure.
Screenshot 2025-02-19 at 6 25 52 PM

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

jobId = session.testGenerationJob,
result = if (e.message == message("testgen.message.cancelled")) MetricResult.Cancelled else MetricResult.Failed,
reason = (e as CodeTestException).code ?: "DefaultError",
reasonDesc = if (e.message == message("testgen.message.cancelled")) "${e.code}: ${e.message}" else e.message,

Check warning

Code scanning / QDJVMC

Usage of redundant or deprecated syntax or deprecated symbols Warning

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
@laileni-aws
Copy link
Contributor Author

/retryBuilds

@laileni-aws laileni-aws changed the title Draft[PR]: UTG build and execute feat(amazonq): UTG build and execute for internal users. Mar 7, 2025
@laileni-aws laileni-aws marked this pull request as ready for review March 7, 2025 18:56
@laileni-aws laileni-aws requested review from a team as code owners March 7, 2025 18:56
session.charsOfCodeGenerated,
session.charsOfCodeGenerated

UiTelemetry.click(

Check warning

Code scanning / QDJVMC

Usage of redundant or deprecated syntax or deprecated symbols Warning

'UiTelemetry' is deprecated. Use type-safe metric builders
@@ -740,10 +748,11 @@
)
codeTestChatHelper.updateUI(
promptInputDisabledState = true,
promptInputPlaceholder = message("testgen.placeholder.select_an_action_to_proceed"),

Check warning

Code scanning / QDJVMC

Usage of redundant or deprecated syntax or deprecated symbols Warning

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
)
delay(1000)
codeTestChatHelper.sendUpdatePromptProgress(session.tabId, null)
AmazonqTelemetry.unitTestGeneration(

Check warning

Code scanning / QDJVMC

Usage of redundant or deprecated syntax or deprecated symbols Warning

'AmazonqTelemetry' is deprecated. Use type-safe metric builders
return
}
"stop_test_gen_build_and_execution" -> {
UiTelemetry.click(context.project, "unitTestGeneration_cancelBuildProgress")

Check warning

Code scanning / QDJVMC

Usage of redundant or deprecated syntax or deprecated symbols Warning

'UiTelemetry' is deprecated. Use type-safe metric builders
UiTelemetry.click(context.project, "unitTestGeneration_cancelBuildProgress")
session.buildStatus = BuildStatus.CANCELLED
session.isGeneratingTests = false
AmazonqTelemetry.unitTestGeneration(

Check warning

Code scanning / QDJVMC

Usage of redundant or deprecated syntax or deprecated symbols Warning

'AmazonqTelemetry' is deprecated. Use type-safe metric builders
delay(1000)
codeTestChatHelper.addAnswer(
CodeTestChatMessageContent(
message = message("testgen.message.cancelled"),

Check warning

Code scanning / QDJVMC

Usage of redundant or deprecated syntax or deprecated symbols Warning

'message(String, vararg Any): String' is deprecated. Use extension-specific localization bundle instead
}
// TODO: Commenting out this code to do a better UX in the V2 version after science support
Copy link
Contributor

Choose a reason for hiding this comment

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

Leaving a TODO message makes sense but don't include the commented out code block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed comment!

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.

3 participants