Skip to content

Conversation

@Hweinstock
Copy link
Contributor

@Hweinstock Hweinstock commented Mar 21, 2025

Problem

ZipUtil contains a mix of different utilities from working with workspaces, to computing git diffs. These are all used in zipping the project, but inherently have no connection to it.

Larger problem is that ZipUtil is highly coupled to agent implementations and is difficult to generalize. Moving out non-zipping noise will help.

Solution

  • Move these utils to more appropriate locations.
  • Move the GitDiff utilities out of the ZipUtil class. These functions have no test coverage and are therefore unsafe to export or move to their own file in its current state.

Future Work

Refactor to avoid references to scope and use case.


  • 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.

@Hweinstock
Copy link
Contributor Author

Hweinstock commented Mar 21, 2025

/runIntegrationTests

@Hweinstock
Copy link
Contributor Author

Integ tests failed for unrelated flaky tests. :(

@Hweinstock Hweinstock marked this pull request as ready for review March 21, 2025 21:53
@Hweinstock Hweinstock requested review from a team as code owners March 21, 2025 21:53
@Hweinstock Hweinstock changed the title refactor(ziputil): remove non-zipping related utilities out of ZipUtil. (WIP) refactor(ziputil): remove non-zipping related utilities out of ZipUtil Mar 21, 2025

export const readonlyDocument = new ReadonlyDocument()

export async function getTextContent(uri: vscode.Uri) {
Copy link
Contributor

Choose a reason for hiding this comment

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

it blows my mind we didn't have this already 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, its pretty small so its possible/likely something similar is inlined in a few places.

assert.deepStrictEqual(getWorkspacePaths(), [workspaceFolder])
})

it('Should return the correct project path for unit test generation', function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can probably dropunit test generation, i'm guessing that was just leftover from the zipUtil test

@Hweinstock Hweinstock merged commit 4b20c5a into aws:master Mar 25, 2025
28 of 32 checks passed
@Hweinstock Hweinstock deleted the zipUtil/split branch March 25, 2025 13:41
Hweinstock added a commit to Hweinstock/aws-toolkit-vscode that referenced this pull request Mar 26, 2025
import { getWorkspaceForFile, getWorkspacePaths } from '../../../shared/utilities/workspaceUtils'
import { getTestWorkspaceFolder } from '../../../testInteg/integrationTestsUtilities'

describe('getWorkspace utilities', function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

was this test file intentionally placed in amazonq/util/ instead of shared/utilities/ ?

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