Skip to content

fix(amazonq): auto scan use unsaved content #4527

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

Merged
merged 18 commits into from
Jun 6, 2024

Conversation

ctlai95
Copy link
Contributor

@ctlai95 ctlai95 commented May 29, 2024

Types of changes

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

Description

Problem

Zip file artifact created from auto scans don't have the latest text document content because we are reading the file contents from disk. This means auto scans are never scanning the latest version of the content.

Solution

Get the file contents from FileDocumentManager which has the latest changes and write that to the zip file instead of relying on file path / reading from disk.

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.

@ctlai95 ctlai95 marked this pull request as ready for review May 30, 2024 16:37
@ctlai95 ctlai95 requested review from a team as code owners May 30, 2024 16:37
@laileni-aws
Copy link
Contributor

/retryBuilds

@ctlai95 ctlai95 requested a review from ashishrp-aws June 4, 2024 21:33
@manodnyab
Copy link
Contributor

Can we add tests?

private fun zipFile(filePath: Path): File = createTemporaryZipFile {
try {
val relativePath = filePath.relativeTo(projectRoot.toNioPath())
val virtualFile = VirtualFileManager.getInstance().findFileByNioPath(filePath)
Copy link
Contributor

Choose a reason for hiding this comment

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

these two lines are error prone in case of remote development cases. i'll make the changes for these two once i complete testing for remote cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline, this will be addressed in a separate PR

@ctlai95
Copy link
Contributor Author

ctlai95 commented Jun 6, 2024

/retryBuilds

Copy link

sonarqubecloud bot commented Jun 6, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ctlai95 ctlai95 merged commit 8c109af into aws:main Jun 6, 2024
9 of 11 checks passed
ashishrp-aws added a commit to ashishrp-aws/aws-toolkit-jetbrains that referenced this pull request Jul 12, 2024
… for ZipOutputStream using bufferedStream instead of bytes array.

This reverts commit 8c109af.
ashishrp-aws added a commit that referenced this pull request Jul 16, 2024
…emory overflow and slowdowns. (#4669)

* Revert "fix(amazonq): auto scan use unsaved content (#4527)" + Fix for ZipOutputStream using bufferedStream instead of bytes array.

This reverts commit 8c109af.

* Corrections for codeScanDocumentListener.
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.

4 participants