Skip to content

Conversation

@ctlai95
Copy link
Contributor

@ctlai95 ctlai95 commented Apr 22, 2024

Problem

The archiver package uses fs which is not available in the browser. Running npm run testWeb results in the following error:

TypeError: Cannot read properties of undefined (reading 'native')

Solution

License

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

@ctlai95 ctlai95 force-pushed the ctlai95/update-zip-stream branch 5 times, most recently from 01bdfa3 to 65ec6e8 Compare April 22, 2024 19:02
@justinmk3
Copy link
Contributor

justinmk3 commented Apr 22, 2024

test macOS (16.x, minimum) fails with ReferenceError: TransformStream is not defined

The "minimum" is testing a very old version of vscode, which has an older nodejs.

I think we can and should bump the minimum to a vscode version that has node 16. That will likely need to be a separate PR and may require some minor fixups in the tests, etc.

@ctlai95 ctlai95 force-pushed the ctlai95/update-zip-stream branch 7 times, most recently from 1c2dea8 to 2556aee Compare April 23, 2024 05:35
@justinmk3
Copy link
Contributor

I've added #4787 to our current sprint, to unblock this. So please feel free to continue with the assumption that the vscode minimum will be bumped.

@ctlai95 ctlai95 force-pushed the ctlai95/update-zip-stream branch from b41d29a to e7c95ae Compare May 7, 2024 20:38
@ctlai95 ctlai95 force-pushed the ctlai95/update-zip-stream branch from 4be3f1a to 7532d82 Compare May 8, 2024 00:28
@ctlai95 ctlai95 marked this pull request as ready for review May 8, 2024 00:36
@ctlai95 ctlai95 requested a review from a team as a code owner May 8, 2024 00:36
export interface ZipStreamResult {
sizeInBytes: number
md5: string
hash: string
Copy link

Choose a reason for hiding this comment

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

Nice!

@justinmk3
Copy link
Contributor

@ctlai95 vscode min version is now 1.83 : #5704

@ctlai95 ctlai95 requested a review from a team as a code owner October 7, 2024 20:08
@ctlai95 ctlai95 changed the title replace archiver with @zip.js/zip.js feat: replace archiver with @zip.js/zip.js Oct 7, 2024
@github-actions
Copy link

github-actions bot commented Oct 7, 2024

This pull request implements a feature or fix, so it must include a changelog entry. See CONTRIBUTING.md#changelog for instructions.

@ctlai95 ctlai95 changed the title feat: replace archiver with @zip.js/zip.js refactor: replace archiver with @zip.js/zip.js Oct 7, 2024
@ctlai95 ctlai95 removed the request for review from a team October 7, 2024 20:17
@ctlai95
Copy link
Contributor Author

ctlai95 commented Oct 8, 2024

/retryBuilds

@justinmk3
Copy link
Contributor

Update: we will wait 1 more week before increasing min vscode to 1.83, see #5749

@justinmk3
Copy link
Contributor

Update: we will wait 1 more week before increasing min vscode to 1.83, see #5749

vscode min version is now 1.83: #5771

Hweinstock added a commit that referenced this pull request Oct 23, 2024
…ystem counts (#5786)

## Problem
Performance tests are currently flaky, making them a poor signal for
performance regressions within the code base. Additionally, false alarms
slow down development of unrelated features as test failures keep CI
from being "green".

Therefore, rather than relying only on system usage thresholds for
performance regressions, we can count the number of high-risk /
potentially slow operations made by the code as a deterministic measure
of its performance. However, directly counting each individual
potentially slow operation used within the performance tests highly
couples the test to the implementation details, making the tests less
effective if the implementation changes.

Therefore, the goal of this PR is the following:

1. decrease performance test flakiness by increasing thresholds. 
2. increase performance test effectiveness by relying on deterministic
measures.
3. avoid coupling the tests to the implementation details. 

## Solution
To meet goal (1), we increase the thresholds of the tests to decrease
the changes of a false alarm.

To meet goal (2), we count expensive operations. But, to avoid tying it
to the implementation details, we count the expensive operations using
somewhat-loose upper bounds. Thus, implementation changes modifying the
exact number of expensive operations by a small constant do not set a
false alarm. However, if they increase the number of expensive
operations by a multiplicative factor, the upper bound will alert us.

As an example, we don't want the test to fail if it makes 5-10 more file
system calls when working with a few hundred files, but we do want the
test to fail if it makes 2x the number of files system calls. Therefore,
in the code the bounds are often described as "operations per file",
since it is the multiplicative increase we are concerned about. This
allows us to achieve goal (3).

### Implementation Details
- The most common "expensive operation" we count is file system calls
(through our `fs` module). Some other examples include the use of `zip`
libraries or loading large files into memory.
- We separate the upper bounds for the file system into `read` and
`write` bounds. This granularity allows us to assert that specific code
paths do not modify any files.

## Notes
- `AdmZip` removed in
#4769 , so we don't
address spying on it here. Once `zip.js` is implemented, we can spy on
it in a follow up.
---

<!--- REMINDER: Ensure that your PR meets the guidelines in
CONTRIBUTING.md -->

License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
@justinmk3 justinmk3 merged commit 566f83e into aws:master Oct 23, 2024
23 of 24 checks passed
@justinmk3
Copy link
Contributor

Can we now remove the dependencies that were added in #4629 ?

@types/archiver
@types/stream-buffer
archiver
stream-buffers

@ctlai95
Copy link
Contributor Author

ctlai95 commented Oct 23, 2024

@justinmk3 I can remove archiver but I think we need to keep stream-buffers

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