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: s3 200 errors handling #2968

Merged
merged 5 commits into from
Aug 13, 2024

Conversation

yenfryherrerafeliz
Copy link
Contributor

  • This change includes the following: -- Refactor the s3 200 response error handling logic so it can be opened for all s3 operations. -- Migrate some S3 parsers to a result mutator implementation so the code can be a bit cleaner.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@yenfryherrerafeliz yenfryherrerafeliz force-pushed the fix_s3200_handling branch 2 times, most recently from b91a09c to 7cc95b1 Compare July 29, 2024 17:19
Copy link
Member

@stobrien89 stobrien89 left a comment

Choose a reason for hiding this comment

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

Looking good so far

src/S3/Parser/S3Parser.php Outdated Show resolved Hide resolved
src/S3/Parser/GetBucketLocationResultMutator.php Outdated Show resolved Hide resolved
src/S3/Parser/S3Parser.php Outdated Show resolved Hide resolved
src/S3/Parser/S3Parser.php Outdated Show resolved Hide resolved
src/S3/Parser/S3Parser.php Outdated Show resolved Hide resolved
src/S3/S3Client.php Outdated Show resolved Hide resolved
src/S3/Parser/S3ResultMutator.php Outdated Show resolved Hide resolved
tests/S3/Parser/S3ParserTest.php Show resolved Hide resolved
@yenfryherrerafeliz yenfryherrerafeliz force-pushed the fix_s3200_handling branch 2 times, most recently from b44f432 to 9b1e18c Compare August 7, 2024 22:03
- This change includes the following:
-- Refactor the s3 200 response error handling logic so it can be opened for all s3 operations.
-- Migrate some S3 parsers to a result mutator implementation so the code can be a bit cleaner.
Resolve merge conflicts found in S3ClientTest.php
GetObject operation has a streaming member which will be ignored and hence not treated as a 200 s3 error.
Make sure that operations where any of its member has an eventstream or streaming trait are ignored.
src/S3/Parser/GetBucketLocationResultMutator.php Outdated Show resolved Hide resolved
src/S3/Parser/S3Parser.php Outdated Show resolved Hide resolved
src/S3/Parser/S3Parser.php Outdated Show resolved Hide resolved
src/S3/Parser/S3Parser.php Outdated Show resolved Hide resolved
src/S3/Parser/S3Parser.php Outdated Show resolved Hide resolved
src/S3/Parser/ValidateResponseChecksumResultMutator.php Outdated Show resolved Hide resolved
* @param $checksumPriority
* @param ResponseInterface $response
*/
public function chooseChecksumHeaderToValidate(
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 we should make this private, as well as the one above it, so long as they aren't called directly anywhere else in our source code. We should be able to indirectly test selection/validation via the result returned when invoking this class. These are helper methods which shouldn't have been made public in the original implementation

src/S3/S3Client.php Show resolved Hide resolved
src/S3/S3Client.php Outdated Show resolved Hide resolved
tests/S3/Parser/GetBucketLocationResultMutatorTest.php Outdated Show resolved Hide resolved
Copy link
Member

@stobrien89 stobrien89 left a comment

Choose a reason for hiding this comment

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

Mostly coding style (line length) and formatting requests. My comment from the previous round regarding method visibility on the checksum mutator class

src/S3/Parser/GetBucketLocationResultMutator.php Outdated Show resolved Hide resolved
src/S3/Parser/S3Parser.php Show resolved Hide resolved
src/S3/Parser/S3Parser.php Outdated Show resolved Hide resolved
src/S3/Parser/S3Parser.php Outdated Show resolved Hide resolved
src/S3/Parser/ValidateResponseChecksumResultMutator.php Outdated Show resolved Hide resolved
* @param $checksumPriority
* @param ResponseInterface $response
*/
public function chooseChecksumHeaderToValidate(
Copy link
Member

Choose a reason for hiding this comment

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

This hasn't been addressed

tests/S3/Parser/S3ParserTest.php Outdated Show resolved Hide resolved
tests/S3/Parser/S3ParserTest.php Outdated Show resolved Hide resolved
@yenfryherrerafeliz yenfryherrerafeliz force-pushed the fix_s3200_handling branch 3 times, most recently from 11ebd63 to 954c9d1 Compare August 12, 2024 19:03
Copy link
Member

@stobrien89 stobrien89 left a comment

Choose a reason for hiding this comment

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

LGTM minus one line length comment (on a method signature) that wasn't addressed. I would just check this one more time and see if any look to be over 80 and adjust accordingly (wrap, etc.)

src/S3/Parser/S3Parser.php Outdated Show resolved Hide resolved
- Split statements into multiple lines to improve readability.
- Make pattern variable for finding the Error element name to be static.
- Add a test in the GetBucketLocationResultMutatorTest to make sure the mutator just applies to GetBucketLocation.
- Move some values into static variables in the GetBucketLocationMutator implementation.
- Change the visibility of some methods in the ValidateResponseCheckResultMutator from public to private.
- Refactor the tests on ValidateResponseCheckResultMutatorTest to make them be executed from the mutator invokation instead of testing those methods independently.
@yenfryherrerafeliz yenfryherrerafeliz merged commit f9c9edb into aws:master Aug 13, 2024
19 checks passed
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.

None yet

2 participants