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

fix: revert skip validation #2023

Merged
merged 26 commits into from
Sep 20, 2022
Merged

Conversation

shaffeeullah
Copy link
Contributor

Fixes #709

@shaffeeullah shaffeeullah requested review from a team as code owners August 8, 2022 21:43
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/nodejs-storage API. labels Aug 8, 2022
src/file.ts Outdated Show resolved Hide resolved
Copy link
Member

@frankyn frankyn left a comment

Choose a reason for hiding this comment

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

One more comment.

test/file.ts Show resolved Hide resolved
@shaffeeullah
Copy link
Contributor Author

@frankyn i think this system test is failing because it's not returning the 'x-goog-stored-content-encoding' header. is that supposed to happen automatically?

Copy link
Contributor

@danielbankhead danielbankhead left a comment

Choose a reason for hiding this comment

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

I think we need some integration tests to associate with the new behavior

Copy link
Member

@frankyn frankyn left a comment

Choose a reason for hiding this comment

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

One last nit, @shaffeeullah, this will be blocked until the header is no longer allowlist required.

Otherwise, this LGTM! Thank you!

src/file.ts Outdated Show resolved Hide resolved
@shaffeeullah
Copy link
Contributor Author

shaffeeullah commented Aug 10, 2022

I think we need some integration tests to associate with the new behavior

There are already integration tests associated with this new boolean.

False case:

it('should skip validation if file is served decompressed', async () => {

True case:

it('should upload a gzipped file and download it', async () => {

There are also a few unit tests verifying that validation happens correctly. (Let me know if you'd like me to link those. I know they exist because I originally broke them with this change; they're doing good work!)

@shaffeeullah
Copy link
Contributor Author

shaffeeullah commented Aug 10, 2022

One last nit, @shaffeeullah, this will be blocked until the header is no longer allowlist required.

@frankyn What is the timeline for that?

@shaffeeullah shaffeeullah added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Aug 10, 2022
Copy link
Member

@frankyn frankyn left a comment

Choose a reason for hiding this comment

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

One more comment; otherwise LGTM, we can't merge this until the feature is available in production to everyone unless y'all are planning making a release until then.

if (validateStream) {
// We must check if the server decompressed the data on serve because hash
// validation is not possible in this case.
let failed = (crc32c || md5) && safeToValidate;
Copy link
Member

Choose a reason for hiding this comment

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

I think i got confused with failed variable; what does it do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

failed defaults to true (if crc32c || md5) and then later gets changed to false if it passes. (see below lines.) It's not true that it failed if it wasnt safeToValidate to begin with, so we need to make sure that's true before assuming failed

@shaffeeullah shaffeeullah removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Sep 20, 2022
@shaffeeullah
Copy link
Contributor Author

@frankyn says this is launched, clear to merge

@shaffeeullah shaffeeullah merged commit 70ab224 into main Sep 20, 2022
@shaffeeullah shaffeeullah deleted the shaffeeullah/revertskipvalidation branch September 20, 2022 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/nodejs-storage API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CONTENT_DOWNLOAD_MISMATCH with successful file download
3 participants