Skip to content

Conversation

@Hweinstock
Copy link
Contributor

@Hweinstock Hweinstock commented Mar 26, 2025

Problem

codeDiff folder was missing from zip output.

Solution

Verify

The following test case now passes when there are uncommitted changes to the repo.

// packages/core/src/test/codewhisperer/zipUtil.test.ts
it('should generate a codeDiff folder when there are uncommitted changes', async function () {
            const zipMetadata = await zipUtil.generateZip(vscode.Uri.file(appCodePath), CodeAnalysisScope.PROJECT)
            const zipFileData = await fs.readFileBytes(zipMetadata.zipFilePath)
            const zip = await JSZip.loadAsync(zipFileData)
            const files = Object.keys(zip.files)
            assert.ok(files.find((f) => f === ZipConstants.codeDiffFilePath))
}) 

I did not commit this test case because it fails when there are aren't uncommitted changes. Currently this is difficult to test due to the nature of the code. This partly addressed in the same PR above.

Future Work

Rework/refactor the gitdiff logic to be more testable.


  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions
Copy link

  • This pull request modifies code in src/* but no tests were added/updated.
    • Confirm whether tests should be added or ensure the PR description explains why tests are not required.
  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

@Hweinstock Hweinstock changed the title fix(zipUtil): ensure codeDiff is generated when there are uncommitted changes fix(ziputil): ensure codeDiff is generated when there are uncommitted changes Mar 26, 2025
@Hweinstock Hweinstock closed this Mar 26, 2025
@Hweinstock Hweinstock reopened this Mar 26, 2025
@Hweinstock Hweinstock marked this pull request as ready for review March 26, 2025 02:53
@Hweinstock Hweinstock requested a review from a team as a code owner March 26, 2025 02:53
@Hweinstock Hweinstock merged commit c3ea31d into aws:master Mar 26, 2025
36 of 38 checks passed
@Hweinstock Hweinstock deleted the fix/codeDiffMissing branch March 26, 2025 03:19
Hweinstock added a commit to Hweinstock/aws-toolkit-vscode that referenced this pull request Mar 26, 2025
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.

2 participants